diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..615323a --- /dev/null +++ b/.editorconfig @@ -0,0 +1,39 @@ +# Generated from: +# https://github.com/zopefoundation/meta/tree/master/config/zope-product +# +# EditorConfig Configuration file, for more details see: +# http://EditorConfig.org +# EditorConfig is a convention description, that could be interpreted +# by multiple editors to enforce common coding conventions for specific +# file types + +# top-most EditorConfig file: +# Will ignore other EditorConfig files in Home directory or upper tree level. +root = true + + +[*] # For All Files +# Unix-style newlines with a newline ending every file +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true +# Set default charset +charset = utf-8 +# Indent style default +indent_style = space +# Max Line Length - a hard line wrap, should be disabled +max_line_length = off + +[*.{py,cfg,ini}] +# 4 space indentation +indent_size = 4 + +[*.{yml,zpt,pt,dtml}] +# 2 space indentation +indent_size = 2 + +[{Makefile,.gitmodules}] +# Tab indentation (no size specified, but view as 4 spaces) +indent_style = tab +indent_size = unset +tab_width = unset diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..419bc3e --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,56 @@ +# Generated from: +# https://github.com/zopefoundation/meta/tree/master/config/zope-product +name: tests + +on: + push: + branches: [ master ] + pull_request: + schedule: + - cron: '0 12 * * 0' # run once a week on Sunday + +jobs: + build: + strategy: + matrix: + config: + # [Python version, tox env] + - ["3.8", "lint"] + - ["2.7", "py27"] + - ["3.5", "py35"] + - ["3.6", "py36"] + - ["3.7", "py37"] + - ["3.8", "py38"] + - ["3.9", "py39"] + - ["3.8", "docs"] + - ["3.8", "coverage"] + + runs-on: ubuntu-latest + name: ${{ matrix.config[1] }} + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.config[0] }} + - name: Pip cache + uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ matrix.config[0] }}-${{ hashFiles('setup.*', 'tox.ini') }} + restore-keys: | + ${{ runner.os }}-pip-${{ matrix.config[0] }}- + ${{ runner.os }}-pip- + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install tox + - name: Test + run: tox -e ${{ matrix.config[1] }} + - name: Coverage + if: matrix.config[1] == 'coverage' + run: | + pip install coveralls coverage-python-version + coveralls --service=github + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 55d496b..350f386 100644 --- a/.gitignore +++ b/.gitignore @@ -1,28 +1,28 @@ -*.egg -*.egg-info -*.mo +# Generated from: +# https://github.com/zopefoundation/meta/tree/master/config/zope-product +*.egg-info/ +*.profraw *.pyc *.pyo -.eggs +.coverage +.coverage.* +.eggs/ .installed.cfg .mr.developer.cfg -.tox -.coverage* -bin -build -_build +.tox/ +__pycache__/ +bin/ +build/ coverage.xml -default.profraw -develop-eggs -dist -downloads -eggs -htmlcov -local.cfg -parts +develop-eggs/ +develop/ +dist/ +docs/_build +eggs/ +etc/ +lib/ +lib64 +log/ +parts/ pyvenv.cfg -var -include -lib -local -src +var/ diff --git a/.meta.toml b/.meta.toml new file mode 100644 index 0000000..3de3a61 --- /dev/null +++ b/.meta.toml @@ -0,0 +1,39 @@ +# Generated from: +# https://github.com/zopefoundation/meta/tree/master/config/zope-product +[meta] +template = "zope-product" +commit-id = "4415752fead07401ce0e45c7d27ed81f6eeddf4f" + +[python] +with-appveyor = false +with-pypy = false +with-legacy-python = true +with-docs = true +with-sphinx-doctests = false + +[coverage] +fail-under = 76 + +[isort] +known_first_party = "Products.CMFCore" +known_localfolder = "Products.DCWorkflow" + +[flake8] +additional-config = [ + "exclude =", + " src/Products/DCWorkflow/doc/examples/*", + ] + +[manifest] +additional-rules = [ + "include buildout4.cfg", + "recursive-include src *.dtml", + "recursive-include src *.gif", + "recursive-include src *.xml", + ] + +[check-manifest] +additional-ignores = [ + "docs/_build/html/_sources/narrative/*", + "docs/_build/html/_sources/api/*", + ] diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index bf5bff1..0000000 --- a/.travis.yml +++ /dev/null @@ -1,37 +0,0 @@ -language: python - -matrix: - include: - - python: "3.6" - env: TOXENV=flake8 - - python: "2.7" - env: TOXENV=py27 - - python: "3.5" - env: TOXENV=py35 - - python: "3.6" - env: TOXENV=py36 - - python: "3.7" - env: TOXENV=py37 - dist: xenial - - python: "3.8" - env: TOXENV=py38 - dist: xenial - -install: - - travis_retry pip install -U pip setuptools - - travis_retry pip install -U tox coveralls coverage - -script: - - travis_retry tox - -after_success: - - coverage combine - - coveralls - -notifications: - email: false - -cache: - pip: true - directories: - - eggs/ diff --git a/MANIFEST.in b/MANIFEST.in index 680b84d..bc06b89 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,9 +1,22 @@ +# Generated from: +# https://github.com/zopefoundation/meta/tree/master/config/zope-product +include *.rst include *.txt -include *.cfg -include *.py +include buildout.cfg +include tox.ini -recursive-include Products * -recursive-include docs * +recursive-include docs *.bat +recursive-include docs *.py +recursive-include docs *.rst +recursive-include docs *.txt +recursive-include docs Makefile -global-exclude *.pyc -global-exclude *.pyo +recursive-include src *.pt +recursive-include src *.py +recursive-include src *.rst +recursive-include src *.txt +recursive-include src *.zcml +include buildout4.cfg +recursive-include src *.dtml +recursive-include src *.gif +recursive-include src *.xml diff --git a/README.rst b/README.rst index 71491f7..72aab8d 100644 --- a/README.rst +++ b/README.rst @@ -1,5 +1,5 @@ -.. image:: https://travis-ci.com/zopefoundation/Products.DCWorkflow.svg?branch=master - :target: https://travis-ci.com/zopefoundation/Products.DCWorkflow +.. image:: https://github.com/zopefoundation/Products.DCWorkflow/workflows/tests/badge.svg + :target: https://github.com/zopefoundation/Products.DCWorkflow/actions?query=workflow%3Atests .. image:: https://coveralls.io/repos/github/zopefoundation/Products.DCWorkflow/badge.svg :target: https://coveralls.io/github/zopefoundation/Products.DCWorkflow diff --git a/bootstrap.py b/bootstrap.py deleted file mode 100644 index 1f59b21..0000000 --- a/bootstrap.py +++ /dev/null @@ -1,210 +0,0 @@ -############################################################################## -# -# Copyright (c) 2006 Zope Foundation and Contributors. -# All Rights Reserved. -# -# This software is subject to the provisions of the Zope Public License, -# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. -# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED -# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS -# FOR A PARTICULAR PURPOSE. -# -############################################################################## -"""Bootstrap a buildout-based project - -Simply run this script in a directory containing a buildout.cfg. -The script accepts buildout command-line options, so you can -use the -c option to specify an alternate configuration file. -""" - -import os -import shutil -import sys -import tempfile - -from optparse import OptionParser - -__version__ = '2015-07-01' -# See zc.buildout's changelog if this version is up to date. - -tmpeggs = tempfile.mkdtemp(prefix='bootstrap-') - -usage = '''\ -[DESIRED PYTHON FOR BUILDOUT] bootstrap.py [options] - -Bootstraps a buildout-based project. - -Simply run this script in a directory containing a buildout.cfg, using the -Python that you want bin/buildout to use. - -Note that by using --find-links to point to local resources, you can keep -this script from going over the network. -''' - -parser = OptionParser(usage=usage) -parser.add_option("--version", - action="store_true", default=False, - help=("Return bootstrap.py version.")) -parser.add_option("-t", "--accept-buildout-test-releases", - dest='accept_buildout_test_releases', - action="store_true", default=False, - help=("Normally, if you do not specify a --buildout-version, " - "the bootstrap script and buildout gets the newest " - "*final* versions of zc.buildout and its recipes and " - "extensions for you. If you use this flag, " - "bootstrap and buildout will get the newest releases " - "even if they are alphas or betas.")) -parser.add_option("-c", "--config-file", - help=("Specify the path to the buildout configuration " - "file to be used.")) -parser.add_option("-f", "--find-links", - help=("Specify a URL to search for buildout releases")) -parser.add_option("--allow-site-packages", - action="store_true", default=False, - help=("Let bootstrap.py use existing site packages")) -parser.add_option("--buildout-version", - help="Use a specific zc.buildout version") -parser.add_option("--setuptools-version", - help="Use a specific setuptools version") -parser.add_option("--setuptools-to-dir", - help=("Allow for re-use of existing directory of " - "setuptools versions")) - -options, args = parser.parse_args() -if options.version: - print("bootstrap.py version %s" % __version__) - sys.exit(0) - - -###################################################################### -# load/install setuptools - -try: - from urllib.request import urlopen -except ImportError: - from urllib2 import urlopen - -ez = {} -if os.path.exists('ez_setup.py'): - exec(open('ez_setup.py').read(), ez) -else: - exec(urlopen('https://bootstrap.pypa.io/ez_setup.py').read(), ez) - -if not options.allow_site_packages: - # ez_setup imports site, which adds site packages - # this will remove them from the path to ensure that incompatible versions - # of setuptools are not in the path - import site - # inside a virtualenv, there is no 'getsitepackages'. - # We can't remove these reliably - if hasattr(site, 'getsitepackages'): - for sitepackage_path in site.getsitepackages(): - # Strip all site-packages directories from sys.path that - # are not sys.prefix; this is because on Windows - # sys.prefix is a site-package directory. - if sitepackage_path != sys.prefix: - sys.path[:] = [x for x in sys.path - if sitepackage_path not in x] - -setup_args = dict(to_dir=tmpeggs, download_delay=0) - -if options.setuptools_version is not None: - setup_args['version'] = options.setuptools_version -if options.setuptools_to_dir is not None: - setup_args['to_dir'] = options.setuptools_to_dir - -ez['use_setuptools'](**setup_args) -import setuptools -import pkg_resources - -# This does not (always?) update the default working set. We will -# do it. -for path in sys.path: - if path not in pkg_resources.working_set.entries: - pkg_resources.working_set.add_entry(path) - -###################################################################### -# Install buildout - -ws = pkg_resources.working_set - -setuptools_path = ws.find( - pkg_resources.Requirement.parse('setuptools')).location - -# Fix sys.path here as easy_install.pth added before PYTHONPATH -cmd = [sys.executable, '-c', - 'import sys; sys.path[0:0] = [%r]; ' % setuptools_path + - 'from setuptools.command.easy_install import main; main()', - '-mZqNxd', tmpeggs] - -find_links = os.environ.get( - 'bootstrap-testing-find-links', - options.find_links or - ('http://downloads.buildout.org/' - if options.accept_buildout_test_releases else None) - ) -if find_links: - cmd.extend(['-f', find_links]) - -requirement = 'zc.buildout' -version = options.buildout_version -if version is None and not options.accept_buildout_test_releases: - # Figure out the most recent final version of zc.buildout. - import setuptools.package_index - _final_parts = '*final-', '*final' - - def _final_version(parsed_version): - try: - return not parsed_version.is_prerelease - except AttributeError: - # Older setuptools - for part in parsed_version: - if (part[:1] == '*') and (part not in _final_parts): - return False - return True - - index = setuptools.package_index.PackageIndex( - search_path=[setuptools_path]) - if find_links: - index.add_find_links((find_links,)) - req = pkg_resources.Requirement.parse(requirement) - if index.obtain(req) is not None: - best = [] - bestv = None - for dist in index[req.project_name]: - distv = dist.parsed_version - if _final_version(distv): - if bestv is None or distv > bestv: - best = [dist] - bestv = distv - elif distv == bestv: - best.append(dist) - if best: - best.sort() - version = best[-1].version -if version: - requirement = '=='.join((requirement, version)) -cmd.append(requirement) - -import subprocess -if subprocess.call(cmd) != 0: - raise Exception( - "Failed to execute command:\n%s" % repr(cmd)[1:-1]) - -###################################################################### -# Import and run buildout - -ws.add_entry(tmpeggs) -ws.require(requirement) -import zc.buildout.buildout - -if not [a for a in args if '=' not in a]: - args.append('bootstrap') - -# if -c was provided, we push it back into args for buildout' main function -if options.config_file is not None: - args[0:0] = ['-c', options.config_file] - -zc.buildout.buildout.main(args) -shutil.rmtree(tmpeggs) diff --git a/setup.cfg b/setup.cfg index c64fc99..3b7424b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,38 +1,30 @@ +# Generated from: +# https://github.com/zopefoundation/meta/tree/master/config/zope-product [bdist_wheel] universal = 1 +[flake8] +doctests = 1 +no-accept-encodings = True +htmldir = parts/flake8 +exclude = + src/Products/DCWorkflow/doc/examples/* + +[check-manifest] +ignore = + .editorconfig + .meta.toml + docs/_build/html/_sources/* + docs/_build/html/_sources/narrative/* + docs/_build/html/_sources/api/* + [isort] force_single_line = True combine_as_imports = True sections = FUTURE,STDLIB,THIRDPARTY,ZOPE,FIRSTPARTY,LOCALFOLDER +known_third_party = six, docutils, pkg_resources +known_zope = known_first_party = Products.CMFCore -known_third_party = six, docutils -known_localfolder = Products.DCWorkflow default_section = ZOPE line_length = 79 lines_after_imports = 2 -not_skip = - __init__.py - -[flake8] -no-accept-encodings = True -doctests = True -exclude = - bootstrap.py - Products/DCWorkflow/doc/examples -htmldir = parts/flake8 - -[coverage:run] -branch = True -source = Products -omit = - -[coverage:report] -fail_under = 85.00 -ignore_errors = True -precision = 2 -show_missing = False -sort = Name - -[coverage:html] -directory = parts/coverage diff --git a/setup.py b/setup.py index 6e8efff..b7c0032 100644 --- a/setup.py +++ b/setup.py @@ -32,6 +32,7 @@ def _package_doc(name): 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', 'Topic :: Software Development', 'Topic :: Software Development :: Libraries :: Application Frameworks', ], @@ -45,7 +46,8 @@ def _package_doc(name): 'Sources': 'https://github.com/zopefoundation/Products.DCWorkflow', }, license='ZPL 2.1', - packages=find_packages(), + packages=find_packages('src'), + package_dir={'': 'src'}, include_package_data=True, namespace_packages=['Products'], zip_safe=False, diff --git a/Products/DCWorkflow/ContainerTab.py b/src/Products/DCWorkflow/ContainerTab.py similarity index 100% rename from Products/DCWorkflow/ContainerTab.py rename to src/Products/DCWorkflow/ContainerTab.py diff --git a/Products/DCWorkflow/DCWorkflow.py b/src/Products/DCWorkflow/DCWorkflow.py similarity index 96% rename from Products/DCWorkflow/DCWorkflow.py rename to src/Products/DCWorkflow/DCWorkflow.py index 9e49b76..28da140 100644 --- a/Products/DCWorkflow/DCWorkflow.py +++ b/src/Products/DCWorkflow/DCWorkflow.py @@ -31,17 +31,17 @@ from Products.CMFCore.WorkflowCore import ObjectMoved from Products.CMFCore.WorkflowCore import WorkflowException -from Products.DCWorkflow.events import AfterTransitionEvent -from Products.DCWorkflow.events import BeforeTransitionEvent -from Products.DCWorkflow.Expression import StateChangeInfo -from Products.DCWorkflow.Expression import createExprContext -from Products.DCWorkflow.interfaces import IDCWorkflowDefinition -from Products.DCWorkflow.Transitions import TRIGGER_AUTOMATIC -from Products.DCWorkflow.Transitions import TRIGGER_USER_ACTION -from Products.DCWorkflow.utils import Message as _ -from Products.DCWorkflow.utils import modifyRolesForGroup -from Products.DCWorkflow.utils import modifyRolesForPermission -from Products.DCWorkflow.WorkflowUIMixin import WorkflowUIMixin +from .events import AfterTransitionEvent +from .events import BeforeTransitionEvent +from .Expression import StateChangeInfo +from .Expression import createExprContext +from .interfaces import IDCWorkflowDefinition +from .Transitions import TRIGGER_AUTOMATIC +from .Transitions import TRIGGER_USER_ACTION +from .utils import Message as _ +from .utils import modifyRolesForGroup +from .utils import modifyRolesForPermission +from .WorkflowUIMixin import WorkflowUIMixin def checkId(id): diff --git a/Products/DCWorkflow/Expression.py b/src/Products/DCWorkflow/Expression.py similarity index 100% rename from Products/DCWorkflow/Expression.py rename to src/Products/DCWorkflow/Expression.py diff --git a/Products/DCWorkflow/Extensions/test_method.py b/src/Products/DCWorkflow/Extensions/test_method.py similarity index 100% rename from Products/DCWorkflow/Extensions/test_method.py rename to src/Products/DCWorkflow/Extensions/test_method.py diff --git a/Products/DCWorkflow/Guard.py b/src/Products/DCWorkflow/Guard.py similarity index 97% rename from Products/DCWorkflow/Guard.py rename to src/Products/DCWorkflow/Guard.py index 8a2e2ef..37d6fe9 100644 --- a/Products/DCWorkflow/Guard.py +++ b/src/Products/DCWorkflow/Guard.py @@ -24,9 +24,9 @@ from Products.CMFCore.permissions import ManagePortal from Products.CMFCore.utils import _checkPermission -from Products.DCWorkflow.Expression import StateChangeInfo -from Products.DCWorkflow.Expression import createExprContext -from Products.DCWorkflow.utils import _dtmldir +from .Expression import StateChangeInfo +from .Expression import createExprContext +from .utils import _dtmldir try: diff --git a/Products/DCWorkflow/Scripts.py b/src/Products/DCWorkflow/Scripts.py similarity index 95% rename from Products/DCWorkflow/Scripts.py rename to src/Products/DCWorkflow/Scripts.py index 5ce6f14..641fa98 100644 --- a/Products/DCWorkflow/Scripts.py +++ b/src/Products/DCWorkflow/Scripts.py @@ -19,7 +19,7 @@ from Products.CMFCore.permissions import ManagePortal -from Products.DCWorkflow.ContainerTab import ContainerTab +from .ContainerTab import ContainerTab class Scripts(ContainerTab): diff --git a/Products/DCWorkflow/States.py b/src/Products/DCWorkflow/States.py similarity index 98% rename from Products/DCWorkflow/States.py rename to src/Products/DCWorkflow/States.py index 1b87e3b..fe32378 100644 --- a/Products/DCWorkflow/States.py +++ b/src/Products/DCWorkflow/States.py @@ -25,8 +25,8 @@ from Products.CMFCore.permissions import ManagePortal -from Products.DCWorkflow.ContainerTab import ContainerTab -from Products.DCWorkflow.utils import _dtmldir +from .ContainerTab import ContainerTab +from .utils import _dtmldir class StateDefinition(SimpleItem): diff --git a/Products/DCWorkflow/Transitions.py b/src/Products/DCWorkflow/Transitions.py similarity index 98% rename from Products/DCWorkflow/Transitions.py rename to src/Products/DCWorkflow/Transitions.py index 21a64cd..a6e1e6f 100644 --- a/Products/DCWorkflow/Transitions.py +++ b/src/Products/DCWorkflow/Transitions.py @@ -24,9 +24,9 @@ from Products.CMFCore.Expression import Expression from Products.CMFCore.permissions import ManagePortal -from Products.DCWorkflow.ContainerTab import ContainerTab -from Products.DCWorkflow.Guard import Guard -from Products.DCWorkflow.utils import _dtmldir +from .ContainerTab import ContainerTab +from .Guard import Guard +from .utils import _dtmldir TRIGGER_AUTOMATIC = 0 diff --git a/Products/DCWorkflow/Variables.py b/src/Products/DCWorkflow/Variables.py similarity index 97% rename from Products/DCWorkflow/Variables.py rename to src/Products/DCWorkflow/Variables.py index f83b230..f6c46ee 100644 --- a/Products/DCWorkflow/Variables.py +++ b/src/Products/DCWorkflow/Variables.py @@ -24,9 +24,9 @@ from Products.CMFCore.Expression import Expression from Products.CMFCore.permissions import ManagePortal -from Products.DCWorkflow.ContainerTab import ContainerTab -from Products.DCWorkflow.Guard import Guard -from Products.DCWorkflow.utils import _dtmldir +from .ContainerTab import ContainerTab +from .Guard import Guard +from .utils import _dtmldir class VariableDefinition(SimpleItem): diff --git a/Products/DCWorkflow/WorkflowUIMixin.py b/src/Products/DCWorkflow/WorkflowUIMixin.py similarity index 98% rename from Products/DCWorkflow/WorkflowUIMixin.py rename to src/Products/DCWorkflow/WorkflowUIMixin.py index cc78fc2..a66c187 100644 --- a/Products/DCWorkflow/WorkflowUIMixin.py +++ b/src/Products/DCWorkflow/WorkflowUIMixin.py @@ -24,8 +24,8 @@ from Products.CMFCore.permissions import ManagePortal -from Products.DCWorkflow.Guard import Guard -from Products.DCWorkflow.utils import _dtmldir +from .Guard import Guard +from .utils import _dtmldir class WorkflowUIMixin(object): diff --git a/Products/DCWorkflow/Worklists.py b/src/Products/DCWorkflow/Worklists.py similarity index 95% rename from Products/DCWorkflow/Worklists.py rename to src/Products/DCWorkflow/Worklists.py index d28c264..66b23aa 100644 --- a/Products/DCWorkflow/Worklists.py +++ b/src/Products/DCWorkflow/Worklists.py @@ -27,12 +27,12 @@ from Products.CMFCore.interfaces import ICatalogTool from Products.CMFCore.permissions import ManagePortal -from Products.DCWorkflow.ContainerTab import ContainerTab -from Products.DCWorkflow.Expression import Expression -from Products.DCWorkflow.Expression import StateChangeInfo -from Products.DCWorkflow.Expression import createExprContext -from Products.DCWorkflow.Guard import Guard -from Products.DCWorkflow.utils import _dtmldir +from .ContainerTab import ContainerTab +from .Expression import Expression +from .Expression import StateChangeInfo +from .Expression import createExprContext +from .Guard import Guard +from .utils import _dtmldir tales_re = re.compile(r'(\w+:)?(.*)') diff --git a/Products/DCWorkflow/__init__.py b/src/Products/DCWorkflow/__init__.py similarity index 100% rename from Products/DCWorkflow/__init__.py rename to src/Products/DCWorkflow/__init__.py index 3562a19..575a5f3 100644 --- a/Products/DCWorkflow/__init__.py +++ b/src/Products/DCWorkflow/__init__.py @@ -19,11 +19,11 @@ def initialize(context): from Products.CMFCore.utils import registerIcon from . import DCWorkflow + from . import Scripts from . import States from . import Transitions from . import Variables from . import Worklists - from . import Scripts registerIcon(DCWorkflow.DCWorkflowDefinition, 'images/workflow.gif', globals()) diff --git a/Products/DCWorkflow/browser/__init__.py b/src/Products/DCWorkflow/browser/__init__.py similarity index 100% rename from Products/DCWorkflow/browser/__init__.py rename to src/Products/DCWorkflow/browser/__init__.py diff --git a/Products/DCWorkflow/browser/configure.zcml b/src/Products/DCWorkflow/browser/configure.zcml similarity index 100% rename from Products/DCWorkflow/browser/configure.zcml rename to src/Products/DCWorkflow/browser/configure.zcml diff --git a/Products/DCWorkflow/browser/workflow.py b/src/Products/DCWorkflow/browser/workflow.py similarity index 97% rename from Products/DCWorkflow/browser/workflow.py rename to src/Products/DCWorkflow/browser/workflow.py index 919868e..d83a37a 100644 --- a/Products/DCWorkflow/browser/workflow.py +++ b/src/Products/DCWorkflow/browser/workflow.py @@ -21,7 +21,7 @@ from zope.component import queryMultiAdapter from zope.component import queryUtility -from Products.DCWorkflow.DCWorkflow import DCWorkflowDefinition +from ..DCWorkflow import DCWorkflowDefinition class DCWorkflowDefinitionAddView(AddWithPresettingsViewBase): diff --git a/Products/DCWorkflow/configure.zcml b/src/Products/DCWorkflow/configure.zcml similarity index 100% rename from Products/DCWorkflow/configure.zcml rename to src/Products/DCWorkflow/configure.zcml diff --git a/Products/DCWorkflow/doc/examples/staging/checkin.py b/src/Products/DCWorkflow/doc/examples/staging/checkin.py similarity index 100% rename from Products/DCWorkflow/doc/examples/staging/checkin.py rename to src/Products/DCWorkflow/doc/examples/staging/checkin.py diff --git a/Products/DCWorkflow/doc/examples/staging/checkout.py b/src/Products/DCWorkflow/doc/examples/staging/checkout.py similarity index 100% rename from Products/DCWorkflow/doc/examples/staging/checkout.py rename to src/Products/DCWorkflow/doc/examples/staging/checkout.py diff --git a/Products/DCWorkflow/doc/examples/staging/retractStages.py b/src/Products/DCWorkflow/doc/examples/staging/retractStages.py similarity index 100% rename from Products/DCWorkflow/doc/examples/staging/retractStages.py rename to src/Products/DCWorkflow/doc/examples/staging/retractStages.py diff --git a/Products/DCWorkflow/doc/examples/staging/updateProductionStage.py b/src/Products/DCWorkflow/doc/examples/staging/updateProductionStage.py similarity index 100% rename from Products/DCWorkflow/doc/examples/staging/updateProductionStage.py rename to src/Products/DCWorkflow/doc/examples/staging/updateProductionStage.py diff --git a/Products/DCWorkflow/doc/examples/staging/updateReviewStage.py b/src/Products/DCWorkflow/doc/examples/staging/updateReviewStage.py similarity index 100% rename from Products/DCWorkflow/doc/examples/staging/updateReviewStage.py rename to src/Products/DCWorkflow/doc/examples/staging/updateReviewStage.py diff --git a/Products/DCWorkflow/dtml/guard.dtml b/src/Products/DCWorkflow/dtml/guard.dtml similarity index 100% rename from Products/DCWorkflow/dtml/guard.dtml rename to src/Products/DCWorkflow/dtml/guard.dtml diff --git a/Products/DCWorkflow/dtml/state_groups.pt b/src/Products/DCWorkflow/dtml/state_groups.pt similarity index 100% rename from Products/DCWorkflow/dtml/state_groups.pt rename to src/Products/DCWorkflow/dtml/state_groups.pt diff --git a/Products/DCWorkflow/dtml/state_permissions.dtml b/src/Products/DCWorkflow/dtml/state_permissions.dtml similarity index 100% rename from Products/DCWorkflow/dtml/state_permissions.dtml rename to src/Products/DCWorkflow/dtml/state_permissions.dtml diff --git a/Products/DCWorkflow/dtml/state_properties.dtml b/src/Products/DCWorkflow/dtml/state_properties.dtml similarity index 100% rename from Products/DCWorkflow/dtml/state_properties.dtml rename to src/Products/DCWorkflow/dtml/state_properties.dtml diff --git a/Products/DCWorkflow/dtml/state_variables.dtml b/src/Products/DCWorkflow/dtml/state_variables.dtml similarity index 100% rename from Products/DCWorkflow/dtml/state_variables.dtml rename to src/Products/DCWorkflow/dtml/state_variables.dtml diff --git a/Products/DCWorkflow/dtml/states.dtml b/src/Products/DCWorkflow/dtml/states.dtml similarity index 100% rename from Products/DCWorkflow/dtml/states.dtml rename to src/Products/DCWorkflow/dtml/states.dtml diff --git a/Products/DCWorkflow/dtml/transition_properties.dtml b/src/Products/DCWorkflow/dtml/transition_properties.dtml similarity index 100% rename from Products/DCWorkflow/dtml/transition_properties.dtml rename to src/Products/DCWorkflow/dtml/transition_properties.dtml diff --git a/Products/DCWorkflow/dtml/transition_variables.dtml b/src/Products/DCWorkflow/dtml/transition_variables.dtml similarity index 100% rename from Products/DCWorkflow/dtml/transition_variables.dtml rename to src/Products/DCWorkflow/dtml/transition_variables.dtml diff --git a/Products/DCWorkflow/dtml/transitions.dtml b/src/Products/DCWorkflow/dtml/transitions.dtml similarity index 100% rename from Products/DCWorkflow/dtml/transitions.dtml rename to src/Products/DCWorkflow/dtml/transitions.dtml diff --git a/Products/DCWorkflow/dtml/variable_properties.dtml b/src/Products/DCWorkflow/dtml/variable_properties.dtml similarity index 100% rename from Products/DCWorkflow/dtml/variable_properties.dtml rename to src/Products/DCWorkflow/dtml/variable_properties.dtml diff --git a/Products/DCWorkflow/dtml/variables.dtml b/src/Products/DCWorkflow/dtml/variables.dtml similarity index 100% rename from Products/DCWorkflow/dtml/variables.dtml rename to src/Products/DCWorkflow/dtml/variables.dtml diff --git a/Products/DCWorkflow/dtml/workflow_groups.pt b/src/Products/DCWorkflow/dtml/workflow_groups.pt similarity index 100% rename from Products/DCWorkflow/dtml/workflow_groups.pt rename to src/Products/DCWorkflow/dtml/workflow_groups.pt diff --git a/Products/DCWorkflow/dtml/workflow_permissions.dtml b/src/Products/DCWorkflow/dtml/workflow_permissions.dtml similarity index 100% rename from Products/DCWorkflow/dtml/workflow_permissions.dtml rename to src/Products/DCWorkflow/dtml/workflow_permissions.dtml diff --git a/Products/DCWorkflow/dtml/workflow_properties.dtml b/src/Products/DCWorkflow/dtml/workflow_properties.dtml similarity index 100% rename from Products/DCWorkflow/dtml/workflow_properties.dtml rename to src/Products/DCWorkflow/dtml/workflow_properties.dtml diff --git a/Products/DCWorkflow/dtml/worklist_properties.dtml b/src/Products/DCWorkflow/dtml/worklist_properties.dtml similarity index 100% rename from Products/DCWorkflow/dtml/worklist_properties.dtml rename to src/Products/DCWorkflow/dtml/worklist_properties.dtml diff --git a/Products/DCWorkflow/dtml/worklists.dtml b/src/Products/DCWorkflow/dtml/worklists.dtml similarity index 100% rename from Products/DCWorkflow/dtml/worklists.dtml rename to src/Products/DCWorkflow/dtml/worklists.dtml diff --git a/Products/DCWorkflow/events.py b/src/Products/DCWorkflow/events.py similarity index 78% rename from Products/DCWorkflow/events.py rename to src/Products/DCWorkflow/events.py index 2d0f05d..75ca7e8 100644 --- a/Products/DCWorkflow/events.py +++ b/src/Products/DCWorkflow/events.py @@ -1,9 +1,9 @@ from zope.interface import implementer from zope.interface.interfaces import ObjectEvent -from Products.DCWorkflow.interfaces import IAfterTransitionEvent -from Products.DCWorkflow.interfaces import IBeforeTransitionEvent -from Products.DCWorkflow.interfaces import ITransitionEvent +from .interfaces import IAfterTransitionEvent +from .interfaces import IBeforeTransitionEvent +from .interfaces import ITransitionEvent @implementer(ITransitionEvent) diff --git a/Products/DCWorkflow/exportimport.py b/src/Products/DCWorkflow/exportimport.py similarity index 98% rename from Products/DCWorkflow/exportimport.py rename to src/Products/DCWorkflow/exportimport.py index ae5963c..a894722 100644 --- a/Products/DCWorkflow/exportimport.py +++ b/src/Products/DCWorkflow/exportimport.py @@ -34,10 +34,10 @@ from Products.CMFCore.Expression import Expression from Products.CMFCore.permissions import ManagePortal -from Products.DCWorkflow.DCWorkflow import DCWorkflowDefinition -from Products.DCWorkflow.Guard import Guard -from Products.DCWorkflow.interfaces import IDCWorkflowDefinition -from Products.DCWorkflow.utils import _xmldir +from .DCWorkflow import DCWorkflowDefinition +from .Guard import Guard +from .interfaces import IDCWorkflowDefinition +from .utils import _xmldir TRIGGER_TYPES = ('AUTOMATIC', 'USER') @@ -1019,7 +1019,7 @@ def _initDCWorkflowCreationGuard(workflow, guard): def _initDCWorkflowVariables(workflow, variables): """ Initialize DCWorkflow variables """ - from Products.DCWorkflow.Variables import VariableDefinition + from .Variables import VariableDefinition for v_info in variables: if six.PY2: @@ -1053,7 +1053,7 @@ def _initDCWorkflowVariables(workflow, variables): def _initDCWorkflowStates(workflow, states): """ Initialize DCWorkflow states """ - from Products.DCWorkflow.States import StateDefinition + from .States import StateDefinition for s_info in states: if six.PY2: @@ -1088,7 +1088,7 @@ def _initDCWorkflowStates(workflow, states): def _initDCWorkflowTransitions(workflow, transitions): """ Initialize DCWorkflow transitions """ - from Products.DCWorkflow.Transitions import TransitionDefinition + from .Transitions import TransitionDefinition for t_info in transitions: @@ -1127,7 +1127,7 @@ def _initDCWorkflowTransitions(workflow, transitions): def _initDCWorkflowWorklists(workflow, worklists): """ Initialize DCWorkflow worklists """ - from Products.DCWorkflow.Worklists import WorklistDefinition + from .Worklists import WorklistDefinition for w_info in worklists: diff --git a/Products/DCWorkflow/exportimport.zcml b/src/Products/DCWorkflow/exportimport.zcml similarity index 100% rename from Products/DCWorkflow/exportimport.zcml rename to src/Products/DCWorkflow/exportimport.zcml diff --git a/Products/DCWorkflow/images/script.gif b/src/Products/DCWorkflow/images/script.gif similarity index 100% rename from Products/DCWorkflow/images/script.gif rename to src/Products/DCWorkflow/images/script.gif diff --git a/Products/DCWorkflow/images/state.gif b/src/Products/DCWorkflow/images/state.gif similarity index 100% rename from Products/DCWorkflow/images/state.gif rename to src/Products/DCWorkflow/images/state.gif diff --git a/Products/DCWorkflow/images/transition.gif b/src/Products/DCWorkflow/images/transition.gif similarity index 100% rename from Products/DCWorkflow/images/transition.gif rename to src/Products/DCWorkflow/images/transition.gif diff --git a/Products/DCWorkflow/images/variable.gif b/src/Products/DCWorkflow/images/variable.gif similarity index 100% rename from Products/DCWorkflow/images/variable.gif rename to src/Products/DCWorkflow/images/variable.gif diff --git a/Products/DCWorkflow/images/workflow.gif b/src/Products/DCWorkflow/images/workflow.gif similarity index 100% rename from Products/DCWorkflow/images/workflow.gif rename to src/Products/DCWorkflow/images/workflow.gif diff --git a/Products/DCWorkflow/images/worklist.gif b/src/Products/DCWorkflow/images/worklist.gif similarity index 100% rename from Products/DCWorkflow/images/worklist.gif rename to src/Products/DCWorkflow/images/worklist.gif diff --git a/Products/DCWorkflow/interfaces.py b/src/Products/DCWorkflow/interfaces.py similarity index 100% rename from Products/DCWorkflow/interfaces.py rename to src/Products/DCWorkflow/interfaces.py diff --git a/Products/DCWorkflow/permissions.py b/src/Products/DCWorkflow/permissions.py similarity index 100% rename from Products/DCWorkflow/permissions.py rename to src/Products/DCWorkflow/permissions.py diff --git a/Products/DCWorkflow/profiles/revision2/workflows.xml b/src/Products/DCWorkflow/profiles/revision2/workflows.xml similarity index 100% rename from Products/DCWorkflow/profiles/revision2/workflows.xml rename to src/Products/DCWorkflow/profiles/revision2/workflows.xml diff --git a/Products/DCWorkflow/profiles/revision2/workflows/default_workflow/definition.xml b/src/Products/DCWorkflow/profiles/revision2/workflows/default_workflow/definition.xml similarity index 100% rename from Products/DCWorkflow/profiles/revision2/workflows/default_workflow/definition.xml rename to src/Products/DCWorkflow/profiles/revision2/workflows/default_workflow/definition.xml diff --git a/Products/DCWorkflow/testing.py b/src/Products/DCWorkflow/testing.py similarity index 99% rename from Products/DCWorkflow/testing.py rename to src/Products/DCWorkflow/testing.py index d2c91ab..9f51d7e 100644 --- a/Products/DCWorkflow/testing.py +++ b/src/Products/DCWorkflow/testing.py @@ -26,6 +26,7 @@ class ExportImportZCMLLayer(ZopeLite): def setUp(cls): import Products.Five import Products.GenericSetup + import Products.CMFCore import Products.CMFCore.exportimport import Products.DCWorkflow diff --git a/Products/DCWorkflow/tests/__init__.py b/src/Products/DCWorkflow/tests/__init__.py similarity index 100% rename from Products/DCWorkflow/tests/__init__.py rename to src/Products/DCWorkflow/tests/__init__.py diff --git a/Products/DCWorkflow/tests/test_DCWorkflow.py b/src/Products/DCWorkflow/tests/test_DCWorkflow.py similarity index 96% rename from Products/DCWorkflow/tests/test_DCWorkflow.py rename to src/Products/DCWorkflow/tests/test_DCWorkflow.py index c31ef84..98ed052 100644 --- a/Products/DCWorkflow/tests/test_DCWorkflow.py +++ b/src/Products/DCWorkflow/tests/test_DCWorkflow.py @@ -32,8 +32,8 @@ from Products.CMFCore.tests.base.testcase import SecurityTest from Products.CMFCore.WorkflowTool import WorkflowTool -from Products.DCWorkflow.interfaces import IAfterTransitionEvent -from Products.DCWorkflow.interfaces import IBeforeTransitionEvent +from ..interfaces import IAfterTransitionEvent +from ..interfaces import IBeforeTransitionEvent class DCWorkflowDefinitionTests(SecurityTest): @@ -54,12 +54,13 @@ def setUp(self): def test_interfaces(self): from Products.CMFCore.interfaces import IWorkflowDefinition - from Products.DCWorkflow.DCWorkflow import DCWorkflowDefinition + + from ..DCWorkflow import DCWorkflowDefinition verifyClass(IWorkflowDefinition, DCWorkflowDefinition) def _constructDummyWorkflow(self): - from Products.DCWorkflow.DCWorkflow import DCWorkflowDefinition + from ..DCWorkflow import DCWorkflowDefinition wtool = self.wtool wtool._setObject('wf', DCWorkflowDefinition('wf')) diff --git a/Products/DCWorkflow/tests/test_exportimport.py b/src/Products/DCWorkflow/tests/test_exportimport.py similarity index 99% rename from Products/DCWorkflow/tests/test_exportimport.py rename to src/Products/DCWorkflow/tests/test_exportimport.py index 0ce4915..71b8c8b 100644 --- a/Products/DCWorkflow/tests/test_exportimport.py +++ b/src/Products/DCWorkflow/tests/test_exportimport.py @@ -30,11 +30,11 @@ _WorkflowSetup as WorkflowSetupBase from Products.CMFCore.testing import DummyWorkflow -from Products.DCWorkflow.DCWorkflow import DCWorkflowDefinition -from Products.DCWorkflow.Guard import Guard -from Products.DCWorkflow.testing import ExportImportZCMLLayer -from Products.DCWorkflow.Transitions import TRIGGER_AUTOMATIC -from Products.DCWorkflow.Transitions import TRIGGER_USER_ACTION +from ..DCWorkflow import DCWorkflowDefinition +from ..Guard import Guard +from ..testing import ExportImportZCMLLayer +from ..Transitions import TRIGGER_AUTOMATIC +from ..Transitions import TRIGGER_USER_ACTION class _GuardChecker: @@ -186,8 +186,7 @@ class WorkflowDefinitionConfiguratorTests(_WorkflowSetup, _GuardChecker): layer = ExportImportZCMLLayer def _getTargetClass(self): - from Products.DCWorkflow.exportimport \ - import WorkflowDefinitionConfigurator + from ..exportimport import WorkflowDefinitionConfigurator return WorkflowDefinitionConfigurator @@ -332,7 +331,7 @@ def test_getWorkflowInfo_dcworkflow_states(self): self.assertEqual(type, 'string') def test_getWorkflowInfo_dcworkflow_transitions(self): - from Products.DCWorkflow.exportimport import TRIGGER_TYPES + from ..exportimport import TRIGGER_TYPES WF_ID = 'dcworkflow_transitions' @@ -746,7 +745,7 @@ def test_parseWorkflowXML_state_w_missing_acquired(self): self.assertEqual(tuple(state['groups']), tuple(expected[4])) def test_parseWorkflowXML_normal_transitions(self): - from Products.DCWorkflow.exportimport import TRIGGER_TYPES + from ..exportimport import TRIGGER_TYPES WF_ID = 'normal' WF_TITLE = 'Normal DCWorkflow' @@ -3107,7 +3106,7 @@ def test_scripts_with_invalid_meta_type(self): Otherwise the previous script will be added for that script. """ - from Products.DCWorkflow import exportimport + from .. import exportimport tool = self._importNormalWorkflow( 'dcworkflow_scripts', 'DC Workflow testing scripts', @@ -3126,7 +3125,7 @@ def test_scripts_by_meta_type(self): Constructors for meta_types other than those hard coded should be looked up. """ - from Products.DCWorkflow import exportimport + from .. import exportimport tool = self._importNormalWorkflow( 'dcworkflow_scripts', 'DC Workflow testing scripts', diff --git a/Products/DCWorkflow/tests/test_guard.py b/src/Products/DCWorkflow/tests/test_guard.py similarity index 98% rename from Products/DCWorkflow/tests/test_guard.py rename to src/Products/DCWorkflow/tests/test_guard.py index 4ccb2ca..4af4e02 100644 --- a/Products/DCWorkflow/tests/test_guard.py +++ b/src/Products/DCWorkflow/tests/test_guard.py @@ -26,8 +26,8 @@ from Products.CMFCore.tests.base.dummy import DummyTool from Products.CMFCore.WorkflowTool import WorkflowTool -from Products.DCWorkflow.DCWorkflow import DCWorkflowDefinition -from Products.DCWorkflow.Guard import Guard +from ..DCWorkflow import DCWorkflowDefinition +from ..Guard import Guard class TestGuard(unittest.TestCase): diff --git a/Products/DCWorkflow/tests/test_roles.py b/src/Products/DCWorkflow/tests/test_roles.py similarity index 95% rename from Products/DCWorkflow/tests/test_roles.py rename to src/Products/DCWorkflow/tests/test_roles.py index ae5f711..f906841 100644 --- a/Products/DCWorkflow/tests/test_roles.py +++ b/src/Products/DCWorkflow/tests/test_roles.py @@ -18,8 +18,8 @@ from OFS.Application import Application from OFS.Folder import Folder -from Products.DCWorkflow.utils import modifyRolesForGroup -from Products.DCWorkflow.utils import modifyRolesForPermission +from ..utils import modifyRolesForGroup +from ..utils import modifyRolesForPermission class RoleMapTests(unittest.TestCase): diff --git a/Products/DCWorkflow/tool.zcml b/src/Products/DCWorkflow/tool.zcml similarity index 100% rename from Products/DCWorkflow/tool.zcml rename to src/Products/DCWorkflow/tool.zcml diff --git a/Products/DCWorkflow/utils.py b/src/Products/DCWorkflow/utils.py similarity index 100% rename from Products/DCWorkflow/utils.py rename to src/Products/DCWorkflow/utils.py diff --git a/Products/DCWorkflow/xml/wtcWorkflowExport.xml b/src/Products/DCWorkflow/xml/wtcWorkflowExport.xml similarity index 100% rename from Products/DCWorkflow/xml/wtcWorkflowExport.xml rename to src/Products/DCWorkflow/xml/wtcWorkflowExport.xml diff --git a/Products/__init__.py b/src/Products/__init__.py similarity index 100% rename from Products/__init__.py rename to src/Products/__init__.py diff --git a/tox.ini b/tox.ini index 96c250e..19b75b2 100644 --- a/tox.ini +++ b/tox.ini @@ -1,12 +1,17 @@ +# Generated from: +# https://github.com/zopefoundation/meta/tree/master/config/zope-product [tox] +minversion = 3.18 envlist = - py27, - py35, - py36, - py37, - py38, - flake8, - coverage, + lint + py27 + py35 + py36 + py37 + py38 + py39 + docs + coverage [testenv] skip_install = true @@ -14,47 +19,84 @@ skip_install = true deps = setuptools < 52 zc.buildout - coverage commands_pre = py27,py35: {envbindir}/buildout -nc {toxinidir}/buildout4.cfg buildout:directory={envdir} buildout:develop={toxinidir} install test !py27-!py35: {envbindir}/buildout -nc {toxinidir}/buildout.cfg buildout:directory={envdir} buildout:develop={toxinidir} install test commands = - coverage run {envbindir}/test {posargs:-cv} -setenv = - COVERAGE_FILE=.coverage.{envname} + {envbindir}/test {posargs:-cv} -[testenv:coverage] -basepython = python3.6 -depends = - py27, - py35, - py36, - py37, - py38, -deps = - {[testenv]deps} -setenv = - COVERAGE_FILE={toxinidir}/.coverage -commands_pre = -commands = - - coverage erase - - coverage combine - - coverage html - - coverage xml - coverage report --fail-under=75 - -[testenv:flake8] -basepython = python3.6 +[testenv:lint] +basepython = python3 +allowlist_externals = + mkdir commands_pre = mkdir -p {toxinidir}/parts/flake8 +commands = + isort --check-only --diff {toxinidir}/src {toxinidir}/setup.py + - flake8 --format=html {toxinidir}/src {toxinidir}/setup.py + flake8 {toxinidir}/src {toxinidir}/setup.py + check-manifest + check-python-versions deps = - isort + check-manifest + check-python-versions flake8 + isort + # helper to generate HTML reports: flake8-html + # Useful flake8 plugins that are Python and Plone specific: + flake8-coding flake8-debugger + mccabe + +[testenv:isort-apply] +basepython = python3 +commands_pre = +deps = + isort commands = - - isort --check-only --diff --recursive {toxinidir}/Products setup.py - - flake8 --format=html --htmldir={toxinidir}/parts/flake8 --doctests Products setup.py {posargs} - flake8 --doctests Products setup.py {posargs} -whitelist_externals = + isort {toxinidir}/src {toxinidir}/setup.py [] + +[testenv:docs] +basepython = python3 +skip_install = false +deps = +extras = + docs +commands_pre = +commands = + sphinx-build -b html -d docs/_build/doctrees docs docs/_build/html + +[testenv:coverage] +basepython = python3 +skip_install = true +allowlist_externals = mkdir +deps = + {[testenv]deps} + coverage + coverage-python-version +commands = + mkdir -p {toxinidir}/parts/htmlcov + coverage run {envbindir}/test {posargs:-cv} + coverage html + coverage report -m --fail-under=76 + +[coverage:run] +branch = True +plugins = coverage_python_version +source = src + +[coverage:report] +precision = 2 +exclude_lines = + pragma: no cover + pragma: nocover + except ImportError: + raise NotImplementedError + if __name__ == '__main__': + self.fail + raise AssertionError + +[coverage:html] +directory = parts/htmlcov