Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-wheel for openSUSE:Factory checked in at 2023-09-06 18:55:35 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-wheel (Old) and /work/SRC/openSUSE:Factory/.python-wheel.new.1766 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-wheel" Wed Sep 6 18:55:35 2023 rev:33 rq:1108786 version:0.41.2 Changes: -------- --- /work/SRC/openSUSE:Factory/python-wheel/python-wheel.changes 2023-05-09 13:06:20.828667185 +0200 +++ /work/SRC/openSUSE:Factory/.python-wheel.new.1766/python-wheel.changes 2023-09-06 18:55:59.334843840 +0200 @@ -1,0 +2,19 @@ +Mon Sep 4 03:35:21 UTC 2023 - Martin Schreiner <[email protected]> + +- Update to 0.41.2: + - Changes from 0.41.2: + * Fixed platform tag detection for GraalPy and 32-bit python + running on an aarch64 kernel + * Fixed wheel tags to not list directories in RECORD files + * Fixed ABI tag generation for GraalPy + - Changes from 0.41.1: + * Fixed naming of the data_dir directory in the presence of local + version segment given via egg_info.tag_build + * Fixed version specifiers in Requires-Dist being wrapped in + parentheses + - Changes from 0.41.0: + * Added full support of the build tag syntax to wheel tags + * Fixed warning on Python 3.12 about onerror deprecation + * Support testing on Python 3.12 betas + +------------------------------------------------------------------- Old: ---- wheel-0.40.0.tar.gz New: ---- wheel-0.41.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-wheel.spec ++++++ --- /var/tmp/diff_new_pack.Av5bd3/_old 2023-09-06 18:56:00.510885764 +0200 +++ /var/tmp/diff_new_pack.Av5bd3/_new 2023-09-06 18:56:00.514885906 +0200 @@ -32,7 +32,7 @@ %endif %{?sle15_python_module_pythons} Name: python-wheel%{psuffix} -Version: 0.40.0 +Version: 0.41.2 Release: 0 Summary: A built-package format for Python License: MIT ++++++ wheel-0.40.0.tar.gz -> wheel-0.41.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wheel-0.40.0/.cirrus.yml new/wheel-0.41.2/.cirrus.yml --- old/wheel-0.40.0/.cirrus.yml 2023-03-14 15:38:44.000000000 +0100 +++ new/wheel-0.41.2/.cirrus.yml 2023-08-22 11:29:26.000000000 +0200 @@ -1,5 +1,5 @@ freebsd_instance: - image_family: freebsd-13-0-snap + image_family: freebsd-13-2 test_task: only_if: "$CIRRUS_BRANCH == 'main' || $CIRRUS_PR != ''" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wheel-0.40.0/.github/codecov.yml new/wheel-0.41.2/.github/codecov.yml --- old/wheel-0.40.0/.github/codecov.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/wheel-0.41.2/.github/codecov.yml 2023-08-22 11:29:26.000000000 +0200 @@ -0,0 +1,5 @@ +coverage: + status: + patch: + default: + informational: true diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wheel-0.40.0/.github/workflows/publish.yml new/wheel-0.41.2/.github/workflows/publish.yml --- old/wheel-0.40.0/.github/workflows/publish.yml 2023-03-14 15:38:44.000000000 +0100 +++ new/wheel-0.41.2/.github/workflows/publish.yml 2023-08-22 11:29:26.000000000 +0200 @@ -1,13 +1,17 @@ name: Publish packages to PyPI on: - create: - tags: "*" + push: + tags: + - "[0-9]+.[0-9]+.[0-9]+" + - "[0-9]+.[0-9]+.[0-9]+.post[0-9]+" + - "[0-9]+.[0-9]+.[0-9]+[a-b][0-9]+" + - "[0-9]+.[0-9]+.[0-9]+rc[0-9]+" jobs: - publish: + build: runs-on: ubuntu-latest - if: startsWith(github.ref, 'refs/tags/') + environment: release steps: - uses: actions/checkout@v3 - name: Set up Python @@ -18,7 +22,20 @@ run: pip install flit - name: Create packages run: flit build --setup-py + - name: Store package artifacts + uses: actions/upload-artifact@v3 + with: + name: dist + path: dist + + publish: + needs: build + runs-on: ubuntu-latest + environment: release + permissions: + id-token: write + steps: + - name: Retrieve package artifacts + uses: actions/download-artifact@v3 - name: Upload packages uses: pypa/gh-action-pypi-publish@release/v1 - with: - password: ${{ secrets.pypi_password }} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wheel-0.40.0/.github/workflows/test.yml new/wheel-0.41.2/.github/workflows/test.yml --- old/wheel-0.40.0/.github/workflows/test.yml 2023-03-14 15:38:44.000000000 +0100 +++ new/wheel-0.41.2/.github/workflows/test.yml 2023-08-22 11:29:26.000000000 +0200 @@ -14,7 +14,7 @@ fail-fast: false matrix: os: [ubuntu-latest] - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "pypy-3.8", "pypy-3.9"] + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "pypy-3.8", "pypy-3.9"] include: - os: macos-latest python-version: "3.7" @@ -35,6 +35,7 @@ uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} + allow-prereleases: true - uses: actions/cache@v3 with: path: ~/.cache/pip diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wheel-0.40.0/.pre-commit-config.yaml new/wheel-0.41.2/.pre-commit-config.yaml --- old/wheel-0.40.0/.pre-commit-config.yaml 2023-03-14 15:38:44.000000000 +0100 +++ new/wheel-0.41.2/.pre-commit-config.yaml 2023-08-22 11:29:26.000000000 +0200 @@ -17,19 +17,19 @@ - id: requirements-txt-fixer - id: trailing-whitespace -- repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.0.255 +- repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.0.285 hooks: - id: ruff args: [--fix, --show-fixes] -- repo: https://github.com/psf/black - rev: 23.1.0 +- repo: https://github.com/psf/black-pre-commit-mirror + rev: 23.7.0 hooks: - id: black - repo: https://github.com/codespell-project/codespell - rev: v2.2.4 + rev: v2.2.5 hooks: - id: codespell diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wheel-0.40.0/.readthedocs.yml new/wheel-0.41.2/.readthedocs.yml --- old/wheel-0.40.0/.readthedocs.yml 2023-03-14 15:38:44.000000000 +0100 +++ new/wheel-0.41.2/.readthedocs.yml 2023-08-22 11:29:26.000000000 +0200 @@ -1,7 +1,18 @@ version: 2 -formats: [htmlzip, pdf] + +formats: + - htmlzip + - pdf + +sphinx: + configuration: docs/conf.py + +build: + os: ubuntu-22.04 + tools: + python: "3.7" + python: - version: "3.7" install: - method: pip path: . diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wheel-0.40.0/docs/news.rst new/wheel-0.41.2/docs/news.rst --- old/wheel-0.40.0/docs/news.rst 2023-03-14 15:38:44.000000000 +0100 +++ new/wheel-0.41.2/docs/news.rst 2023-08-22 11:29:26.000000000 +0200 @@ -1,6 +1,27 @@ Release Notes ============= +**0.41.2 (2023-08-22)** + +- Fixed platform tag detection for GraalPy and 32-bit python running on an aarch64 + kernel (PR by Matthieu Darbois) +- Fixed ``wheel tags`` to not list directories in ``RECORD`` files + (PR by Mike Taves) +- Fixed ABI tag generation for GraalPy (PR by Michael Simacek) + +**0.41.1 (2023-08-05)** + +- Fixed naming of the ``data_dir`` directory in the presence of local version segment + given via ``egg_info.tag_build`` (PR by Anderson Bravalheri) +- Fixed version specifiers in ``Requires-Dist`` being wrapped in parentheses + +**0.41.0 (2023-07-22)** + +- Added full support of the build tag syntax to ``wheel tags`` (you can now set a build + tag like ``123mytag``) +- Fixed warning on Python 3.12 about ``onerror`` deprecation. (PR by Henry Schreiner) +- Support testing on Python 3.12 betas (PR by Ewout ter Hoeven) + **0.40.0 (2023-03-14)** - Added a ``wheel tags`` command to modify tags on an existing wheel diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wheel-0.40.0/pyproject.toml new/wheel-0.41.2/pyproject.toml --- old/wheel-0.40.0/pyproject.toml 2023-03-14 15:38:44.000000000 +0100 +++ new/wheel-0.41.2/pyproject.toml 2023-08-22 11:29:26.000000000 +0200 @@ -18,11 +18,11 @@ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", ] authors = [{name = "Daniel Holth", email = "[email protected]"}] maintainers = [{name = "Alex Grönholm", email = "[email protected]"}] keywords = ["wheel", "packaging"] -license = {file = "LICENSE.txt"} requires-python = ">=3.7" dynamic = ["version"] @@ -39,7 +39,8 @@ [project.optional-dependencies] test = [ - "pytest >= 6.0.0" + "pytest >= 6.0.0", + "setuptools >= 65", ] [tool.flit.sdist] @@ -68,7 +69,6 @@ ] [tool.black] -target-version = ['py37'] extend-exclude = ''' ^/src/wheel/vendored/ ''' @@ -98,26 +98,27 @@ "I", # isort "PGH", # pygrep-hooks "UP", # pyupgrade - "B0", # flake8-bugbear + "B", # flake8-bugbear ] -target-version = "py37" src = ["src"] +# Tox (https://tox.wiki/) is a tool for running tests in multiple virtualenvs. +# This configuration file will run the test suite on all supported python +# versions. To use it, "pipx install tox" and then run "tox" from this +# directory. + [tool.tox] legacy_tox_ini = ''' -# Tox (https://tox.wiki/) is a tool for running tests -# in multiple virtualenvs. This configuration file will run the -# test suite on all supported python versions. To use it, "pip install tox" -# and then run "tox" from this directory. - [tox] -envlist = py37, py38, py39, py310, py311, pypy3, lint, pkg +envlist = py37, py38, py39, py310, py311, py312, pypy3, lint, pkg minversion = 4.0.0 skip_missing_interpreters = true [testenv] +package = wheel +wheel_build_env = .pkg depends = lint -commands = {envpython} -b -m pytest {posargs} +commands = {env_python} -b -m pytest {posargs} extras = test set_env = PYTHONWARNDEFAULTENCODING = 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wheel-0.40.0/src/wheel/__init__.py new/wheel-0.41.2/src/wheel/__init__.py --- old/wheel-0.40.0/src/wheel/__init__.py 2023-03-14 15:38:44.000000000 +0100 +++ new/wheel-0.41.2/src/wheel/__init__.py 2023-08-22 11:29:26.000000000 +0200 @@ -1,3 +1,3 @@ from __future__ import annotations -__version__ = "0.40.0" +__version__ = "0.41.2" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wheel-0.40.0/src/wheel/bdist_wheel.py new/wheel-0.41.2/src/wheel/bdist_wheel.py --- old/wheel-0.40.0/src/wheel/bdist_wheel.py 2023-03-14 15:38:44.000000000 +0100 +++ new/wheel-0.41.2/src/wheel/bdist_wheel.py 2023-08-22 11:29:26.000000000 +0200 @@ -10,10 +10,10 @@ import re import shutil import stat +import struct import sys import sysconfig import warnings -from collections import OrderedDict from email.generator import BytesGenerator, Generator from email.policy import EmailPolicy from glob import iglob @@ -57,6 +57,10 @@ PY_LIMITED_API_PATTERN = r"cp3\d" +def _is_32bit_interpreter(): + return struct.calcsize("P") == 4 + + def python_tag(): return f"py{sys.version_info[0]}" @@ -66,9 +70,15 @@ result = sysconfig.get_platform() if result.startswith("macosx") and archive_root is not None: result = calculate_macosx_platform_tag(archive_root, result) - elif result == "linux-x86_64" and sys.maxsize == 2147483647: - # pip pull request #3497 - result = "linux-i686" + elif _is_32bit_interpreter(): + if result == "linux-x86_64": + # pip pull request #3497 + result = "linux-i686" + elif result == "linux-aarch64": + # packaging pull request #234 + # TODO armv8l, packaging pull request #690 => this did not land + # in pip/packaging yet + result = "linux-armv7l" return result.replace("-", "_") @@ -80,10 +90,9 @@ if val is None: if warn: warnings.warn( - "Config variable '{}' is unset, Python ABI tag may " - "be incorrect".format(var), + f"Config variable '{var}' is unset, Python ABI tag may " "be incorrect", RuntimeWarning, - 2, + stacklevel=2, ) return fallback return val == expected @@ -114,6 +123,9 @@ # we want something like pypy36-pp73 abi = "-".join(soabi.split("-")[:2]) abi = abi.replace(".", "_").replace("-", "_") + elif soabi and impl == "graalpy": + abi = "-".join(soabi.split("-")[:3]) + abi = abi.replace(".", "_").replace("-", "_") elif soabi: abi = soabi.replace(".", "_").replace("-", "_") else: @@ -131,7 +143,10 @@ def remove_readonly(func, path, excinfo): - print(str(excinfo[1])) + remove_readonly_exc(func, path, excinfo[1]) + + +def remove_readonly_exc(func, path, exc): os.chmod(path, stat.S_IWRITE) func(path) @@ -139,9 +154,10 @@ class bdist_wheel(Command): description = "create a wheel distribution" - supported_compressions = OrderedDict( - [("stored", ZIP_STORED), ("deflated", ZIP_DEFLATED)] - ) + supported_compressions = { + "stored": ZIP_STORED, + "deflated": ZIP_DEFLATED, + } user_options = [ ("bdist-dir=", "b", "temporary directory for creating the distribution"), @@ -155,7 +171,7 @@ "keep-temp", "k", "keep the pseudo-installation tree around after " - + "creating the distribution archive", + "creating the distribution archive", ), ("dist-dir=", "d", "directory to put final built distributions in"), ("skip-build", None, "skip rebuilding everything (for testing/debugging)"), @@ -229,13 +245,16 @@ bdist_base = self.get_finalized_command("bdist").bdist_base self.bdist_dir = os.path.join(bdist_base, "wheel") + egg_info = self.distribution.get_command_obj("egg_info") + egg_info.ensure_finalized() # needed for correct `wheel_dist_name` + self.data_dir = self.wheel_dist_name + ".data" self.plat_name_supplied = self.plat_name is not None try: self.compression = self.supported_compressions[self.compression] except KeyError: - raise ValueError(f"Unsupported compression: {self.compression}") + raise ValueError(f"Unsupported compression: {self.compression}") from None need_options = ("dist_dir", "plat_name", "skip_build") @@ -295,11 +314,13 @@ # modules, use the default platform name. plat_name = get_platform(self.bdist_dir) - if ( - plat_name in ("linux-x86_64", "linux_x86_64") - and sys.maxsize == 2147483647 - ): - plat_name = "linux_i686" + if _is_32bit_interpreter(): + if plat_name in ("linux-x86_64", "linux_x86_64"): + plat_name = "linux_i686" + if plat_name in ("linux-aarch64", "linux_aarch64"): + # TODO armv8l, packaging pull request #690 => this did not land + # in pip/packaging yet + plat_name = "linux_armv7l" plat_name = ( plat_name.lower().replace("-", "_").replace(".", "_").replace(" ", "_") @@ -416,7 +437,10 @@ if not self.keep_temp: log.info(f"removing {self.bdist_dir}") if not self.dry_run: - rmtree(self.bdist_dir, onerror=remove_readonly) + if sys.version_info < (3, 12): + rmtree(self.bdist_dir, onerror=remove_readonly) + else: + rmtree(self.bdist_dir, onexc=remove_readonly_exc) def write_wheelfile( self, wheelfile_base, generator="bdist_wheel (" + wheel_version + ")" @@ -473,6 +497,7 @@ warnings.warn( 'The "license_file" option is deprecated. Use "license_files" instead.', DeprecationWarning, + stacklevel=2, ) files.add(metadata["license_file"][1]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wheel-0.40.0/src/wheel/cli/__init__.py new/wheel-0.41.2/src/wheel/cli/__init__.py --- old/wheel-0.40.0/src/wheel/cli/__init__.py 2023-03-14 15:38:44.000000000 +0100 +++ new/wheel-0.41.2/src/wheel/cli/__init__.py 2023-08-22 11:29:26.000000000 +0200 @@ -7,6 +7,7 @@ import argparse import os import sys +from argparse import ArgumentTypeError class WheelError(Exception): @@ -56,6 +57,15 @@ print("wheel %s" % __version__) +def parse_build_tag(build_tag: str) -> str: + if not build_tag[0].isdigit(): + raise ArgumentTypeError("build tag must begin with a digit") + elif "-" in build_tag: + raise ArgumentTypeError("invalid character ('-') in build tag") + + return build_tag + + TAGS_HELP = """\ Make a new wheel with given tags. Any tags unspecified will remain the same. Starting the tags with a "+" will append to the existing tags. Starting with a @@ -117,7 +127,7 @@ "--platform-tag", metavar="TAG", help="Specify a platform tag(s)" ) tags_parser.add_argument( - "--build", type=int, metavar="NUMBER", help="Specify a build number" + "--build", type=parse_build_tag, metavar="BUILD", help="Specify a build tag" ) tags_parser.set_defaults(func=tags_f) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wheel-0.40.0/src/wheel/cli/convert.py new/wheel-0.41.2/src/wheel/cli/convert.py --- old/wheel-0.40.0/src/wheel/cli/convert.py 2023-03-14 15:38:44.000000000 +0100 +++ new/wheel-0.41.2/src/wheel/cli/convert.py 2023-08-22 11:29:26.000000000 +0200 @@ -188,7 +188,7 @@ else: paths = {"platlib": ""} - dist_info = "%(name)s-%(ver)s" % info + dist_info = "{name}-{ver}".format(**info) datadir = "%s.data/" % dist_info # rewrite paths to trick ZipFile into extracting an egg diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wheel-0.40.0/src/wheel/cli/tags.py new/wheel-0.41.2/src/wheel/cli/tags.py --- old/wheel-0.40.0/src/wheel/cli/tags.py 2023-03-14 15:38:44.000000000 +0100 +++ new/wheel-0.41.2/src/wheel/cli/tags.py 2023-08-22 11:29:26.000000000 +0200 @@ -27,7 +27,7 @@ python_tags: str | None = None, abi_tags: str | None = None, platform_tags: str | None = None, - build_number: int | None = None, + build_tag: str | None = None, remove: bool = False, ) -> str: """Change the tags on a wheel file. @@ -41,7 +41,7 @@ :param python_tags: The Python tags to set :param abi_tags: The ABI tags to set :param platform_tags: The platform tags to set - :param build_number: The build number to set + :param build_tag: The build tag to set :param remove: Remove the original wheel """ with WheelFile(wheel, "r") as f: @@ -56,7 +56,7 @@ original_abi_tags = f.parsed_filename.group("abi").split(".") original_plat_tags = f.parsed_filename.group("plat").split(".") - tags, existing_build_number = read_tags(wheel_info) + tags, existing_build_tag = read_tags(wheel_info) impls = {tag.split("-")[0] for tag in tags} abivers = {tag.split("-")[1] for tag in tags} @@ -76,16 +76,16 @@ ) raise AssertionError(msg) - if existing_build_number != build: + if existing_build_tag != build: msg = ( f"Incorrect filename '{build}' " - "& *.dist-info/WHEEL '{existing_build_number}' build numbers" + f"& *.dist-info/WHEEL '{existing_build_tag}' build numbers" ) raise AssertionError(msg) # Start changing as needed - if build_number is not None: - build = str(build_number) + if build_tag is not None: + build = build_tag final_python_tags = sorted(_compute_tags(original_python_tags, python_tags)) final_abi_tags = sorted(_compute_tags(original_abi_tags, abi_tags)) @@ -120,6 +120,8 @@ ) as fout: fout.comment = fin.comment # preserve the comment for item in fin.infolist(): + if item.is_dir(): + continue if item.filename == f.dist_info_path + "/RECORD": continue if item.filename == f.dist_info_path + "/WHEEL": diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wheel-0.40.0/src/wheel/metadata.py new/wheel-0.41.2/src/wheel/metadata.py --- old/wheel-0.40.0/src/wheel/metadata.py 2023-03-14 15:38:44.000000000 +0100 +++ new/wheel-0.41.2/src/wheel/metadata.py 2023-08-22 11:29:26.000000000 +0200 @@ -92,7 +92,7 @@ requires_dist.append(spec.operator + spec.version) if requires_dist: - return " (" + ",".join(sorted(requires_dist)) + ")" + return " " + ",".join(sorted(requires_dist)) else: return "" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wheel-0.40.0/src/wheel/wheelfile.py new/wheel-0.41.2/src/wheel/wheelfile.py --- old/wheel-0.40.0/src/wheel/wheelfile.py 2023-03-14 15:38:44.000000000 +0100 +++ new/wheel-0.41.2/src/wheel/wheelfile.py 2023-08-22 11:29:26.000000000 +0200 @@ -6,7 +6,6 @@ import re import stat import time -from collections import OrderedDict from io import StringIO, TextIOWrapper from zipfile import ZIP_DEFLATED, ZipFile, ZipInfo @@ -50,7 +49,7 @@ self.parsed_filename.group("namever") ) self.record_path = self.dist_info_path + "/RECORD" - self._file_hashes = OrderedDict() + self._file_hashes = {} self._file_sizes = {} if mode == "r": # Ignore RECORD and any embedded wheel signatures @@ -62,7 +61,7 @@ try: record = self.open(self.record_path) except KeyError: - raise WheelError(f"Missing {self.record_path} file") + raise WheelError(f"Missing {self.record_path} file") from None with record: for line in csv.reader( @@ -76,7 +75,9 @@ try: hashlib.new(algorithm) except ValueError: - raise WheelError(f"Unsupported hash algorithm: {algorithm}") + raise WheelError( + f"Unsupported hash algorithm: {algorithm}" + ) from None if algorithm.lower() in {"md5", "sha1"}: raise WheelError( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wheel-0.40.0/tests/cli/test_tags.py new/wheel-0.41.2/tests/cli/test_tags.py --- old/wheel-0.40.0/tests/cli/test_tags.py 2023-03-14 15:38:44.000000000 +0100 +++ new/wheel-0.41.2/tests/cli/test_tags.py 2023-08-22 11:29:26.000000000 +0200 @@ -1,12 +1,13 @@ from __future__ import annotations import shutil +import sys from pathlib import Path from zipfile import ZipFile import pytest -from wheel.cli import parser +from wheel.cli import main, parser from wheel.cli.tags import tags from wheel.wheelfile import WheelFile @@ -110,20 +111,37 @@ assert TESTWHEEL_NAME == newname -def test_build_number(wheelpath): - newname = tags(str(wheelpath), build_number=1) - assert TESTWHEEL_NAME.replace("-py2", "-1-py2") == newname +def test_build_tag(wheelpath): + newname = tags(str(wheelpath), build_tag="1bah") + assert TESTWHEEL_NAME.replace("-py2", "-1bah-py2") == newname output_file = wheelpath.parent / newname assert output_file.exists() output_file.unlink() [email protected]( + "build_tag, error", + [ + pytest.param("foo", "build tag must begin with a digit", id="digitstart"), + pytest.param("1-f", "invalid character ('-') in build tag", id="hyphen"), + ], +) +def test_invalid_build_tag(wheelpath, build_tag, error, monkeypatch, capsys): + monkeypatch.setattr(sys, "argv", [sys.argv[0], "tags", "--build", build_tag]) + with pytest.raises(SystemExit) as exc: + main() + + _, err = capsys.readouterr() + assert exc.value.args[0] == 2 + assert f"error: argument --build: {error}" in err + + def test_multi_tags(wheelpath): newname = tags( str(wheelpath), platform_tags="linux_x86_64", python_tags="+py4", - build_number=1, + build_tag="1", ) assert "test-1.0-1-py2.py3.py4-none-linux_x86_64.whl" == newname @@ -204,11 +222,17 @@ with ZipFile(str(output_file), "r") as outf: with ZipFile(str(wheelpath), "r") as inf: for member in inf.namelist(): - if not member.endswith("/RECORD"): - out_attr = outf.getinfo(member).external_attr - inf_attr = inf.getinfo(member).external_attr - assert ( - out_attr == inf_attr - ), f"{member} 0x{out_attr:012o} != 0x{inf_attr:012o}" + member_info = inf.getinfo(member) + if member_info.is_dir(): + continue + + if member_info.filename.endswith("/RECORD"): + continue + + out_attr = outf.getinfo(member).external_attr + inf_attr = member_info.external_attr + assert ( + out_attr == inf_attr + ), f"{member} 0x{out_attr:012o} != 0x{inf_attr:012o}" output_file.unlink() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wheel-0.40.0/tests/test_bdist_wheel.py new/wheel-0.41.2/tests/test_bdist_wheel.py --- old/wheel-0.40.0/tests/test_bdist_wheel.py 2023-03-14 15:38:44.000000000 +0100 +++ new/wheel-0.41.2/tests/test_bdist_wheel.py 2023-08-22 11:29:26.000000000 +0200 @@ -3,14 +3,23 @@ import os.path import shutil import stat +import struct import subprocess import sys import sysconfig +from inspect import cleandoc +from unittest.mock import Mock from zipfile import ZipFile import pytest +import setuptools -from wheel.bdist_wheel import bdist_wheel, get_abi_tag +from wheel.bdist_wheel import ( + bdist_wheel, + get_abi_tag, + remove_readonly, + remove_readonly_exc, +) from wheel.vendored.packaging import tags from wheel.wheelfile import WheelFile @@ -278,21 +287,131 @@ ) -def test_get_abi_tag_old(monkeypatch): +def test_get_abi_tag_pypy_old(monkeypatch): monkeypatch.setattr(tags, "interpreter_name", lambda: "pp") monkeypatch.setattr(sysconfig, "get_config_var", lambda x: "pypy36-pp73") assert get_abi_tag() == "pypy36_pp73" -def test_get_abi_tag_new(monkeypatch): +def test_get_abi_tag_pypy_new(monkeypatch): monkeypatch.setattr(sysconfig, "get_config_var", lambda x: "pypy37-pp73-darwin") monkeypatch.setattr(tags, "interpreter_name", lambda: "pp") assert get_abi_tag() == "pypy37_pp73" +def test_get_abi_tag_graalpy(monkeypatch): + monkeypatch.setattr( + sysconfig, "get_config_var", lambda x: "graalpy231-310-native-x86_64-linux" + ) + monkeypatch.setattr(tags, "interpreter_name", lambda: "graalpy") + assert get_abi_tag() == "graalpy231_310_native" + + +def test_get_abi_tag_fallback(monkeypatch): + monkeypatch.setattr(sysconfig, "get_config_var", lambda x: "unknown-python-310") + monkeypatch.setattr(tags, "interpreter_name", lambda: "unknown-python") + assert get_abi_tag() == "unknown_python_310" + + def test_platform_with_space(dummy_dist, monkeypatch): """Ensure building on platforms with a space in the name succeed.""" monkeypatch.chdir(dummy_dist) subprocess.check_call( [sys.executable, "setup.py", "bdist_wheel", "--plat-name", "isilon onefs"] ) + + +def test_rmtree_readonly(monkeypatch, tmp_path, capsys): + """Verify onerr works as expected""" + + bdist_dir = tmp_path / "with_readonly" + bdist_dir.mkdir() + some_file = bdist_dir.joinpath("file.txt") + some_file.touch() + some_file.chmod(stat.S_IREAD) + + expected_count = 1 if sys.platform.startswith("win") else 0 + + if sys.version_info < (3, 12): + count_remove_readonly = Mock(side_effect=remove_readonly) + shutil.rmtree(bdist_dir, onerror=count_remove_readonly) + assert count_remove_readonly.call_count == expected_count + else: + count_remove_readonly_exc = Mock(side_effect=remove_readonly_exc) + shutil.rmtree(bdist_dir, onexc=count_remove_readonly_exc) + assert count_remove_readonly_exc.call_count == expected_count + + assert not bdist_dir.is_dir() + + if expected_count: + captured = capsys.readouterr() + assert "file.txt" in captured.stdout + + +def test_data_dir_with_tag_build(monkeypatch, tmp_path): + """ + Setuptools allow authors to set PEP 440's local version segments + using ``egg_info.tag_build``. This should be reflected not only in the + ``.whl`` file name, but also in the ``.dist-info`` and ``.data`` dirs. + See pypa/setuptools#3997. + """ + monkeypatch.chdir(tmp_path) + files = { + "setup.py": """ + from setuptools import setup + setup(headers=["hello.h"]) + """, + "setup.cfg": """ + [metadata] + name = test + version = 1.0 + + [options.data_files] + hello/world = file.txt + + [egg_info] + tag_build = +what + tag_date = 0 + """, + "file.txt": "", + "hello.h": "", + } + for file, content in files.items(): + with open(file, "w", encoding="utf-8") as fh: + fh.write(cleandoc(content)) + + subprocess.check_call([sys.executable, "setup.py", "bdist_wheel"]) + + # Ensure .whl, .dist-info and .data contain the local segment + wheel_path = "dist/test-1.0+what-py3-none-any.whl" + assert os.path.exists(wheel_path) + entries = set(ZipFile(wheel_path).namelist()) + for expected in ( + "test-1.0+what.data/headers/hello.h", + "test-1.0+what.data/data/hello/world/file.txt", + "test-1.0+what.dist-info/METADATA", + "test-1.0+what.dist-info/WHEEL", + ): + assert expected in entries + + for not_expected in ( + "test.data/headers/hello.h", + "test-1.0.data/data/hello/world/file.txt", + "test.dist-info/METADATA", + "test-1.0.dist-info/WHEEL", + ): + assert not_expected not in entries + + [email protected]( + "reported,expected", + [("linux-x86_64", "linux_i686"), ("linux-aarch64", "linux_armv7l")], +) +def test_platform_linux32(reported, expected, monkeypatch): + monkeypatch.setattr(struct, "calcsize", lambda x: 4) + dist = setuptools.Distribution() + cmd = bdist_wheel(dist) + cmd.plat_name = reported + cmd.root_is_pure = False + _, _, actual = cmd.get_tag() + assert actual == expected diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wheel-0.40.0/tests/test_macosx_libfile.py new/wheel-0.41.2/tests/test_macosx_libfile.py --- old/wheel-0.40.0/tests/test_macosx_libfile.py 2023-03-14 15:38:44.000000000 +0100 +++ new/wheel-0.41.2/tests/test_macosx_libfile.py 2023-08-22 11:29:26.000000000 +0200 @@ -1,9 +1,11 @@ from __future__ import annotations import os -import sys +import struct import sysconfig +import pytest + from wheel.bdist_wheel import get_platform from wheel.macosx_libfile import extract_macosx_min_system_version @@ -214,7 +216,11 @@ assert get_platform(dylib_dir) == "macosx_11_0_x86_64" -def test_get_platform_linux(monkeypatch): - monkeypatch.setattr(sysconfig, "get_platform", return_factory("linux-x86_64")) - monkeypatch.setattr(sys, "maxsize", 2147483647) - assert get_platform(None) == "linux_i686" [email protected]( + "reported,expected", + [("linux-x86_64", "linux_i686"), ("linux-aarch64", "linux_armv7l")], +) +def test_get_platform_linux32(reported, expected, monkeypatch): + monkeypatch.setattr(sysconfig, "get_platform", return_factory(reported)) + monkeypatch.setattr(struct, "calcsize", lambda x: 4) + assert get_platform(None) == expected diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wheel-0.40.0/tests/test_metadata.py new/wheel-0.41.2/tests/test_metadata.py --- old/wheel-0.40.0/tests/test_metadata.py 2023-03-14 15:38:44.000000000 +0100 +++ new/wheel-0.41.2/tests/test_metadata.py 2023-08-22 11:29:26.000000000 +0200 @@ -22,11 +22,11 @@ ("Provides-Extra", "faster-signatures"), ("Requires-Dist", "ed25519ll ; extra == 'faster-signatures'"), ("Provides-Extra", "rest"), - ("Requires-Dist", "docutils (>=0.8) ; extra == 'rest'"), + ("Requires-Dist", "docutils >=0.8 ; extra == 'rest'"), ("Requires-Dist", "keyring ; extra == 'signatures'"), ("Requires-Dist", "keyrings.alt ; extra == 'signatures'"), ("Provides-Extra", "test"), - ("Requires-Dist", "pytest (>=3.0.0) ; extra == 'test'"), + ("Requires-Dist", "pytest >=3.0.0 ; extra == 'test'"), ("Requires-Dist", "pytest-cov ; extra == 'test'"), ]
