You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gump.apache.org by aj...@apache.org on 2020/11/29 04:04:08 UTC
svn commit: r1883922 - in /gump/branches/python3: bin/integrate.py
bin/preview.py bin/repo.py bin/testrunner.py
python/gump/actor/syndication/syndicator.py
python/gump/core/runner/demand.py python/gump/core/runner/runner.py
Author: ajack
Date: Sun Nov 29 04:04:08 2020
New Revision: 1883922
URL: http://svn.apache.org/viewvc?rev=1883922&view=rev
Log:
Looking for more python to convert.
Modified:
gump/branches/python3/bin/integrate.py
gump/branches/python3/bin/preview.py
gump/branches/python3/bin/repo.py
gump/branches/python3/bin/testrunner.py
gump/branches/python3/python/gump/actor/syndication/syndicator.py
gump/branches/python3/python/gump/core/runner/demand.py
gump/branches/python3/python/gump/core/runner/runner.py
Modified: gump/branches/python3/bin/integrate.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/bin/integrate.py?rev=1883922&r1=1883921&r2=1883922&view=diff
==============================================================================
--- gump/branches/python3/bin/integrate.py (original)
+++ gump/branches/python3/bin/integrate.py Sun Nov 29 04:04:08 2020
@@ -77,7 +77,7 @@ def irun():
options.setQuick(False)
options.setCache(False)
- if not os.environ.has_key('GUMP_WORK_OFFLINE'):
+ if 'GUMP_WORK_OFFLINE' not in os.environ:
options.setObjectives(gump.core.run.options.OBJECTIVE_INTEGRATE)
else:
options.setCache(True)
Modified: gump/branches/python3/bin/preview.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/bin/preview.py?rev=1883922&r1=1883921&r2=1883922&view=diff
==============================================================================
--- gump/branches/python3/bin/preview.py (original)
+++ gump/branches/python3/bin/preview.py Sun Nov 29 04:04:08 2020
@@ -91,37 +91,37 @@ def prun():
languageHelper=runner.getJavaHelper()
for module in run.getGumpSet().getModules():
- print SEPARATOR
- print `module`
+ print(SEPARATOR)
+ print(repr(module))
if debug:
- print module.getXml()
+ print(module.getXml())
module.dump()
if module.isUpdatable():
updater.preview(module)
for project in run.getGumpSet().getProjects():
- print SEPARATOR
- print `project`
+ print(SEPARATOR)
+ print(repr(project))
if debug:
- print project.getXml()
+ print(project.getXml())
project.dump()
if project.hasBuilder():
builder.preview(project, languageHelper)
# Show any nasties...
if workspace.containsNasties():
- print SEPARATOR
- print `workspace`
+ print(SEPARATOR)
+ print(repr(workspace))
Annotatable.dump(workspace)
for module in run.getGumpSet().getModules():
if module.containsNasties():
- print SEPARATOR
- print `module`
+ print(SEPARATOR)
+ print(repr(module))
Annotatable.dump(module)
for project in run.getGumpSet().getProjects():
if project.containsNasties():
- print SEPARATOR
- print `project`
+ print(SEPARATOR)
+ print(repr(project))
Annotatable.dump(project)
# bye!
Modified: gump/branches/python3/bin/repo.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/bin/repo.py?rev=1883922&r1=1883921&r2=1883922&view=diff
==============================================================================
--- gump/branches/python3/bin/repo.py (original)
+++ gump/branches/python3/bin/repo.py Sun Nov 29 04:04:08 2020
@@ -32,7 +32,7 @@ import pprint
from gump import log
from gump.core.gumpinit import gumpinit
-import gump.repository.artifact
+import gump.actor.repository.artifact
# static void main()
if __name__=='__main__':
@@ -41,19 +41,19 @@ if __name__=='__main__':
result = 1
if not len(sys.argv) >= 1:
- raise RuntimeError, 'Usage: repo.py \'repo directory\' [\'clean\']'
+ raise RuntimeError('Usage: repo.py \'repo directory\' [\'clean\']')
dir = sys.argv[1]
clean = len(sys.argv) == 2
- if not os.path.exists(dir): raise RuntimeError, 'No such directory : ' + `dir`
- if not os.path.isdir(dir): raise RuntimeError, 'Not a directory : ' + `dir`
+ if not os.path.exists(dir): raise RuntimeError('No such directory : ' + repr(dir))
+ if not os.path.isdir(dir): raise RuntimeError('Not a directory : ' + repr(dir))
repo=gump.repository.artifact.ArtifactRepository(dir)
for group in repo.getGroups():
- print '---------------------------------------------------------'
- print 'Group : ' + group
+ print('---------------------------------------------------------')
+ print('Group : ' + group)
pprint.pprint(repo.extractGroup(group))
log.info('Gump Repository Tool Complete. Exit code:' + str(result))
Modified: gump/branches/python3/bin/testrunner.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/bin/testrunner.py?rev=1883922&r1=1883921&r2=1883922&view=diff
==============================================================================
--- gump/branches/python3/bin/testrunner.py (original)
+++ gump/branches/python3/bin/testrunner.py Sun Nov 29 04:04:08 2020
@@ -40,6 +40,7 @@ import sys
import time
import traceback
import unittest
+from functools import reduce
VERBOSE = 2
@@ -124,7 +125,7 @@ class TestRunner:
def getSuiteFromFile(self, filepath):
if not os.path.isfile(filepath):
- raise ValueError, '%s is not a file' % filepath
+ raise ValueError('%s is not a file' % filepath)
path, filename = os.path.split(filepath)
name, ext = os.path.splitext(filename)
file, pathname, desc = imp.find_module(name, [path])
@@ -187,7 +188,7 @@ class TestRunner:
verbose_on_error=self.verbose_on_error)
def report(self, message):
- print >>sys.stderr, message
+ print(message, file=sys.stderr)
def runAllTests(self):
"""Run all tests found in the current working directory and
@@ -202,9 +203,9 @@ class TestRunner:
names.remove(ignore)
if '.testinfo' in names: # allow local control
f = open(os.path.join(pathname, '.testinfo'))
- lines = filter(None, f.readlines())
- lines = map(lambda x: x[-1]=='\n' and x[:-1] or x, lines)
- names = filter(lambda x: x and x[0] != '#', lines)
+ lines = [_f for _f in f.readlines() if _f]
+ lines = [x[-1]=='\n' and x[:-1] or x for x in lines]
+ names = [x for x in lines if x and x[0] != '#']
f.close()
return names
@@ -291,7 +292,7 @@ class FancyTestResult(unittest._TextTest
verbose_on_error = 0
def __init__(self, *args, **kw):
- if "verbose_on_error" in kw.keys():
+ if "verbose_on_error" in list(kw.keys()):
self.verbose_on_error = kw["verbose_on_error"]
del kw["verbose_on_error"]
unittest._TextTestResult.__init__(self, *args, **kw)
@@ -347,7 +348,7 @@ def excname(cls):
class FancyTestRunner(unittest.TextTestRunner):
def __init__(self, *args, **kw):
- if "verbose_on_error" in kw.keys():
+ if "verbose_on_error" in list(kw.keys()):
self.verbose_on_error = kw["verbose_on_error"]
del kw["verbose_on_error"]
else:
@@ -434,7 +435,7 @@ def setconfig(**kw):
pass
else:
config = App.config.getConfiguration()
- for key, value in kw.items():
+ for key, value in list(kw.items()):
setattr(config, key, value)
App.config.setConfiguration(config)
@@ -472,19 +473,19 @@ def walk_with_symlinks(path, visit, arg)
def remove_stale_bytecode(arg, dirname, names):
- names = map(os.path.normcase, names)
+ names = list(map(os.path.normcase, names))
for name in names:
if name.endswith(".pyc") or name.endswith(".pyo"):
srcname = name[:-1]
if srcname not in names:
fullname = os.path.join(dirname, name)
- print >>sys.stderr, "Removing stale bytecode file", fullname,
+ print("Removing stale bytecode file", fullname, end=' ', file=sys.stderr)
try:
os.unlink(fullname)
- except (OSError, IOError), e:
- print >>sys.stderr, ' --> %s (errno %d)' % (e.strerror, e.errno)
+ except (OSError, IOError) as e:
+ print(' --> %s (errno %d)' % (e.strerror, e.errno), file=sys.stderr)
else:
- print >>sys.stderr
+ print(file=sys.stderr)
def main(args):
@@ -595,7 +596,7 @@ def main(args):
try:
options, arg = getopt.getopt(args, 'aempPhd:f:v:qMo:t:iI:kKC:')
- except getopt.GetoptError, e:
+ except getopt.GetoptError as e:
err_exit(e.msg)
if not options:
@@ -683,7 +684,7 @@ def main(args):
if zope_config:
zope_config = realpath(zope_config)
if verbosity > 0:
- print >>sys.stderr, 'Parsing', zope_config
+ print('Parsing', zope_config, file=sys.stderr)
import Zope
Zope.configure(zope_config)
# Ignore softwarehome from config
Modified: gump/branches/python3/python/gump/actor/syndication/syndicator.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/python/gump/actor/syndication/syndicator.py?rev=1883922&r1=1883921&r2=1883922&view=diff
==============================================================================
--- gump/branches/python3/python/gump/actor/syndication/syndicator.py (original)
+++ gump/branches/python3/python/gump/actor/syndication/syndicator.py Sun Nov 29 04:04:08 2020
@@ -24,8 +24,6 @@ import os
import sys
import logging
-from string import lower, capitalize
-
from gump import log
from gump.core.run.gumprun import *
from gump.core.run.actor import AbstractRunActor
Modified: gump/branches/python3/python/gump/core/runner/demand.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/python/gump/core/runner/demand.py?rev=1883922&r1=1883921&r2=1883922&view=diff
==============================================================================
--- gump/branches/python3/python/gump/core/runner/demand.py (original)
+++ gump/branches/python3/python/gump/core/runner/demand.py Sun Nov 29 04:04:08 2020
@@ -189,7 +189,7 @@ class OnDemandRunner(GumpRunner):
# W/ multiple project in one module, it may be done
if not module.isUpdated():
- self.log.debug('Update module *inlined* (not in background thread) ' + `module` + '.')
+ self.log.debug('Update module *inlined* (not in background thread) ' + repr(module) + '.')
inlined+=1
self.performUpdate(module)
@@ -234,7 +234,7 @@ class UpdateWork:
self.module=module
def __str__(self):
- return 'UpdateWork:'+`self.module`
+ return 'UpdateWork:'+repr(self.module)
class UpdateWorker(WorkerThread):
"""
Modified: gump/branches/python3/python/gump/core/runner/runner.py
URL: http://svn.apache.org/viewvc/gump/branches/python3/python/gump/core/runner/runner.py?rev=1883922&r1=1883921&r2=1883922&view=diff
==============================================================================
--- gump/branches/python3/python/gump/core/runner/runner.py (original)
+++ gump/branches/python3/python/gump/core/runner/runner.py Sun Nov 29 04:04:08 2020
@@ -156,7 +156,7 @@ class GumpRunner(RunSpecific):
try:
import gump.actor.mysql.databaser
self.run.registerActor(gump.actor.mysql.databaser.Databaser(self.run))
- except Exception, details:
+ except Exception as details:
self.log.warning('Unable to register Database Actor : %s ' % details,
exc_info=1)
@@ -167,7 +167,7 @@ class GumpRunner(RunSpecific):
try:
import gump.actor.history.historical
self.run.registerActor(gump.actor.history.historical.Historical(self.run))
- except Exception, details:
+ except Exception as details:
self.log.warning('Unable to register Historical Database Actor : %s ' % details,
exc_info=1)
@@ -205,7 +205,7 @@ class GumpRunner(RunSpecific):
try:
import gump.actor.rdf.describer
self.run.registerActor(gump.actor.rdf.describer.RDFDescriber(self.run))
- except Exception, details:
+ except Exception as details:
self.log.warning('Unable to register RDF Describer : %s ' % details,
exc_info=1)
@@ -250,14 +250,12 @@ class GumpRunner(RunSpecific):
Does the actual gump work by delegating to the performRun(run) method of a subclass.
"""
if not hasattr(self,'performRun'):
- raise RuntimeError, \
- 'Class [' + `self.__class__` + '] needs a performRun(self,run)'
+ raise RuntimeError('Class [' + repr(self.__class__) + '] needs a performRun(self,run)')
if not callable(self.performRun):
- raise RuntimeError, \
- 'Class [' + `self.__class__` + '] needs a callable performRun(self,run)'
+ raise RuntimeError('Class [' + repr(self.__class__) + '] needs a callable performRun(self,run)')
- self.log.debug('Perform run using [' + `self` + ']')
+ self.log.debug('Perform run using [' + repr(self) + ']')
return self.performRun()