Skip to content

Commit b371cfb

Browse files
committed
- Drop support for Python 2.7, 3.5, 3.6
1 parent 53b465b commit b371cfb

File tree

13 files changed

+36
-149
lines changed

13 files changed

+36
-149
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ jobs:
2121
config:
2222
# [Python version, tox env]
2323
- ["3.9", "lint"]
24-
- ["2.7", "py27"]
25-
- ["3.5", "py35"]
26-
- ["3.6", "py36"]
2724
- ["3.7", "py37"]
2825
- ["3.8", "py38"]
2926
- ["3.9", "py39"]
@@ -57,7 +54,7 @@ jobs:
5754
- name: Coverage
5855
if: matrix.config[1] == 'coverage'
5956
run: |
60-
pip install coveralls coverage-python-version
57+
pip install coveralls
6158
coveralls --service=github
6259
env:
6360
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.meta.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22
# https://github.com/zopefoundation/meta/tree/master/config/zope-product
33
[meta]
44
template = "zope-product"
5-
commit-id = "d6240444ec6c9e203f2fd9f62c3e6038f9189e96"
5+
commit-id = "e5c611fb"
66

77
[python]
88
with-pypy = false
9-
with-legacy-python = true
109
with-sphinx-doctests = false
1110
with-windows = false
1211
with-future-python = false
@@ -17,7 +16,6 @@ fail-under = 83
1716

