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 803b621 commit 4f88166
Show file tree
Hide file tree
Showing 44 changed files with 470 additions and 595 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 @@ known_first_party = "Products.PluginIndexes, Products.ZCTextIndex, Products.ZCat

[manifest]
additional-rules = [
"include buildout4.cfg",
"recursive-include docs *.py",
"recursive-include docs *.rst",
"recursive-include docs Makefile",
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 docs *.py
recursive-include docs *.rst
recursive-include docs Makefile
Expand Down
7 changes: 0 additions & 7 deletions buildout4.cfg

This file was deleted.

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 = Products.PluginIndexes, Products.ZCTextIndex, Products.ZCatalog
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 @@ -29,14 +29,10 @@
"Development Status :: 5 - Production/Stable",
"Framework :: Plone :: 5.2",
"Framework :: Plone :: 6.0",
"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 @@ -49,7 +45,7 @@
],
keywords='web application server zope zope4 cmf',
author="Zope Foundation and Contributors",
author_email="zope-cmf@zope.org",
author_email="zope-dev@zope.dev",
url=URL,
project_urls={
'Documentation': 'https://productsgenericsetup.readthedocs.io',
Expand All @@ -62,10 +58,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',
'five.localsitemanager',
'Products.PythonScripts',
Expand Down
3 changes: 2 additions & 1 deletion src/Products/GenericSetup/OFSP/tests/test_exportimport.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,6 @@ def test_body_set_without_encoding(self):

def test_suite():
return unittest.TestSuite((
unittest.makeSuite(FolderXMLAdapterTests),
unittest.defaultTestLoader.loadTestsFromTestCase(
FolderXMLAdapterTests),
))
4 changes: 1 addition & 3 deletions src/Products/GenericSetup/PageTemplates/exportimport.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
"""PageTemplate export / import support.
"""

import six

from zope.component import adapts

from ..interfaces import ISetupEnviron
Expand All @@ -33,7 +31,7 @@ def _exportBody(self):
"""Export the object as a file body.
"""
text = self.context.read()
if isinstance(text, six.text_type):
if isinstance(text, str):
return text.encode('utf-8')
return text

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,6 @@ def setUp(self):

def test_suite():
return unittest.TestSuite((
unittest.makeSuite(ZopePageTemplateBodyAdapterTests),
unittest.defaultTestLoader.loadTestsFromTestCase(
ZopePageTemplateBodyAdapterTests),
))
19 changes: 10 additions & 9 deletions src/Products/GenericSetup/PluginIndexes/tests/test_exportimport.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ def test_OddballIndex(self):
from ...testing import DummySetupEnviron
from ..exportimport import PluggableIndexNodeAdapter

class Oddball(object):
class Oddball:
def clear(*a):
raise AssertionError("Don't clear me!")

Expand Down Expand Up @@ -347,13 +347,14 @@ def _no_clear(*a):


def test_suite():
loader = unittest.defaultTestLoader
return unittest.TestSuite((
unittest.makeSuite(DateIndexNodeAdapterTests),
unittest.makeSuite(DateRangeIndexNodeAdapterTests),
unittest.makeSuite(FieldIndexNodeAdapterTests),
unittest.makeSuite(KeywordIndexNodeAdapterTests),
unittest.makeSuite(PathIndexNodeAdapterTests),
unittest.makeSuite(FilteredSetNodeAdapterTests),
unittest.makeSuite(TopicIndexNodeAdapterTests),
unittest.makeSuite(UnchangedTests),
loader.loadTestsFromTestCase(DateIndexNodeAdapterTests),
loader.loadTestsFromTestCase(DateRangeIndexNodeAdapterTests),
loader.loadTestsFromTestCase(FieldIndexNodeAdapterTests),
loader.loadTestsFromTestCase(KeywordIndexNodeAdapterTests),
loader.loadTestsFromTestCase(PathIndexNodeAdapterTests),
loader.loadTestsFromTestCase(FilteredSetNodeAdapterTests),
loader.loadTestsFromTestCase(TopicIndexNodeAdapterTests),
loader.loadTestsFromTestCase(UnchangedTests),
))
4 changes: 1 addition & 3 deletions src/Products/GenericSetup/PythonScripts/exportimport.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
"""PythonScript export / import support.
"""

import six

from zope.component import adapts

from ..interfaces import ISetupEnviron
Expand All @@ -37,7 +35,7 @@ def _exportBody(self):
def _importBody(self, body):
"""Import the object from the file body.
"""
if six.PY3 and isinstance(body, six.binary_type):
if isinstance(body, bytes):
body = body.decode('utf-8')
body = body.replace('\r\n', '\n').replace('\r', '\n')
self.context.write(body)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

import unittest

import six

from ...testing import BodyAdapterTestCase
from ...testing import ExportImportZCMLLayer

Expand Down Expand Up @@ -52,12 +50,12 @@ def setUp(self):
def _verifyImport(self, obj):
# Imported script body should be a native string
expected = _PYTHONSCRIPT_BODY
if six.PY3:
expected = _PYTHONSCRIPT_BODY.decode('utf-8')
expected = _PYTHONSCRIPT_BODY.decode('utf-8')
self.assertEqual(obj.read(), expected)


def test_suite():
return unittest.TestSuite((
unittest.makeSuite(PythonScriptBodyAdapterTests),
unittest.defaultTestLoader.loadTestsFromTestCase(
PythonScriptBodyAdapterTests),
))
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def test_ZCLexicon(self):
environ = DummySetupEnviron()
_before = object(), object(), object()

class DummyLexicon(object):
class DummyLexicon:
_wids, _words, length = _before

lex = DummyLexicon()
Expand Down Expand Up @@ -167,8 +167,9 @@ def _no_clear(*a):


def test_suite():
loader = unittest.defaultTestLoader
return unittest.TestSuite((
unittest.makeSuite(ZCLexiconNodeAdapterTests),
unittest.makeSuite(ZCTextIndexNodeAdapterTests),
unittest.makeSuite(UnchangedTests),
loader.loadTestsFromTestCase(ZCLexiconNodeAdapterTests),
loader.loadTestsFromTestCase(ZCTextIndexNodeAdapterTests),
loader.loadTestsFromTestCase(UnchangedTests),
))
Original file line number Diff line number Diff line change
Expand Up @@ -207,5 +207,6 @@ def test_body_set_update(self):

def test_suite():
return unittest.TestSuite((
unittest.makeSuite(ZCatalogXMLAdapterTests),
unittest.defaultTestLoader.loadTestsFromTestCase(
ZCatalogXMLAdapterTests),
))
4 changes: 2 additions & 2 deletions src/Products/GenericSetup/browser/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ class IComponentsSetupSchema(Interface):
"""

body = Text(
title=u'Settings')
title='Settings')


@implementer(IComponentsSetupSchema)
class ComponentsSetupSchemaAdapter(object):
class ComponentsSetupSchemaAdapter:

adapts(IObjectManagerSite)

Expand Down
2 changes: 1 addition & 1 deletion src/Products/GenericSetup/browser/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class AddWithPresettingsViewBase:
"""

def title(self):
return u'Add %s' % self.klass.meta_type
return 'Add %s' % self.klass.meta_type

def __call__(self, add_input_name='', settings_id='', submit_add=''):
if submit_add:
Expand Down
20 changes: 9 additions & 11 deletions src/Products/GenericSetup/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

from operator import itemgetter

import six

from Acquisition import aq_base
from Acquisition import aq_parent
from zope.component import adapts
Expand Down Expand Up @@ -49,7 +47,7 @@ class ComponentRegistryXMLAdapter(XMLAdapterBase):
name = 'componentregistry'

def _constructBlacklist(self):
blacklist = set((BLACKLIST_SELF,))
blacklist = {BLACKLIST_SELF}
utils = getUtilitiesFor(IComponentsHandlerBlacklist)
for _, util in utils:
names = [_getDottedName(i) for i in util.getExcludedInterfaces()]
Expand Down Expand Up @@ -171,7 +169,7 @@ def _initAdapters(self, node):
continue

provided = _resolveDottedName(provided)
name = six.text_type(child.getAttribute('name'))
name = str(child.getAttribute('name'))

# BBB
for_ = child.getAttribute('for') or child.getAttribute('for_')
Expand Down Expand Up @@ -296,7 +294,7 @@ def _initUtilities(self, node):
continue

provided = _resolveDottedName(provided)
name = six.text_type(child.getAttribute('name'))
name = str(child.getAttribute('name'))

component = child.getAttribute('component')
component = component and _resolveDottedName(component) or None
Expand Down Expand Up @@ -391,9 +389,9 @@ def _extractAdapters(self):

child = self._doc.createElement('adapter')

for_ = u''
for_ = ''
for interface in reg_info['required']:
for_ = for_ + _getDottedName(interface) + u'\n '
for_ = for_ + _getDottedName(interface) + '\n '

child.setAttribute('factory', reg_info['factory'])
child.setAttribute('provides', reg_info['provided'])
Expand Down Expand Up @@ -422,9 +420,9 @@ def _extractSubscriptionAdapters(self):

child = self._doc.createElement('subscriber')

for_ = u''
for_ = ''
for interface in reg_info['required']:
for_ = for_ + _getDottedName(interface) + u'\n '
for_ = for_ + _getDottedName(interface) + '\n '

child.setAttribute('factory', reg_info['factory'])
child.setAttribute('provides', reg_info['provided'])
Expand All @@ -446,9 +444,9 @@ def _extractHandlers(self):
for reg_info in registrations:
child = self._doc.createElement('subscriber')

for_ = u''
for_ = ''
for interface in reg_info['required']:
for_ = for_ + _getDottedName(interface) + u'\n '
for_ = for_ + _getDottedName(interface) + '\n '

child.setAttribute('handler', reg_info['factory'])
child.setAttribute('for', for_.strip())
Expand Down

0 comments on commit 4f88166

Please sign in to comment.