diff options
| author | Alex Grönholm <alex.gronholm@nextday.fi> | 2021-12-22 15:37:46 +0200 |
|---|---|---|
| committer | Alex Grönholm <alex.gronholm@nextday.fi> | 2021-12-22 15:37:46 +0200 |
| commit | 2fae593de291a9963f932ffe0e18241b9f95e5c8 (patch) | |
| tree | 88d992270728397b8bebf6daf038761e3135f849 | |
| parent | c716c87ffa528ac9a31de3ed3217058848dc2cd2 (diff) | |
| download | wheel-git-2fae593de291a9963f932ffe0e18241b9f95e5c8.tar.gz | |
Dropped support for unmaintained Python versions
| -rw-r--r-- | .github/workflows/codeqa-test.yml | 16 | ||||
| -rw-r--r-- | .github/workflows/publish.yml | 4 | ||||
| -rw-r--r-- | .readthedocs.yml | 2 | ||||
| -rw-r--r-- | docs/news.rst | 4 | ||||
| -rw-r--r-- | setup.cfg | 14 | ||||
| -rw-r--r-- | setup.py | 3 | ||||
| -rw-r--r-- | src/wheel/bdist_wheel.py | 22 | ||||
| -rw-r--r-- | src/wheel/cli/__init__.py | 2 | ||||
| -rwxr-xr-x | src/wheel/cli/convert.py | 4 | ||||
| -rw-r--r-- | src/wheel/cli/pack.py | 6 | ||||
| -rw-r--r-- | src/wheel/cli/unpack.py | 6 | ||||
| -rw-r--r-- | src/wheel/pkginfo.py | 56 | ||||
| -rw-r--r-- | src/wheel/util.py | 28 | ||||
| -rw-r--r-- | src/wheel/wheelfile.py | 18 | ||||
| -rw-r--r-- | tests/test_bdist_wheel.py | 1 | ||||
| -rw-r--r-- | tests/test_wheelfile.py | 3 | ||||
| -rw-r--r-- | tests/testdata/unicode.dist/setup.py | 1 | ||||
| -rw-r--r-- | tox.ini | 2 |
18 files changed, 56 insertions, 136 deletions
diff --git a/.github/workflows/codeqa-test.yml b/.github/workflows/codeqa-test.yml index feece77..cf75fa1 100644 --- a/.github/workflows/codeqa-test.yml +++ b/.github/workflows/codeqa-test.yml @@ -21,16 +21,20 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-10.15, macos-11, windows-latest] - python-version: ["2.7", "3.6", "3.9", "3.10", "pypy-2.7", "pypy-3.7"] + python-version: ["3.7", "3.8", "3.9", "3.10", "pypy-3.7"] exclude: - os: macos-11 - python-version: pypy-2.7 + python-version: "3.8" + - os: macos-11 + python-version: "3.9" + - os: macos-11 + python-version: "pypy-3.7" - os: windows-latest - python-version: "2.7" + python-version: "3.8" - os: windows-latest - python-version: pypy-2.7 + python-version: "3.9" - os: windows-latest - python-version: pypy-3.7 + python-version: "pypy-3.7" runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 @@ -38,8 +42,6 @@ jobs: uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - - name: Upgrade setuptools - run: pip install "setuptools >= 40.9" - name: Install the project run: "pip install --no-binary=:all: ." - name: Install test dependencies diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 50d896e..cade917 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -15,9 +15,7 @@ jobs: with: python-version: 3.8 - name: Install dependencies - run: | - pip install "setuptools >= 40.9" - pip install . + run: pip install . - name: Create packages run: python setup.py sdist bdist_wheel - name: Upload packages diff --git a/.readthedocs.yml b/.readthedocs.yml index 582db99..0d6b0b4 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -1,7 +1,7 @@ version: 2 formats: [htmlzip, pdf] python: - version: 3.6 + version: "3.7" install: - method: pip path: . diff --git a/docs/news.rst b/docs/news.rst index eddfcf6..9c6f6be 100644 --- a/docs/news.rst +++ b/docs/news.rst @@ -1,6 +1,10 @@ Release Notes ============= +**UNRELEASED** + +- Dropped support for Python < 3.7 + **0.37.1 (2021-12-22)** - Fixed ``wheel pack`` duplicating the ``WHEEL`` contents when the build number has changed (#415) @@ -9,18 +9,14 @@ classifiers = Topic :: System :: Archiving :: Packaging License :: OSI Approved :: MIT License Programming Language :: Python - Programming Language :: Python :: 2 - Programming Language :: Python :: 2.7 - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.5 - Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3 :: Only Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 author = Daniel Holth author_email = dholth@fastmail.fm -maintainer = Alex Gronholm +maintainer = Alex Grönholm maintainer_email = alex.gronholm@nextday.fi url = https://github.com/pypa/wheel project_urls = @@ -34,7 +30,7 @@ license = MIT package_dir= = src packages = find: -python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.* +python_requires = >=3.7 setup_requires = setuptools >= 40.9.0 zip_safe = False @@ -65,7 +61,3 @@ show_missing = true [flake8] max-line-length = 99 - -[bdist_wheel] -# use py2.py3 tag for pure-python dist: -universal = 1 @@ -1,4 +1,3 @@ -# coding: utf-8 from setuptools import setup -setup(maintainer=u'Alex Grönholm') +setup() diff --git a/src/wheel/bdist_wheel.py b/src/wheel/bdist_wheel.py index 80e43d0..84a3fcf 100644 --- a/src/wheel/bdist_wheel.py +++ b/src/wheel/bdist_wheel.py @@ -14,6 +14,7 @@ import warnings from collections import OrderedDict from distutils.core import Command from distutils import log as logger +from email.generator import BytesGenerator from io import BytesIO from glob import iglob from shutil import rmtree @@ -29,10 +30,6 @@ from .vendored.packaging import tags from .wheelfile import WheelFile from . import __version__ as wheel_version -if sys.version_info < (3,): - from email.generator import Generator as BytesGenerator -else: - from email.generator import BytesGenerator safe_name = pkg_resources.safe_name safe_version = pkg_resources.safe_version @@ -69,8 +66,7 @@ def get_flag(var, fallback, expected=True, warn=True): def get_abi_tag(): - """Return the ABI tag based on SOABI (if available) or emulate SOABI - (CPython 2, PyPy).""" + """Return the ABI tag based on SOABI (if available) or emulate SOABI (PyPy).""" soabi = get_config_var('SOABI') impl = tags.interpreter_name() if not soabi and impl in ('cp', 'pp') and hasattr(sys, 'maxunicode'): @@ -81,19 +77,14 @@ def get_abi_tag(): hasattr(sys, 'gettotalrefcount'), warn=(impl == 'cp')): d = 'd' + if get_flag('WITH_PYMALLOC', impl == 'cp', warn=(impl == 'cp' and sys.version_info < (3, 8))) \ and sys.version_info < (3, 8): m = 'm' - if get_flag('Py_UNICODE_SIZE', - sys.maxunicode == 0x10ffff, - expected=4, - warn=(impl == 'cp' and - sys.version_info < (3, 3))) \ - and sys.version_info < (3, 3): - u = 'u' + abi = '%s%s%s%s%s' % (impl, tags.interpreter_version(), d, m, u) elif soabi and soabi.startswith('cpython-'): abi = 'cp' + soabi.split('-')[1] @@ -105,6 +96,7 @@ def get_abi_tag(): abi = soabi.replace('.', '_').replace('-', '_') else: abi = None + return abi @@ -374,10 +366,6 @@ class bdist_wheel(Command): def write_wheelfile(self, wheelfile_base, generator='bdist_wheel (' + wheel_version + ')'): from email.message import Message - # Workaround for Python 2.7 for when "generator" is unicode - if sys.version_info < (3,) and not isinstance(generator, str): - generator = generator.encode('utf-8') - msg = Message() msg['Wheel-Version'] = '1.0' # of the spec msg['Generator'] = generator diff --git a/src/wheel/cli/__init__.py b/src/wheel/cli/__init__.py index 95740bf..d41dcfd 100644 --- a/src/wheel/cli/__init__.py +++ b/src/wheel/cli/__init__.py @@ -2,8 +2,6 @@ Wheel command-line utility. """ -from __future__ import print_function - import argparse import os import sys diff --git a/src/wheel/cli/convert.py b/src/wheel/cli/convert.py index 154f1b1..b502daf 100755 --- a/src/wheel/cli/convert.py +++ b/src/wheel/cli/convert.py @@ -1,7 +1,6 @@ import os.path import re import shutil -import sys import tempfile import zipfile from distutils import dist @@ -261,8 +260,7 @@ def convert(files, dest_dir, verbose): conv = wininst2wheel if verbose: - print("{}... ".format(installer)) - sys.stdout.flush() + print("{}... ".format(installer), flush=True) conv(installer, dest_dir) if verbose: diff --git a/src/wheel/cli/pack.py b/src/wheel/cli/pack.py index 9403c51..04d858d 100644 --- a/src/wheel/cli/pack.py +++ b/src/wheel/cli/pack.py @@ -1,8 +1,5 @@ -from __future__ import print_function - import os.path import re -import sys from wheel.cli import WheelError from wheel.wheelfile import WheelFile @@ -75,8 +72,7 @@ def pack(directory, dest_dir, build_number): # Repack the wheel wheel_path = os.path.join(dest_dir, '{}-{}.whl'.format(name_version, tagline)) with WheelFile(wheel_path, 'w') as wf: - print("Repacking wheel as {}...".format(wheel_path), end='') - sys.stdout.flush() + print("Repacking wheel as {}...".format(wheel_path), end='', flush=True) wf.write_files(directory) print('OK') diff --git a/src/wheel/cli/unpack.py b/src/wheel/cli/unpack.py index 2e9857a..8aa8180 100644 --- a/src/wheel/cli/unpack.py +++ b/src/wheel/cli/unpack.py @@ -1,7 +1,4 @@ -from __future__ import print_function - import os.path -import sys from ..wheelfile import WheelFile @@ -18,8 +15,7 @@ def unpack(path, dest='.'): with WheelFile(path) as wf: namever = wf.parsed_filename.group('namever') destination = os.path.join(dest, namever) - print("Unpacking to: {}...".format(destination), end='') - sys.stdout.flush() + print("Unpacking to: {}...".format(destination), end='', flush=True) wf.extractall(destination) print('OK') diff --git a/src/wheel/pkginfo.py b/src/wheel/pkginfo.py index 115be45..0470a1d 100644 --- a/src/wheel/pkginfo.py +++ b/src/wheel/pkginfo.py @@ -1,43 +1,23 @@ """Tools for reading and writing PKG-INFO / METADATA without caring about the encoding.""" +from email.generator import BytesGenerator from email.parser import Parser -try: - unicode - _PY3 = False -except NameError: - _PY3 = True - -if not _PY3: - from email.generator import Generator - - def read_pkg_info_bytes(bytestr): - return Parser().parsestr(bytestr) - - def read_pkg_info(path): - with open(path, "r") as headers: - message = Parser().parse(headers) - return message - - def write_pkg_info(path, message): - with open(path, 'w') as metadata: - Generator(metadata, mangle_from_=False, maxheaderlen=0).flatten(message) -else: - from email.generator import BytesGenerator - - def read_pkg_info_bytes(bytestr): - headers = bytestr.decode(encoding="ascii", errors="surrogateescape") - message = Parser().parsestr(headers) - return message - - def read_pkg_info(path): - with open(path, "r", - encoding="ascii", - errors="surrogateescape") as headers: - message = Parser().parse(headers) - return message - - def write_pkg_info(path, message): - with open(path, "wb") as out: - BytesGenerator(out, mangle_from_=False, maxheaderlen=0).flatten(message) + +def read_pkg_info_bytes(bytestr): + headers = bytestr.decode(encoding="ascii", errors="surrogateescape") + message = Parser().parsestr(headers) + return message + + +def read_pkg_info(path): + with open(path, "r", encoding="ascii", errors="surrogateescape") as headers: + message = Parser().parse(headers) + + return message + + +def write_pkg_info(path, message): + with open(path, "wb") as out: + BytesGenerator(out, mangle_from_=False, maxheaderlen=0).flatten(message) diff --git a/src/wheel/util.py b/src/wheel/util.py index 3ae2b44..a1f1e3b 100644 --- a/src/wheel/util.py +++ b/src/wheel/util.py @@ -1,25 +1,10 @@ import base64 -import io -import sys -if sys.version_info[0] < 3: - text_type = unicode # noqa: F821 - - StringIO = io.BytesIO - - def native(s, encoding='utf-8'): - if isinstance(s, unicode): # noqa: F821 - return s.encode(encoding) - return s -else: - text_type = str - - StringIO = io.StringIO - - def native(s, encoding='utf-8'): - if isinstance(s, bytes): - return s.decode(encoding) +def native(s, encoding='utf-8'): + if isinstance(s, bytes): + return s.decode(encoding) + else: return s @@ -41,6 +26,7 @@ def as_unicode(s): def as_bytes(s): - if isinstance(s, text_type): + if isinstance(s, str): return s.encode('utf-8') - return s + else: + return s diff --git a/src/wheel/wheelfile.py b/src/wheel/wheelfile.py index 21e7361..2295306 100644 --- a/src/wheel/wheelfile.py +++ b/src/wheel/wheelfile.py @@ -1,28 +1,16 @@ -from __future__ import print_function - import csv import hashlib import os.path import re import stat -import sys import time from collections import OrderedDict from distutils import log as logger +from io import StringIO, TextIOWrapper from zipfile import ZIP_DEFLATED, ZipInfo, ZipFile from wheel.cli import WheelError -from wheel.util import urlsafe_b64decode, as_unicode, native, urlsafe_b64encode, as_bytes, StringIO - -if sys.version_info >= (3,): - from io import TextIOWrapper - - def read_csv(fp): - return csv.reader(TextIOWrapper(fp, newline='', encoding='utf-8')) -else: - def read_csv(fp): - for line in csv.reader(fp): - yield [column.decode('utf-8') for column in line] +from wheel.util import urlsafe_b64decode, as_unicode, native, urlsafe_b64encode, as_bytes # Non-greedy matching of an optional build number may be too clever (more # invalid wheel filenames will match). Separate regex for .dist-info? @@ -71,7 +59,7 @@ class WheelFile(ZipFile): raise WheelError('Missing {} file'.format(self.record_path)) with record: - for line in read_csv(record): + for line in csv.reader(TextIOWrapper(record, newline='', encoding='utf-8')): path, hash_sum, size = line if not hash_sum: continue diff --git a/tests/test_bdist_wheel.py b/tests/test_bdist_wheel.py index 651c034..a0de591 100644 --- a/tests/test_bdist_wheel.py +++ b/tests/test_bdist_wheel.py @@ -1,4 +1,3 @@ -# coding: utf-8 import os.path import shutil import stat diff --git a/tests/test_wheelfile.py b/tests/test_wheelfile.py index db11bcd..0e060b1 100644 --- a/tests/test_wheelfile.py +++ b/tests/test_wheelfile.py @@ -1,6 +1,3 @@ -# coding: utf-8 -from __future__ import unicode_literals - import sys from zipfile import ZipFile, ZIP_DEFLATED diff --git a/tests/testdata/unicode.dist/setup.py b/tests/testdata/unicode.dist/setup.py index bb0ff60..3382b53 100644 --- a/tests/testdata/unicode.dist/setup.py +++ b/tests/testdata/unicode.dist/setup.py @@ -1,4 +1,3 @@ -# coding: utf-8 from setuptools import setup setup(name='unicode.dist', @@ -4,7 +4,7 @@ # and then run "tox" from this directory. [tox] -envlist = py27, py35, py36, py37, py38, py39, py310, pypy, pypy3, flake8 +envlist = py37, py38, py39, py310, pypy3.7, flake8 minversion = 3.3.0 skip_missing_interpreters = true |