1817
[manifest]
1918
additional-rules = [
20-
"include buildout4.cfg",
2119
"include src/Products/PythonScripts/www/default_content",
2220
"recursive-include src *.dtml",
2321
"recursive-include src *.pkl",

MANIFEST.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ include buildout.cfg
77
include tox.ini
88

99
recursive-include src *.py
10-
include buildout4.cfg
1110
include src/Products/PythonScripts/www/default_content
1211
recursive-include src *.dtml
1312
recursive-include src *.pkl

setup.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Generated from:
22
# https://github.com/zopefoundation/meta/tree/master/config/zope-product
33
[bdist_wheel]
4-
universal = 1
4+
universal = 0
55

66
[flake8]
77
doctests = 1
@@ -17,7 +17,7 @@ ignore =
1717
force_single_line = True
1818
combine_as_imports = True
1919
sections = FUTURE,STDLIB,THIRDPARTY,ZOPE,FIRSTPARTY,LOCALFOLDER
20-
known_third_party = six, docutils, pkg_resources
20+
known_third_party = six, docutils, pkg_resources, pytz
2121
known_zope =
2222
known_first_party =
2323
default_section = ZOPE

setup.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,34 +29,29 @@
2929
description='Provides support for restricted execution of Python '
3030
'scripts in Zope.',
3131
author='Zope Foundation and Contributors',
32-
author_email='zope-dev@zope.org',
33-
long_description=('%s\n%s' % (open('README.rst').read(),
34-
open('CHANGES.rst').read())),
32+
author_email='zope-dev@zope.dev',
33+
long_description=('{}\n{}'.format(open('README.rst').read(),
34+
open('CHANGES.rst').read())),
3535
packages=find_packages('src'),
3636
namespace_packages=['Products'],
3737
package_dir={'': 'src'},
3838
classifiers=[
3939
'Development Status :: 6 - Mature',
4040
'Environment :: Web Environment',
4141
'Framework :: Zope',
42-
'Framework :: Zope :: 4',
4342
'Framework :: Zope :: 5',
4443
'License :: OSI Approved :: Zope Public License',
4544
'Operating System :: OS Independent',
4645
'Programming Language :: Python',
47-
'Programming Language :: Python :: 2',
48-
'Programming Language :: Python :: 2.7',
4946
'Programming Language :: Python :: 3',
50-
'Programming Language :: Python :: 3.5',
51-
'Programming Language :: Python :: 3.6',
5247
'Programming Language :: Python :: 3.7',
5348
'Programming Language :: Python :: 3.8',
5449
'Programming Language :: Python :: 3.9',
5550
'Programming Language :: Python :: 3.10',
5651
'Programming Language :: Python :: 3.11',
5752
'Programming Language :: Python :: Implementation :: CPython',
5853
],
59-
python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*',
54+
python_requires='>=3.7',
6055
install_requires=[
6156
'setuptools',
6257
'AccessControl',

src/Products/PythonScripts/PythonScript.py

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,14 @@
1616
Python code.
1717
"""
1818

19+
import importlib.util
1920
import marshal
2021
import os
2122
import re
2223
import sys
2324
import types
2425
from logging import getLogger
25-
26-
import six
27-
from six.moves.urllib.parse import quote
26+
from urllib.parse import quote
2827

2928
from AccessControl.class_init import InitializeClass
3029
from AccessControl.Permissions import change_proxy_roles
@@ -47,24 +46,14 @@
4746
from Shared.DC.Scripts.Script import Script
4847
from Shared.DC.Scripts.Script import defaultBindings
4948
from zExceptions import Forbidden
49+
from zExceptions import ResourceLockedError
5050
from ZPublisher.HTTPRequest import default_encoding
5151

5252

53-
try:
54-
from zExceptions import ResourceLockedError
55-
except ImportError:
56-
from webdav.Lockable import ResourceLockedError
57-
5853
LOG = getLogger('PythonScripts')
5954

6055
# Track the Python bytecode version
61-
try:
62-
import importlib.util
63-
Python_magic = importlib.util.MAGIC_NUMBER
64-
except ImportError: # Python 2
65-
import imp
66-
Python_magic = imp.get_magic()
67-
del imp
56+
Python_magic = importlib.util.MAGIC_NUMBER
6857

6958
# This should only be incremented to force recompilation.
7059
Script_magic = 4
@@ -103,7 +92,7 @@ def manage_addPythonScript(self, id, title='', file=None, REQUEST=None,
10392
except Exception:
10493
u = REQUEST['URL1']
10594
if submit == 'Add and Edit':
106-
u = '%s/%s' % (u, quote(id))
95+
u = f'{u}/{quote(id)}'
10796
REQUEST.RESPONSE.redirect(u + '/manage_main')
10897
return ''
10998

@@ -288,7 +277,7 @@ def _newfun(self, code):
288277
safe_globals['__name__'] = 'script'
289278

290279
safe_locals = {}
291-
six.exec_(code, safe_globals, safe_locals)
280+
exec(code, safe_globals, safe_locals)
292281
func = list(safe_locals.values())[0]
293282
self._v_ft = (func.__code__, safe_globals, func.__defaults__ or ())
294283
return func
@@ -332,7 +321,7 @@ def _exec(self, bound_names, args, kw):
332321
if ft is None:
333322
__traceback_supplement__ = (
334323
PythonScriptTracebackSupplement, self)
335-
raise RuntimeError('%s %s has errors.' % (self.meta_type, self.id))
324+
raise RuntimeError(f'{self.meta_type} {self.id} has errors.')
336325

337326
function_code, safe_globals, function_argument_definitions = ft
338327
safe_globals = safe_globals.copy()
@@ -433,10 +422,8 @@ def write(self, text):
433422
bindmap = self.getBindingAssignments().getAssignedNames()
434423
bup = 0
435424

436-
if six.PY3 and isinstance(text, bytes):
425+
if isinstance(text, bytes):
437426
text = text.decode(default_encoding)
438-
elif six.PY2 and not isinstance(text, bytes):
439-
text = text.encode(default_encoding)
440427

441428
st = 0
442429
try:
@@ -520,7 +507,7 @@ def read(self):
520507
else:
521508
prefix = '##'
522509

523-
hlines = ['%s %s "%s"' % (prefix, self.meta_type, self.id)]
510+
hlines = [f'{prefix} {self.meta_type} "{self.id}"']
524511
mm = sorted(self._metadata_map().items())
525512
for kv in mm:
526513
hlines.append('%s=%s' % kv)
@@ -553,7 +540,7 @@ def get_size(self):
553540
@security.protected(view_management_screens)
554541
def PrincipiaSearchSource(self):
555542
"""Support for searching - the document's contents are searched."""
556-
return '%s\n%s' % (self._params, self._body)
543+
return f'{self._params}\n{self._body}'
557544

558545
@security.protected(view_management_screens)
559546
def document_src(self, REQUEST=None, RESPONSE=None):

src/Products/PythonScripts/standard.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"import Products.PythonScripts.standard"
1919
"""
2020

21-
from six.moves.urllib.parse import urlencode # NOQA
21+
from urllib.parse import urlencode # NOQA
2222

2323
from AccessControl.SecurityInfo import ModuleSecurityInfo
2424
from AccessControl.SecurityManagement import getSecurityManager

src/Products/PythonScripts/tests/testBindings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from OFS.ObjectManager import ObjectManager
2222

2323

24-
class UnderprivilegedUser(object):
24+
class UnderprivilegedUser:
2525

2626
def getId(self):
2727
return 'underprivileged'

0 commit comments

Comments
 (0)