Skip to content

Commit

Permalink
Refactor scripts into entry points to be usable with zc.buildout >= 3. (
Browse files Browse the repository at this point in the history
  • Loading branch information
icemac authored Sep 27, 2023
1 parent 4b36cf3 commit 547de2f
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 23 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
unreleased
* Refactor scripts into entry points to be usable with zc.buildout >= 3.

22.2.3
* Simplify recording of top-level object such that permissions that are only
granted to Manager. This creates a one-time diff in this object, but makes
Expand Down
6 changes: 0 additions & 6 deletions bin/perfact-zopeplayback

This file was deleted.

6 changes: 0 additions & 6 deletions bin/zodbsync

This file was deleted.

20 changes: 15 additions & 5 deletions bin/perfact-zoperecord → perfact/zodbsync/scripts.py
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python

import argparse

from perfact.zodbsync.main import Runner
Expand All @@ -9,12 +7,17 @@
except ImportError:
pass

if __name__ == '__main__':

def zodbsync():
Runner().run()


def zoperecord():
parser = argparse.ArgumentParser(
description='Record the Data.fs',
epilog='''This script is deprecated in favor of zodbsync. Only bare
functionality is provided for backwards compatiblity with existing cron
entries.
functionality is provided for backwards compatibility with existing
cron entries.
'''
)
parser.add_argument('--lasttxn', action='store_true', default=False,
Expand Down Expand Up @@ -44,3 +47,10 @@
config.commit_message = msgbak

runner.run()


def zopeplayback():
assert False, (
"perfact-zopeplayback is no longer supported as executable, please use"
" zodbsync instead."
)
12 changes: 7 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@
packages=setuptools.find_packages('.'),
package_data={
},
scripts = [
'bin/perfact-zoperecord',
'bin/perfact-zopeplayback',
'bin/zodbsync',
],
entry_points={
'console_scripts': [
'perfact-zoperecord=perfact.zodbsync.scripts:zoperecord',
'perfact-zopeplayback=perfact.zodbsync.scripts:zopeplayback',
'zodbsync=perfact.zodbsync.scripts:zodbsync',
]
},
license='GPLv2',
platforms=['Linux',],
install_requires=reqs,
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ deps =
git+https://github.com/perfact/Products.ZPyODBCDA

commands =
flake8 perfact bin
flake8 perfact
coverage run --source=perfact,bin -m pytest {posargs}
py2: coverage report --rcfile=.toxfiles/coveragerc-py2 --show-missing
py3: coverage report --rcfile=.toxfiles/coveragerc-py3 --show-missing
Expand Down

0 comments on commit 547de2f

Please sign in to comment.