Skip to content

Commit

Permalink
Lint the code.
Browse files Browse the repository at this point in the history
Add support for Python 3.9.
  • Loading branch information
Michael Howitz committed Jun 1, 2021
1 parent 5bb7de7 commit 7dfee3e
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 39 deletions.
2 changes: 1 addition & 1 deletion README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Changes
2.1.0 (unreleased)
==================

- Add support for Python 3.5 up to Python 3.8.
- Add support for Python 3.5, 3.6, 3.7, 3.8 and 3.9.

- Drop support for Python 2,6, 3.2 and 3.3.

Expand Down
31 changes: 16 additions & 15 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def read(*rnames):
+ '\n' +
'Download\n'
'**********************\n'
)
)

tests_require = [
'zdaemon',
Expand All @@ -26,7 +26,7 @@ def read(*rnames):
'zope.proxy',
'zope.testrunner',
'zodbpickle',
]
]

name = "zc.zodbrecipes"
setup(
Expand Down Expand Up @@ -54,25 +54,26 @@ def read(*rnames):
extras_require=dict(test=tests_require),
entry_points={
'zc.buildout': [
'server = %s:StorageServer' % name,
]
},
'server = %s:StorageServer' % name,
]
},
classifiers=[
'Framework :: Buildout',
'Intended Audience :: Developers',
'License :: OSI Approved :: Zope Public License',
'Topic :: Software Development :: Build Tools',
'Topic :: Software Development :: Libraries :: Python Modules',

"Natural Language :: English",
"Programming Language :: Python",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
],
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Programming Language :: Python",
'Framework :: Buildout',
'Intended Audience :: Developers',
'License :: OSI Approved :: Zope Public License',
'Topic :: Software Development :: Build Tools',
'Topic :: Software Development :: Libraries :: Python Modules',
],
test_suite='zc.zodbrecipes.tests.test_suite',
tests_require=tests_require,
)
)
40 changes: 20 additions & 20 deletions src/zc/zodbrecipes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def __init__(self, buildout, name, options):
options['run-directory'] = os.path.join(
buildout['buildout']['parts-directory'],
self.name,
)
)

options['scripts'] = ''
options['eggs'] = options.get('eggs', '') + '\nzdaemon\nsetuptools'
Expand All @@ -62,17 +62,17 @@ def __init__(self, buildout, name, options):
options['runzeo'] = os.path.join(
buildout['buildout']['bin-directory'],
options.get('runzeo', 'runzeo'),
)
)

options['zdaemon'] = os.path.join(
buildout['buildout']['bin-directory'],
options.get('zdaemon', 'zdaemon'),
)
)

options['zeopack'] = os.path.join(
buildout['buildout']['bin-directory'],
options.get('zeopack', 'zeopack'),
)
)

if options.get('shell-script', '') not in ('true', 'false', ''):
raise zc.buildout.UserError(
Expand All @@ -88,28 +88,28 @@ def install(self):
deployment = self.deployment
if deployment:
zeo_conf_path = os.path.join(options['etc-directory'],
self.name+'-zeo.conf')
self.name + '-zeo.conf')
zdaemon_conf_path = os.path.join(options['etc-directory'],
self.name+'-zdaemon.conf')
self.name + '-zdaemon.conf')
event_log_path = os.path.join(options['log-directory'],
self.name+'-zeo.log')
self.name + '-zeo.log')
socket_path = os.path.join(run_directory,
self.name+'-zdaemon.sock')
self.name + '-zdaemon.sock')
rc = options['deployment-name'] + '-' + self.name

options.created(
zeo_conf_path,
zdaemon_conf_path,
os.path.join(options['rc-directory'], rc),
)
)

logrotate = options['logrotate']
if logrotate:
open(logrotate, 'w').write(logrotate_template % dict(
logfile=event_log_path,
rc=os.path.join(options['rc-directory'], rc),
conf=zdaemon_conf_path,
))
))
options.created(logrotate)

pack = options.get('pack')
Expand All @@ -124,7 +124,7 @@ def install(self):
pack_path = os.path.join(
options['crontab-directory'],
"pack-%s-%s" % (options['deployment-name'], self.name),
)
)
if not os.path.exists(options['zeopack']):
logger.warn("Couln'e find zeopack script, %r",
options['zeopack'])
Expand All @@ -141,13 +141,13 @@ def install(self):
os.mkdir(run_directory)
pack = pack_path = None

zeo_conf = options.get('zeo.conf', '')+'\n'
zeo_conf = options.get('zeo.conf', '') + '\n'
try:
zeo_conf = ZConfig.schemaless.loadConfigFile(StringIO(zeo_conf))
except ConfigurationSyntaxError as e:
raise zc.buildout.UserError(
'%s in:\n%s' % (e, zeo_conf)
)
)

zeo_section = [s for s in zeo_conf.sections if s.type == 'zeo']
if not zeo_section:
Expand All @@ -168,7 +168,7 @@ def install(self):
if not [s for s in zeo_conf.sections if s.type == 'eventlog']:
zeo_conf.sections.append(event_log('STDOUT'))

zdaemon_conf = options.get('zdaemon.conf', '')+'\n'
zdaemon_conf = options.get('zdaemon.conf', '') + '\n'
zdaemon_conf = ZConfig.schemaless.loadConfigFile(
StringIO(zdaemon_conf))

Expand All @@ -178,7 +178,7 @@ def install(self):
'transcript': event_log_path,
'socket-name': socket_path,
'directory': run_directory,
}
}
if deployment:
defaults['user'] = options['user']
runner = [s for s in zdaemon_conf.sections
Expand Down Expand Up @@ -211,12 +211,12 @@ def install(self):
contents = "%(zdaemon)s -C '%(conf)s' $*" % dict(
zdaemon=options['zdaemon'],
conf=zdaemon_conf_path,
)
)
if options.get('user'):
contents = 'su %(user)s -c \\\n "%(contents)s"' % dict(
user=options['user'],
contents=contents,
)
)
contents = "#!/bin/sh\n%s\n" % contents

dest = os.path.join(options['rc-directory'], rc)
Expand All @@ -238,7 +238,7 @@ def install(self):
% ('-C', zdaemon_conf_path,
)
),
)
)

if pack:
address, = zeo_section['address']
Expand All @@ -249,9 +249,9 @@ def install(self):
try:
port = int(address)
except ValueError:
address = '-U '+address
address = '-U ' + address
else:
address = '-p '+address
address = '-p ' + address
f = open(pack_path, 'w')
if len(pack) == 7:
assert '@' in pack[6]
Expand Down
6 changes: 3 additions & 3 deletions src/zc/zodbrecipes/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def setUp(test):
'-pyN.N.egg',),
not_found,
setuptools_or_distribute,
])
])


def test_suite():
Expand All @@ -69,6 +69,6 @@ def test_suite():
'zeo.txt',
setUp=setUp, tearDown=zc.buildout.testing.buildoutTearDown,
checker=checker,
),
),

))
))

0 comments on commit 7dfee3e

Please sign in to comment.