Skip to content

Commit

Permalink
- Drop support for Python 2.7, 3.5, 3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
dataflake committed Jan 31, 2023
1 parent 6e26498 commit 34de8bb
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 47 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ jobs:
config:
# [Python version, tox env]
- ["3.9", "lint"]
- ["2.7", "py27"]
- ["3.5", "py35"]
- ["3.6", "py36"]
- ["3.7", "py37"]
- ["3.8", "py38"]
- ["3.9", "py39"]
Expand Down Expand Up @@ -57,7 +54,7 @@ jobs:
- name: Coverage
if: matrix.config[1] == 'coverage'
run: |
pip install coveralls coverage-python-version
pip install coveralls
coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 1 addition & 3 deletions .meta.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
# https://github.com/zopefoundation/meta/tree/master/config/zope-product
[meta]
template = "zope-product"
commit-id = "d6240444ec6c9e203f2fd9f62c3e6038f9189e96"
commit-id = "e5c611fb"

[python]
with-pypy = false
with-legacy-python = true
with-sphinx-doctests = false
with-windows = false
with-future-python = false
Expand All @@ -20,7 +19,6 @@ fail-under = 90

[manifest]
additional-rules = [
"include buildout4.cfg",
"recursive-include src *.gif",
"recursive-include src *.png",
"recursive-include src *.xml",
Expand Down
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ include buildout.cfg
include tox.ini

recursive-include src *.py
include buildout4.cfg
recursive-include src *.gif
recursive-include src *.png
recursive-include src *.xml
Expand Down
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/zope-product
[bdist_wheel]
universal = 1
universal = 0

[flake8]
doctests = 1
Expand All @@ -17,7 +17,7 @@ ignore =
force_single_line = True
combine_as_imports = True
sections = FUTURE,STDLIB,THIRDPARTY,ZOPE,FIRSTPARTY,LOCALFOLDER
known_third_party = six, docutils, pkg_resources
known_third_party = six, docutils, pkg_resources, pytz
known_zope =
known_first_party =
default_section = ZOPE
Expand Down
9 changes: 2 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,10 @@
'Framework :: Plone :: 5.2',
'Framework :: Plone :: Core',
'Framework :: Zope',
'Framework :: Zope :: 4',
'Framework :: Zope :: 5',
'Intended Audience :: Developers',
'License :: OSI Approved :: Zope Public License',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'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',
Expand All @@ -41,7 +37,7 @@
],
keywords='web application server zope zope2',
author='Zope Foundation and Contributors',
author_email='zope-cmf@lists.zope.org',
author_email='zope-dev@zope.dev',
url='https://github.com/zopefoundation/Products.PluginRegistry',
project_urls={
'Issue Tracker': ('https://github.com/zopefoundation/Products.'
Expand All @@ -54,10 +50,9 @@
include_package_data=True,
namespace_packages=['Products'],
zip_safe=False,
python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*',
python_requires='>=3.7',
install_requires=[
'setuptools',
'six',
'Zope >= 4.0b4',
'Products.GenericSetup >= 2.0b1',
],
Expand Down
15 changes: 5 additions & 10 deletions src/Products/PluginRegistry/PluginRegistry.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
import logging
import os

import six

from AccessControl import ClassSecurityInfo
from AccessControl.class_init import default__class_init__ as InitializeClass
from AccessControl.Permissions import manage_users as ManageUsers
Expand Down Expand Up @@ -65,7 +63,7 @@ class PluginRegistry(SimpleItem):

def __init__(self, plugin_type_info=()):

if isinstance(plugin_type_info, six.string_types):
if isinstance(plugin_type_info, str):
# some tool is passing us our ID.
raise ValueError('Must pass a sequence of plugin info dicts!')

Expand Down Expand Up @@ -141,14 +139,14 @@ def activatePlugin(self, plugin_type, plugin_id):
plugins = list(self._getPlugins(plugin_type))

if plugin_id in plugins:
raise KeyError('Duplicate plugin id: {0}'.format(plugin_id))
raise KeyError(f'Duplicate plugin id: {plugin_id}')

parent = aq_parent(aq_inner(self))
plugin = parent._getOb(plugin_id)

if not _satisfies(plugin, plugin_type):
raise ValueError(
'Plugin does not implement {0}'.format(plugin_type))
f'Plugin does not implement {plugin_type}')

plugins.append(plugin_id)
self._plugins[plugin_type] = tuple(plugins)
Expand All @@ -161,7 +159,7 @@ def deactivatePlugin(self, plugin_type, plugin_id):
plugins = list(self._getPlugins(plugin_type))

if plugin_id not in plugins:
raise KeyError('Invalid plugin id: {0}'.format(plugin_id))
raise KeyError(f'Invalid plugin id: {plugin_id}')

plugins = [x for x in plugins if x != plugin_id]
self._plugins[plugin_type] = tuple(plugins)
Expand Down Expand Up @@ -386,7 +384,7 @@ def _getInterfaceFromName(self, plugin_type_name):
raise KeyError(plugin_type_name)

if len(found) > 1:
raise KeyError('Waaa!: {0}'.format(plugin_type_name))
raise KeyError(f'Waaa!: {plugin_type_name}')

return found[0]

Expand All @@ -396,9 +394,6 @@ def _getInterfaceFromName(self, plugin_type_name):

def _satisfies(plugin, iface):
checker = getattr(iface, 'providedBy', None)
if checker is None: # BBB for Zope 2.7?
checker = iface.isImplementedBy

return checker(plugin)


Expand Down
2 changes: 1 addition & 1 deletion src/Products/PluginRegistry/exportimport.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def _getImportMapping(self):


@implementer(IFilesystemExporter, IFilesystemImporter)
class PluginRegistryFileExportImportAdapter(object):
class PluginRegistryFileExportImportAdapter:
""" Designed for ues when exporting / importing PR's within a container.
"""

Expand Down
2 changes: 1 addition & 1 deletion src/Products/PluginRegistry/tests/test_PluginRegistry.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,5 +443,5 @@ def test_removePluginById(self):

def test_suite():
return unittest.TestSuite((
unittest.makeSuite(PluginRegistryTests),
unittest.defaultTestLoader.loadTestsFromTestCase(PluginRegistryTests),
))
21 changes: 11 additions & 10 deletions src/Products/PluginRegistry/tests/test_exportimport.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,38 +56,38 @@ class IBar(Interface):
<plugin-registry>
<plugin-type
id="IFoo"
interface="%s"
interface="{}"
title="foo"
description="Some plugin interface">
</plugin-type>
<plugin-type
id="IBar"
interface="%s"
interface="{}"
title="bar"
description="Another plugin interface">
</plugin-type>
</plugin-registry>
""" % (_getDottedName(IFoo), _getDottedName(IBar))
""".format(_getDottedName(IFoo), _getDottedName(IBar))

_NORMAL_PLUGINREGISTRY_EXPORT = """\
<?xml version="1.0"?>
<plugin-registry>
<plugin-type
id="IFoo"
interface="%s"
interface="{}"
title="foo"
description="Some plugin interface">
<plugin id="foo_plugin_1" />
<plugin id="foo_plugin_2" />
</plugin-type>
<plugin-type
id="IBar"
interface="%s"
interface="{}"
title="bar"
description="Another plugin interface">
</plugin-type>
</plugin-registry>
""" % (_getDottedName(IFoo), _getDottedName(IBar))
""".format(_getDottedName(IFoo), _getDottedName(IBar))

class _TestBase(PlacelessSetup, BaseRegistryTests):

Expand Down Expand Up @@ -443,11 +443,12 @@ def traverse(self, name, furtherPath):
return result

def test_suite():
loader = unittest.defaultTestLoader
return unittest.TestSuite((
unittest.makeSuite(PluginRegistryExporterTests),
unittest.makeSuite(PluginRegistryImporterTests),
unittest.makeSuite(Test_exportPluginRegistry),
unittest.makeSuite(Test_importPluginRegistry)))
loader.loadTestsFromTestCase(PluginRegistryExporterTests),
loader.loadTestsFromTestCase(PluginRegistryImporterTests),
loader.loadTestsFromTestCase(Test_exportPluginRegistry),
loader.loadTestsFromTestCase(Test_importPluginRegistry)))

if __name__ == '__main__':
unittest.main(defaultTest='test_suite')
9 changes: 1 addition & 8 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
minversion = 3.18
envlist =
lint
py27
py35
py36
py37
py38
py39
Expand All @@ -20,8 +17,7 @@ deps =
zc.buildout >= 3.0.1
wheel > 0.37
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
{envbindir}/buildout -nc {toxinidir}/buildout.cfg buildout:directory={envdir} buildout:develop={toxinidir} install test
commands =
{envdir}/bin/test {posargs:-cv}

Expand All @@ -33,7 +29,6 @@ allowlist_externals =
mkdir
commands =
isort --check-only --diff {toxinidir}/src {toxinidir}/setup.py
- flake8 {toxinidir}/src {toxinidir}/setup.py
flake8 {toxinidir}/src {toxinidir}/setup.py
check-manifest
check-python-versions
Expand Down Expand Up @@ -63,7 +58,6 @@ allowlist_externals =
deps =
{[testenv]deps}
coverage
coverage-python-version
commands =
mkdir -p {toxinidir}/parts/htmlcov
coverage run {envdir}/bin/test {posargs:-cv}
Expand All @@ -72,7 +66,6 @@ commands =

[coverage:run]
branch = True
plugins = coverage_python_version
source = Products.PluginRegistry

[coverage:report]
Expand Down

0 comments on commit 34de8bb

Please sign in to comment.