Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-build for openSUSE:Factory checked in at 2023-03-31 21:14:04 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-build (Old) and /work/SRC/openSUSE:Factory/.python-build.new.31432 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-build" Fri Mar 31 21:14:04 2023 rev:7 rq:1073633 version:0.10.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-build/python-build.changes 2023-01-03 15:04:17.810135671 +0100 +++ /work/SRC/openSUSE:Factory/.python-build.new.31432/python-build.changes 2023-03-31 21:14:09.326079246 +0200 @@ -1,0 +2,13 @@ +Tue Mar 21 19:16:14 UTC 2023 - Ben Greiner <c...@bnavigator.de> + +- Update to 0.10.0 + * Replace pep517 dependency with pyproject_hooks, into which + pep517 has been renamed (PR #539, Fixes #529) + * Change build backend from setuptools to flit (PR #470, Fixes + #394) + * Dropped support for Python 3.6 (PR #532) +- Avoid namespace clashes with build/ directory + * gh#openSUSE/python-rpm-macros#157 +- Drop build-pr550-packaging22.patch + +------------------------------------------------------------------- Old: ---- build-0.9.0.tar.gz build-pr550-packaging22.patch flit_core-2.3.0-py2.py3-none-any.whl pytoml-0.1.21-py2.py3-none-any.whl New: ---- build-0.10.0.tar.gz flit_core-3.8.0-py3-none-any.whl ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-build.spec ++++++ --- /var/tmp/diff_new_pack.OeTu0n/_old 2023-03-31 21:14:10.078081927 +0200 +++ /var/tmp/diff_new_pack.OeTu0n/_new 2023-03-31 21:14:10.082081942 +0200 @@ -24,35 +24,30 @@ %define psuffix %{nil} %bcond_with test %endif +# wheeldir of name build does not work well with this packagename gh#openSUSE/python-rpm-macros#157 +%define _pyproject_wheeldir distwheel -%define skip_python2 1 Name: python-build%{psuffix} -Version: 0.9.0 +Version: 0.10.0 Release: 0 Summary: Simple PEP517 package builder License: MIT Group: Development/Languages/Python URL: https://github.com/pypa/build Source0: https://github.com/pypa/build/archive/%{version}.tar.gz#/build-%{version}.tar.gz -# Needs the wheels for wheel, flit-core (<3), pytoml, and tomli for testing +# Needs the wheels for wheel, flit-core, pytoml, and tomli for testing Source10: https://files.pythonhosted.org/packages/py2.py3/w/wheel/wheel-0.37.1-py2.py3-none-any.whl -Source11: https://files.pythonhosted.org/packages/py2.py3/f/flit-core/flit_core-2.3.0-py2.py3-none-any.whl -Source12: https://files.pythonhosted.org/packages/py2.py3/p/pytoml/pytoml-0.1.21-py2.py3-none-any.whl -Source13: https://files.pythonhosted.org/packages/py3/t/tomli/tomli-2.0.1-py3-none-any.whl -# PATCH-FIX-UPSTREAM build-pr550-packaging22.patch gh#pypa/build#550 -Patch1: https://github.com/pypa/build/pull/550.patch#/build-pr550-packaging22.patch -BuildRequires: %{python_module base >= 3.6} -BuildRequires: %{python_module importlib-metadata >= 0.22 if %python-base < 3.8} -BuildRequires: %{python_module packaging >= 19.0} -BuildRequires: %{python_module pep517 >= 0.9.1} -BuildRequires: %{python_module setuptools >= 42} -BuildRequires: %{python_module tomli >= 1.0.0 if %python-base < 3.11} +Source11: https://files.pythonhosted.org/packages/py3/f/flit-core/flit_core-3.8.0-py3-none-any.whl +Source12: https://files.pythonhosted.org/packages/py3/t/tomli/tomli-2.0.1-py3-none-any.whl +BuildRequires: %{python_module base >= 3.7} +BuildRequires: %{python_module flit-core >= 3.4} +BuildRequires: %{python_module pip} BuildRequires: fdupes BuildRequires: python-rpm-macros Requires: python-packaging >= 0.19.0 -Requires: python-pep517 >= 0.9.1 +Requires: python-pyproject-hooks Requires: (python-importlib-metadata >= 0.22 if python-base < 3.8) -Requires: (python-tomli if python-base < 3.11) +Requires: (python-tomli >= 1.1.0 if python-base < 3.11) Recommends: python-virtualenv >= 20.0.35 Requires(post): update-alternatives Requires(postun):update-alternatives @@ -64,6 +59,8 @@ BuildRequires: %{python_module pytest-mock >= 2} BuildRequires: %{python_module pytest-rerunfailures >= 9.1} BuildRequires: %{python_module pytest-xdist >= 1.34} +BuildRequires: %{python_module setuptools >= 42 if %python-base < 3.10} +BuildRequires: %{python_module setuptools >= 56 if %python-base >= 3.11} BuildRequires: %{python_module toml >= 0.10.0} BuildRequires: %{python_module wheel >= 0.36} BuildRequires: python3-setuptools-wheel @@ -79,10 +76,10 @@ %if !%{with test} %build -%python_build +%pyproject_wheel %install -%python_install +%pyproject_install %python_clone -a %{buildroot}%{_bindir}/pyproject-build %python_expand %fdupes %{buildroot}%{$python_sitelib} %endif @@ -90,9 +87,11 @@ %if %{with test} %check mkdir -p wheels -cp %{SOURCE10} %{SOURCE11} %{SOURCE12} %{SOURCE13} wheels/ +cp %{SOURCE10} %{SOURCE11} %{SOURCE12} wheels/ export PIP_FIND_LINKS="%{python3_sitelib}/../wheels $PWD/wheels" -%pytest tests -n auto +pushd tests +%pytest -n auto -x +popd %endif %if !%{with test} ++++++ build-0.9.0.tar.gz -> build-0.10.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/build-0.9.0/.github/workflows/check.yml new/build-0.10.0/.github/workflows/check.yml --- old/build-0.9.0/.github/workflows/check.yml 2022-10-27 12:42:48.000000000 +0200 +++ new/build-0.10.0/.github/workflows/check.yml 2023-01-11 21:31:00.000000000 +0100 @@ -18,10 +18,10 @@ steps: - uses: actions/checkout@v3 - - name: Setup Python 3.9 + - name: Setup Python 3.10 uses: actions/setup-python@v4 with: - python-version: 3.9 + python-version: "3.10" - name: Install tox run: python -m pip install tox diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/build-0.9.0/.github/workflows/test.yml new/build-0.10.0/.github/workflows/test.yml --- old/build-0.9.0/.github/workflows/test.yml 2022-10-27 12:42:48.000000000 +0200 +++ new/build-0.10.0/.github/workflows/test.yml 2023-01-11 21:31:00.000000000 +0100 @@ -41,11 +41,20 @@ - "3.9" - "3.8" - "3.7" - - "3.6" tox-target: - "tox" - "min" + continue-on-error: >- # jobs not required in branch protection + ${{ + ( + startsWith(matrix.py, 'pypy-') + && (!endsWith(matrix.py, '-3.7') || matrix.os == 'windows') + ) + && true + || false + }} + steps: - uses: actions/checkout@v3 with: @@ -129,3 +138,19 @@ - name: Run check for type run: tox -e type --skip-pkg-install + + # https://github.com/marketplace/actions/alls-green#why + required-checks-pass: # This job does nothing and is only used for the branch protection + if: always() + + needs: + - pytest + - type + + runs-on: ubuntu-latest + + steps: + - name: Decide whether the needed jobs succeeded or failed + uses: re-actors/alls-green@release/v1 + with: + jobs: ${{ toJSON(needs) }} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/build-0.9.0/.pre-commit-config.yaml new/build-0.10.0/.pre-commit-config.yaml --- old/build-0.9.0/.pre-commit-config.yaml 2022-10-27 12:42:48.000000000 +0200 +++ new/build-0.10.0/.pre-commit-config.yaml 2023-01-11 21:31:00.000000000 +0100 @@ -4,7 +4,7 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.3.0 + rev: v4.4.0 hooks: - id: check-ast - id: check-builtin-literals @@ -17,13 +17,17 @@ - id: end-of-file-fixer - id: trailing-whitespace - id: double-quote-string-fixer + - repo: https://github.com/abravalheri/validate-pyproject + rev: v0.10.1 + hooks: + - id: validate-pyproject - repo: https://github.com/asottile/pyupgrade - rev: v3.1.0 + rev: v3.3.1 hooks: - id: pyupgrade - args: ["--py36-plus"] + args: ["--py37-plus"] - repo: https://github.com/psf/black - rev: 22.10.0 + rev: 22.12.0 hooks: - id: black - repo: https://github.com/asottile/blacken-docs @@ -32,20 +36,15 @@ - id: blacken-docs additional_dependencies: [black==22.6] - repo: https://github.com/pre-commit/mirrors-prettier - rev: "v3.0.0-alpha.2" + rev: "v3.0.0-alpha.4" hooks: - id: prettier - repo: https://github.com/PyCQA/isort - rev: 5.10.1 + rev: 5.11.4 hooks: - id: isort - - repo: https://github.com/asottile/setup-cfg-fmt - rev: v2.1.0 - hooks: - - id: setup-cfg-fmt - args: [--include-version-classifiers, --max-py-version=3.11] - repo: https://github.com/PyCQA/flake8 - rev: "5.0.4" + rev: "6.0.0" hooks: - id: flake8 additional_dependencies: ["flake8-bugbear==22.7.1"] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/build-0.9.0/CHANGELOG.rst new/build-0.10.0/CHANGELOG.rst --- old/build-0.9.0/CHANGELOG.rst 2022-10-27 12:42:48.000000000 +0200 +++ new/build-0.10.0/CHANGELOG.rst 2023-01-11 21:31:00.000000000 +0100 @@ -3,6 +3,23 @@ +++++++++ +0.10.0 (2023-01-11) +=================== + +- Replace ``pep517`` dependency with ``pyproject_hooks``, + into which ``pep517`` has been renamed + (`PR #539`_, Fixes `#529`_) +- Change build backend from ``setuptools`` to ``flit`` + (`PR #470`_, Fixes `#394`_) +- Dropped support for Python 3.6 (`PR #532`_) + +.. _PR #470: https://github.com/pypa/build/pull/470 +.. _PR #532: https://github.com/pypa/build/pull/532 +.. _#394: https://github.com/pypa/build/issues/394 +.. _PR #539: https://github.com/pypa/build/pull/539 +.. _#529: https://github.com/pypa/build/issues/529 + + 0.9.0 (2022-10-27) ================== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/build-0.9.0/README.md new/build-0.10.0/README.md --- old/build-0.9.0/README.md 2022-10-27 12:42:48.000000000 +0200 +++ new/build-0.10.0/README.md 2023-01-11 21:31:00.000000000 +0100 @@ -9,7 +9,7 @@ [](https://pypi.org/project/build/) [](https://discord.gg/pypa) -A simple, correct PEP 517 build frontend. +A simple, correct Python build frontend. See the [documentation](https://pypa-build.readthedocs.io/en/latest/) for more information. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/build-0.9.0/docs/conf.py new/build-0.10.0/docs/conf.py --- old/build-0.9.0/docs/conf.py 2022-10-27 12:42:48.000000000 +0200 +++ new/build-0.10.0/docs/conf.py 2023-01-11 21:31:00.000000000 +0100 @@ -65,3 +65,8 @@ # html_static_path = ['_static'] autoclass_content = 'both' + +nitpick_ignore = [ + # https://github.com/python/importlib_metadata/issues/316 + ('py:class', 'importlib.metadata._meta.PackageMetadata'), +] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/build-0.9.0/docs/index.rst new/build-0.10.0/docs/index.rst --- old/build-0.9.0/docs/index.rst 2022-10-27 12:42:48.000000000 +0200 +++ new/build-0.10.0/docs/index.rst 2023-01-11 21:31:00.000000000 +0100 @@ -43,6 +43,7 @@ :hidden: test_suite + release .. toctree:: :caption: Project Links diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/build-0.9.0/docs/installation.rst new/build-0.10.0/docs/installation.rst --- old/build-0.9.0/docs/installation.rst 2022-10-27 12:42:48.000000000 +0200 +++ new/build-0.10.0/docs/installation.rst 2023-01-11 21:31:00.000000000 +0100 @@ -47,13 +47,11 @@ ``build`` is verified to be compatible with the following Python versions: -- 2.7 -- 3.5 -- 3.6 - 3.7 - 3.8 - 3.9 -- PyPy(2) +- 3.10 +- 3.11 - PyPy3 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/build-0.9.0/docs/release.rst new/build-0.10.0/docs/release.rst --- old/build-0.9.0/docs/release.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/build-0.10.0/docs/release.rst 2023-01-11 21:31:00.000000000 +0100 @@ -0,0 +1,30 @@ +*************** +Release Process +*************** + +As this project is critical to the Python ecosystem's supply chain security, all +releases are PGP signed with one of the keys listed in the `installation page`_. +Before releasing please make sure your PGP key is listed there, and preferably +signed by one of the other key holders. If your key is not signed by one of the +other key holders, please make sure the PR that added your key to the +`installation page`_ was approved by at least one other maintainer. + +After that is done, you may release the project by following these steps: + +#. Bump the versions in ``pyproject.toml`` and ``src/build/__init__.py`` +#. Update ``CHANGELOG.rst`` with the new version and current date +#. Make a release commit with the changes made above + - The commit message should follow the ``release X.Y.Z`` format +#. Make a signed tag (``git tag -s X.Y.Z``) + - The tag title should follow the ``build X.Y.Z`` format + - The tag body should be a plaintext version of the changelog for the current + release +#. Push the commit and tag to the repository (``git push`` and ``git push --tags``) +#. Build the Python artifacts (``python -m build``) +#. Sign and push the artifacts to PyPI (``twine upload -s dist/*``) + +If you have any questions, please look at previous releases and/or ping the +other maintainers. + + +.. _installation page: installation diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/build-0.9.0/pyproject.toml new/build-0.10.0/pyproject.toml --- old/build-0.9.0/pyproject.toml 2022-10-27 12:42:48.000000000 +0200 +++ new/build-0.10.0/pyproject.toml 2023-01-11 21:31:00.000000000 +0100 @@ -1,6 +1,79 @@ [build-system] -requires = ["setuptools >=42.0"] -build-backend = "setuptools.build_meta" +requires = ["flit-core >= 3.4"] +build-backend = "flit_core.buildapi" + +[project] +name = "build" +version = "0.10.0" +description = "A simple, correct Python build frontend" +readme = "README.md" +requires-python = ">= 3.7" +license.file = "LICENSE" +authors = [ + { name = "Filipe LaÃns", email = "la...@riseup.net" }, + { name = "Bernát Gábor", email = "gaborjber...@gmail.com" }, + { name = "layday", email = "lay...@protonmail.com" }, + { name = "Henry Schreiner", email = "henryschreiner...@gmail.com" }, +] +classifiers = [ + "License :: OSI Approved :: MIT License", + "Programming Language :: Python :: 3", + "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", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", +] +urls.homepage = "https://github.com/pypa/build" +urls.changelog = "https://pypa-build.readthedocs.io/en/stable/changelog.html" + +dependencies = [ + "packaging >= 19.0", + "pyproject_hooks", + # not actually a runtime dependency, only supplied as there is not "recommended dependency" support + 'colorama; os_name == "nt"', + 'importlib-metadata >= 0.22; python_version < "3.8"', + # toml can be used instead -- in case it makes bootstrapping easier + 'tomli >= 1.1.0; python_version < "3.11"', +] + +[project.optional-dependencies] +docs = [ + "furo >= 2021.08.31", + "sphinx ~= 4.0", + "sphinx-argparse-cli >= 1.5", + "sphinx-autodoc-typehints >= 1.10", +] +test = [ + "filelock >= 3", + "pytest >= 6.2.4", + "pytest-cov >= 2.12", + "pytest-mock >= 2", + "pytest-rerunfailures >= 9.1", + "pytest-xdist >= 1.34", + "toml >= 0.10.0", + "wheel >= 0.36.0", + 'setuptools >= 42.0.0; python_version < "3.10"', + 'setuptools >= 56.0.0; python_version >= "3.10"', +] +typing = [ + "importlib-metadata >= 5.1", + "mypy == 0.991", + "tomli", + "typing-extensions >= 3.7.4.3", +] +virtualenv = [ + "virtualenv >= 20.0.35", +] + +[project.scripts] +pyproject-build = "build.__main__:entrypoint" + +[project.entry-points."pipx.run"] +build = "build.__main__:entrypoint" [tool.coverage.run] source = [ @@ -44,16 +117,15 @@ [tool.mypy] files = "src" -python_version = "3.6" +python_version = "3.7" strict = true show_error_codes = true enable_error_code = ["ignore-without-code", "truthy-bool", "redundant-expr"] - [[tool.mypy.overrides]] module = [ "colorama", # Optional dependency - "pep517.*", # Untyped + "pyproject_hooks.*", # Untyped "virtualenv", # Optional dependency ] ignore_missing_imports = true @@ -61,7 +133,7 @@ [tool.black] line-length = 127 skip-string-normalization = true -target-version = ["py39", "py38", "py37", "py36"] +target-version = ["py311", "py310", "py39", "py38", "py37"] [tool.isort] profile = "black" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/build-0.9.0/setup.cfg new/build-0.10.0/setup.cfg --- old/build-0.9.0/setup.cfg 2022-10-27 12:42:48.000000000 +0200 +++ new/build-0.10.0/setup.cfg 1970-01-01 01:00:00.000000000 +0100 @@ -1,74 +0,0 @@ -[metadata] -name = build -version = 0.9.0 -description = A simple, correct PEP 517 build frontend -long_description = file: README.md -long_description_content_type = text/markdown -author = Filipe LaÃns -author_email = la...@riseup.net -license = MIT -license_file = LICENSE -classifiers = - License :: OSI Approved :: MIT License - Programming Language :: Python :: 3 - Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.6 - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Programming Language :: Python :: 3.11 - Programming Language :: Python :: Implementation :: CPython - Programming Language :: Python :: Implementation :: PyPy -project_urls = - homepage = https://github.com/pypa/build - changelog = https://pypa-build.readthedocs.io/en/stable/changelog.html - -[options] -packages = find: -install_requires = - packaging>=19.0 - pep517>=0.9.1 - colorama;os_name == "nt" # not actually a runtime dependency, only supplied as there is not "recommended dependency" support - importlib-metadata>=0.22;python_version < "3.8" - tomli>=1.0.0;python_version < "3.11" # toml can be used instead -- in case it makes bootstrapping easier -python_requires = >=3.6 -package_dir = - =src - -[options.packages.find] -where = src - -[options.entry_points] -console_scripts = - pyproject-build = build.__main__:entrypoint -pipx.run = - build = build.__main__:entrypoint - -[options.extras_require] -docs = - furo>=2021.08.31 - sphinx~=4.0 - sphinx-argparse-cli>=1.5 - sphinx-autodoc-typehints>=1.10 -test = - filelock>=3 - pytest>=6.2.4 - pytest-cov>=2.12 - pytest-mock>=2 - pytest-rerunfailures>=9.1 - pytest-xdist>=1.34 - toml>=0.10.0 - wheel>=0.36.0 - setuptools>=42.0.0;python_version < "3.10" - setuptools>=56.0.0;python_version >= "3.10" -typing = - importlib-metadata>=4.6.4 - mypy==0.950 - typing-extensions>=3.7.4.3;python_version < "3.8" -virtualenv = - virtualenv>=20.0.35 - -[options.package_data] -build = - py.typed diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/build-0.9.0/setup.py new/build-0.10.0/setup.py --- old/build-0.9.0/setup.py 2022-10-27 12:42:48.000000000 +0200 +++ new/build-0.10.0/setup.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,4 +0,0 @@ -from setuptools import setup - - -setup() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/build-0.9.0/src/build/__init__.py new/build-0.10.0/src/build/__init__.py --- old/build-0.9.0/src/build/__init__.py 2022-10-27 12:42:48.000000000 +0200 +++ new/build-0.10.0/src/build/__init__.py 2023-01-11 21:31:00.000000000 +0100 @@ -4,7 +4,10 @@ build - A simple, correct PEP 517 build frontend """ -__version__ = '0.9.0' +from __future__ import annotations + + +__version__ = '0.10.0' import contextlib import difflib @@ -19,27 +22,13 @@ import zipfile from collections import OrderedDict -from typing import ( - AbstractSet, - Any, - Callable, - Dict, - Iterator, - List, - Mapping, - MutableMapping, - Optional, - Sequence, - Set, - Tuple, - Type, - Union, -) +from collections.abc import Iterator, Set +from typing import Any, Callable, Mapping, MutableMapping, Optional, Sequence, Tuple, Type, Union -import pep517.wrappers +import pyproject_hooks -TOMLDecodeError: Type[Exception] +TOMLDecodeError: type[Exception] toml_loads: Callable[[str], MutableMapping[str, Any]] if sys.version_info >= (3, 11): @@ -88,7 +77,7 @@ """ def __init__( - self, exception: Exception, description: Optional[str] = None, exc_info: _ExcInfoType = (None, None, None) + self, exception: Exception, description: str | None = None, exc_info: _ExcInfoType = (None, None, None) ) -> None: super().__init__() self.exception = exception @@ -137,18 +126,6 @@ """ -@contextlib.contextmanager -def _working_directory(path: str) -> Iterator[None]: - current = os.getcwd() - - os.chdir(path) - - try: - yield - finally: - os.chdir(current) - - def _validate_source_directory(srcdir: PathType) -> None: if not os.path.isdir(srcdir): raise BuildException(f'Source {srcdir} is not a directory') @@ -159,8 +136,8 @@ def check_dependency( - req_string: str, ancestral_req_strings: Tuple[str, ...] = (), parent_extras: AbstractSet[str] = frozenset() -) -> Iterator[Tuple[str, ...]]: + req_string: str, ancestral_req_strings: tuple[str, ...] = (), parent_extras: Set[str] = frozenset() +) -> Iterator[tuple[str, ...]]: """ Verify that a dependency and all of its dependencies are met. @@ -217,7 +194,7 @@ ) -def _parse_build_system_table(pyproject_toml: Mapping[str, Any]) -> Dict[str, Any]: +def _parse_build_system_table(pyproject_toml: Mapping[str, Any]) -> dict[str, Any]: # If pyproject.toml is missing (per PEP 517) or [build-system] is missing # (per PEP 518), use default values if 'build-system' not in pyproject_toml: @@ -265,8 +242,8 @@ self, srcdir: PathType, python_executable: str = sys.executable, - scripts_dir: Optional[str] = None, - runner: RunnerType = pep517.wrappers.default_subprocess_runner, + scripts_dir: str | None = None, + runner: RunnerType = pyproject_hooks.default_subprocess_runner, ) -> None: """ :param srcdir: The source directory @@ -305,7 +282,7 @@ self._backend = self._build_system['build-backend'] self._scripts_dir = scripts_dir self._hook_runner = runner - self._hook = pep517.wrappers.Pep517HookCaller( + self._hook = pyproject_hooks.BuildBackendHookCaller( self.srcdir, self._backend, backend_path=self._build_system.get('backend-path'), @@ -313,12 +290,10 @@ runner=self._runner, ) - def _runner( - self, cmd: Sequence[str], cwd: Optional[str] = None, extra_environ: Optional[Mapping[str, str]] = None - ) -> None: + def _runner(self, cmd: Sequence[str], cwd: str | None = None, extra_environ: Mapping[str, str] | None = None) -> None: # if script dir is specified must be inserted at the start of PATH (avoid duplicate path while doing so) if self.scripts_dir is not None: - paths: Dict[str, None] = OrderedDict() + paths: dict[str, None] = OrderedDict() paths[str(self.scripts_dir)] = None if 'PATH' in os.environ: paths.update((i, None) for i in os.environ['PATH'].split(os.pathsep)) @@ -345,18 +320,18 @@ self._hook.python_executable = value @property - def scripts_dir(self) -> Optional[str]: + def scripts_dir(self) -> str | None: """ The folder where the scripts are stored for the python executable. """ return self._scripts_dir @scripts_dir.setter - def scripts_dir(self, value: Optional[str]) -> None: + def scripts_dir(self, value: str | None) -> None: self._scripts_dir = value @property - def build_system_requires(self) -> Set[str]: + def build_system_requires(self) -> set[str]: """ The dependencies defined in the ``pyproject.toml``'s ``build-system.requires`` field or the default build dependencies @@ -364,7 +339,7 @@ """ return set(self._build_system['requires']) - def get_requires_for_build(self, distribution: str, config_settings: Optional[ConfigSettingsType] = None) -> Set[str]: + def get_requires_for_build(self, distribution: str, config_settings: ConfigSettingsType | None = None) -> set[str]: """ Return the dependencies defined by the backend in addition to :attr:`build_system_requires` for a given distribution. @@ -380,9 +355,7 @@ with self._handle_backend(hook_name): return set(get_requires(config_settings)) - def check_dependencies( - self, distribution: str, config_settings: Optional[ConfigSettingsType] = None - ) -> Set[Tuple[str, ...]]: + def check_dependencies(self, distribution: str, config_settings: ConfigSettingsType | None = None) -> set[tuple[str, ...]]: """ Return the dependencies which are not satisfied from the combined set of :attr:`build_system_requires` and :meth:`get_requires_for_build` for a given @@ -396,8 +369,8 @@ return {u for d in dependencies for u in check_dependency(d)} def prepare( - self, distribution: str, output_directory: PathType, config_settings: Optional[ConfigSettingsType] = None - ) -> Optional[str]: + self, distribution: str, output_directory: PathType, config_settings: ConfigSettingsType | None = None + ) -> str | None: """ Prepare metadata for a distribution. @@ -415,7 +388,7 @@ _allow_fallback=False, ) except BuildBackendException as exception: - if isinstance(exception.exception, pep517.wrappers.HookMissing): + if isinstance(exception.exception, pyproject_hooks.HookMissing): return None raise @@ -423,8 +396,8 @@ self, distribution: str, output_directory: PathType, - config_settings: Optional[ConfigSettingsType] = None, - metadata_directory: Optional[str] = None, + config_settings: ConfigSettingsType | None = None, + metadata_directory: str | None = None, ) -> str: """ Build a distribution. @@ -470,7 +443,7 @@ return os.path.join(output_directory, distinfo) def _call_backend( - self, hook_name: str, outdir: PathType, config_settings: Optional[ConfigSettingsType] = None, **kwargs: Any + self, hook_name: str, outdir: PathType, config_settings: ConfigSettingsType | None = None, **kwargs: Any ) -> str: outdir = os.path.abspath(outdir) @@ -489,21 +462,20 @@ @contextlib.contextmanager def _handle_backend(self, hook: str) -> Iterator[None]: - with _working_directory(self.srcdir): - try: - yield - except pep517.wrappers.BackendUnavailable as exception: - raise BuildBackendException( # noqa: B904 # use raise from - exception, - f"Backend '{self._backend}' is not available.", - sys.exc_info(), - ) - except subprocess.CalledProcessError as exception: - raise BuildBackendException( # noqa: B904 # use raise from - exception, f'Backend subprocess exited when trying to invoke {hook}' - ) - except Exception as exception: - raise BuildBackendException(exception, exc_info=sys.exc_info()) # noqa: B904 # use raise from + try: + yield + except pyproject_hooks.BackendUnavailable as exception: + raise BuildBackendException( # noqa: B904 # use raise from + exception, + f"Backend '{self._backend}' is not available.", + sys.exc_info(), + ) + except subprocess.CalledProcessError as exception: + raise BuildBackendException( # noqa: B904 # use raise from + exception, f'Backend subprocess exited when trying to invoke {hook}' + ) + except Exception as exception: + raise BuildBackendException(exception, exc_info=sys.exc_info()) # noqa: B904 # use raise from @staticmethod def log(message: str) -> None: @@ -535,5 +507,5 @@ ] -def __dir__() -> List[str]: +def __dir__() -> list[str]: return __all__ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/build-0.9.0/src/build/__main__.py new/build-0.10.0/src/build/__main__.py --- old/build-0.9.0/src/build/__main__.py 2022-10-27 12:42:48.000000000 +0200 +++ new/build-0.10.0/src/build/__main__.py 2023-01-11 21:31:00.000000000 +0100 @@ -1,5 +1,6 @@ # SPDX-License-Identifier: MIT +from __future__ import annotations import argparse import contextlib @@ -14,7 +15,8 @@ import traceback import warnings -from typing import Dict, Iterator, List, NoReturn, Optional, Sequence, TextIO, Type, Union +from collections.abc import Iterator, Sequence +from typing import NoReturn, TextIO import build @@ -34,7 +36,7 @@ _NO_COLORS = {color: '' for color in _COLORS} -def _init_colors() -> Dict[str, str]: +def _init_colors() -> dict[str, str]: if 'NO_COLOR' in os.environ: if 'FORCE_COLOR' in os.environ: warnings.warn('Both NO_COLOR and FORCE_COLOR environment variables are set, disabling color') @@ -52,12 +54,12 @@ def _showwarning( - message: Union[Warning, str], - category: Type[Warning], + message: Warning | str, + category: type[Warning], filename: str, lineno: int, - file: Optional[TextIO] = None, - line: Optional[str] = None, + file: TextIO | None = None, + line: str | None = None, ) -> None: # pragma: no cover _cprint('{yellow}WARNING{reset} {}', str(message)) @@ -102,7 +104,7 @@ def _build_in_isolated_env( - builder: ProjectBuilder, outdir: PathType, distribution: str, config_settings: Optional[ConfigSettingsType] + builder: ProjectBuilder, outdir: PathType, distribution: str, config_settings: ConfigSettingsType | None ) -> str: with _IsolatedEnvBuilder() as env: builder.python_executable = env.executable @@ -118,7 +120,7 @@ builder: ProjectBuilder, outdir: PathType, distribution: str, - config_settings: Optional[ConfigSettingsType], + config_settings: ConfigSettingsType | None, skip_dependency_check: bool = False, ) -> str: if not skip_dependency_check: @@ -136,7 +138,7 @@ builder: ProjectBuilder, outdir: PathType, distribution: str, - config_settings: Optional[ConfigSettingsType], + config_settings: ConfigSettingsType | None, skip_dependency_check: bool, ) -> str: if isolation: @@ -186,7 +188,7 @@ srcdir: PathType, outdir: PathType, distributions: Sequence[str], - config_settings: Optional[ConfigSettingsType] = None, + config_settings: ConfigSettingsType | None = None, isolation: bool = True, skip_dependency_check: bool = False, ) -> Sequence[str]: @@ -200,7 +202,7 @@ :param isolation: Isolate the build in a separate environment :param skip_dependency_check: Do not perform the dependency check """ - built: List[str] = [] + built: list[str] = [] builder = _ProjectBuilder(srcdir) for distribution in distributions: out = _build(isolation, builder, outdir, distribution, config_settings, skip_dependency_check) @@ -212,7 +214,7 @@ srcdir: PathType, outdir: PathType, distributions: Sequence[str], - config_settings: Optional[ConfigSettingsType] = None, + config_settings: ConfigSettingsType | None = None, isolation: bool = True, skip_dependency_check: bool = False, ) -> Sequence[str]: @@ -234,7 +236,7 @@ sdist_name = os.path.basename(sdist) sdist_out = tempfile.mkdtemp(prefix='build-via-sdist-') - built: List[str] = [] + built: list[str] = [] # extract sdist with tarfile.open(sdist) as t: t.extractall(sdist_out) @@ -258,7 +260,7 @@ description=textwrap.indent( textwrap.dedent( ''' - A simple, correct PEP 517 build frontend. + A simple, correct Python build frontend. By default, a source distribution (sdist) is built from {srcdir} and a binary distribution (wheel) is built from the sdist. @@ -328,7 +330,7 @@ return parser -def main(cli_args: Sequence[str], prog: Optional[str] = None) -> None: # noqa: C901 +def main(cli_args: Sequence[str], prog: str | None = None) -> None: # noqa: C901 """ Parse the CLI arguments and invoke the build process. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/build-0.9.0/src/build/env.py new/build-0.10.0/src/build/env.py --- old/build-0.9.0/src/build/env.py 2022-10-27 12:42:48.000000000 +0200 +++ new/build-0.10.0/src/build/env.py 2023-01-11 21:31:00.000000000 +0100 @@ -1,6 +1,9 @@ """ Creates and manages isolated build environments. """ + +from __future__ import annotations + import abc import functools import logging @@ -13,8 +16,8 @@ import tempfile import warnings +from collections.abc import Callable, Collection from types import TracebackType -from typing import Callable, Collection, List, Optional, Tuple, Type import build @@ -67,7 +70,7 @@ ) -def _subprocess(cmd: List[str]) -> None: +def _subprocess(cmd: list[str]) -> None: """Invoke subprocess and output stdout and stderr if it fails.""" try: subprocess.run(cmd, check=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) @@ -80,7 +83,7 @@ """Builder object for isolated environments.""" def __init__(self) -> None: - self._path: Optional[str] = None + self._path: str | None = None def __enter__(self) -> IsolatedEnv: """ @@ -113,7 +116,7 @@ raise def __exit__( - self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType] + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> None: """ Delete the created isolated build environment. @@ -213,7 +216,7 @@ os.unlink(req_file.name) -def _create_isolated_env_virtualenv(path: str) -> Tuple[str, str]: +def _create_isolated_env_virtualenv(path: str) -> tuple[str, str]: """ We optionally can use the virtualenv package to provision a virtual environment. @@ -245,7 +248,7 @@ return False -def _create_isolated_env_venv(path: str) -> Tuple[str, str]: +def _create_isolated_env_venv(path: str) -> tuple[str, str]: """ On Python 3 we use the venv package from the standard library. @@ -293,7 +296,7 @@ return executable, script_dir -def _find_executable_and_scripts(path: str) -> Tuple[str, str, str]: +def _find_executable_and_scripts(path: str) -> tuple[str, str, str]: """ Detect the Python executable and script folder of a virtual environment. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/build-0.9.0/src/build/util.py new/build-0.10.0/src/build/util.py --- old/build-0.9.0/src/build/util.py 2022-10-27 12:42:48.000000000 +0200 +++ new/build-0.10.0/src/build/util.py 2023-01-11 21:31:00.000000000 +0100 @@ -1,11 +1,13 @@ # SPDX-License-Identifier: MIT +from __future__ import annotations + import os import pathlib import sys import tempfile -import pep517 +import pyproject_hooks import build import build.env @@ -17,17 +19,16 @@ import importlib_metadata -def _project_wheel_metadata(builder: build.ProjectBuilder) -> 'importlib_metadata.PackageMetadata': +def _project_wheel_metadata(builder: build.ProjectBuilder) -> importlib_metadata.PackageMetadata: with tempfile.TemporaryDirectory() as tmpdir: path = pathlib.Path(builder.metadata_path(tmpdir)) - # https://github.com/python/importlib_metadata/pull/343 - return importlib_metadata.PathDistribution(path).metadata # type: ignore[arg-type] + return importlib_metadata.PathDistribution(path).metadata def project_wheel_metadata( srcdir: build.PathType, isolated: bool = True, -) -> 'importlib_metadata.PackageMetadata': +) -> importlib_metadata.PackageMetadata: """ Return the wheel metadata for a project. @@ -41,7 +42,7 @@ """ builder = build.ProjectBuilder( os.fspath(srcdir), - runner=pep517.quiet_subprocess_runner, + runner=pyproject_hooks.quiet_subprocess_runner, ) if not isolated: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/build-0.9.0/tests/constraints.txt new/build-0.10.0/tests/constraints.txt --- old/build-0.9.0/tests/constraints.txt 2022-10-27 12:42:48.000000000 +0200 +++ new/build-0.10.0/tests/constraints.txt 2023-01-11 21:31:00.000000000 +0100 @@ -1,9 +1,9 @@ importlib-metadata==0.22 packaging==19.0 -pep517==0.9.1 +pyproject_hooks==1.0 setuptools==42.0.0; python_version < "3.10" setuptools==56.0.0; python_version >= "3.10" toml==0.10.0 -tomli==1.0.0 +tomli==1.1.0 virtualenv==20.0.35 wheel==0.36.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/build-0.9.0/tests/test_env.py new/build-0.10.0/tests/test_env.py --- old/build-0.9.0/tests/test_env.py 2022-10-27 12:42:48.000000000 +0200 +++ new/build-0.10.0/tests/test_env.py 2023-01-11 21:31:00.000000000 +0100 @@ -1,6 +1,5 @@ # SPDX-License-Identifier: MIT import collections -import inspect import logging import platform import subprocess @@ -106,7 +105,6 @@ caplog.set_level(logging.DEBUG) builder = build.env.IsolatedEnvBuilder() - frameinfo = inspect.getframeinfo(inspect.currentframe()) builder.log('something') # line number 106 with builder as env: env.install(['something']) @@ -116,20 +114,12 @@ ('INFO', 'Creating venv isolated environment...'), ('INFO', 'Installing packages in isolated environment... (something)'), ] - if sys.version_info >= (3, 8): # stacklevel - assert [(record.lineno) for record in caplog.records] == [ - frameinfo.lineno + 1, - frameinfo.lineno - 6, - frameinfo.lineno + 85, - ] @pytest.mark.isolated def test_default_pip_is_never_too_old(): with build.env.IsolatedEnvBuilder() as env: - version = subprocess.check_output( - [env.executable, '-c', 'import pip; print(pip.__version__)'], universal_newlines=True - ).strip() + version = subprocess.check_output([env.executable, '-c', 'import pip; print(pip.__version__)'], text=True).strip() assert Version(version) >= Version('19.1') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/build-0.9.0/tests/test_integration.py new/build-0.10.0/tests/test_integration.py --- old/build-0.9.0/tests/test_integration.py 2022-10-27 12:42:48.000000000 +0200 +++ new/build-0.10.0/tests/test_integration.py 2023-01-11 21:31:00.000000000 +0100 @@ -93,8 +93,8 @@ ) @pytest.mark.isolated def test_build(monkeypatch, project, args, call, tmp_path): - if project == 'flit' and '--no-isolation' in args: - pytest.xfail("can't build flit without isolation due to missing dependencies") + if project in {'build', 'flit'} and '--no-isolation' in args: + pytest.xfail(f"can't build {project} without isolation due to missing dependencies") if project == 'Solaar' and IS_WINDOWS and IS_PYPY3: pytest.xfail('Solaar fails building wheels via sdists on Windows on PyPy 3') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/build-0.9.0/tests/test_projectbuilder.py new/build-0.10.0/tests/test_projectbuilder.py --- old/build-0.9.0/tests/test_projectbuilder.py 2022-10-27 12:42:48.000000000 +0200 +++ new/build-0.10.0/tests/test_projectbuilder.py 2023-01-11 21:31:00.000000000 +0100 @@ -8,7 +8,7 @@ import sys import textwrap -import pep517.wrappers +import pyproject_hooks import pytest import build @@ -60,13 +60,13 @@ Metadata-Version: 2.2 Name: extras_dep Version: 1.0.0 - Provides-Extra: extra_without_associated_deps - Provides-Extra: extra_with_unmet_deps - Requires-Dist: unmet_dep; extra == 'extra_with_unmet_deps' - Provides-Extra: extra_with_met_deps - Requires-Dist: extras_dep; extra == 'extra_with_met_deps' - Provides-Extra: recursive_extra_with_unmet_deps - Requires-Dist: recursive_dep; extra == 'recursive_extra_with_unmet_deps' + Provides-Extra: extra-without-associated-deps + Provides-Extra: extra-with_unmet-deps + Requires-Dist: unmet_dep; extra == 'extra-with-unmet-deps' + Provides-Extra: extra-with-met-deps + Requires-Dist: extras_dep; extra == 'extra-with-met-deps' + Provides-Extra: recursive-extra-with-unmet-deps + Requires-Dist: recursive_dep; extra == 'recursive-extra-with-unmet-deps' """ ).strip() @@ -142,27 +142,27 @@ ('requireless_dep', None), ('extras_dep[undefined_extra]', None), # would the wheel builder filter this out? - ('extras_dep[extra_without_associated_deps]', None), + ('extras_dep[extra-without-associated-deps]', None), ( - 'extras_dep[extra_with_unmet_deps]', - ('extras_dep[extra_with_unmet_deps]', 'unmet_dep; extra == "extra_with_unmet_deps"'), + 'extras_dep[extra-with-unmet-deps]', + ('extras_dep[extra-with-unmet-deps]', 'unmet_dep; extra == "extra-with-unmet-deps"'), ), ( - 'extras_dep[recursive_extra_with_unmet_deps]', + 'extras_dep[recursive-extra-with-unmet-deps]', ( - 'extras_dep[recursive_extra_with_unmet_deps]', - 'recursive_dep; extra == "recursive_extra_with_unmet_deps"', + 'extras_dep[recursive-extra-with-unmet-deps]', + 'recursive_dep; extra == "recursive-extra-with-unmet-deps"', 'recursive_unmet_dep', ), ), - ('extras_dep[extra_with_met_deps]', None), + ('extras_dep[extra-with-met-deps]', None), ('missing_dep; python_version>"10"', None), ('missing_dep; python_version<="1"', None), ('missing_dep; python_version>="1"', ('missing_dep; python_version >= "1"',)), ('extras_dep == 1.0.0', None), ('extras_dep == 2.0.0', ('extras_dep==2.0.0',)), - ('extras_dep[extra_without_associated_deps] == 1.0.0', None), - ('extras_dep[extra_without_associated_deps] == 2.0.0', ('extras_dep[extra_without_associated_deps]==2.0.0',)), + ('extras_dep[extra-without-associated-deps] == 1.0.0', None), + ('extras_dep[extra-without-associated-deps] == 2.0.0', ('extras_dep[extra-without-associated-deps]==2.0.0',)), ('prerelease_dep >= 1.0.0', None), ('circular_dep', None), ], @@ -185,25 +185,25 @@ def test_init(mocker, package_test_flit, package_legacy, test_no_permission, package_test_bad_syntax): - mocker.patch('pep517.wrappers.Pep517HookCaller') + mocker.patch('pyproject_hooks.BuildBackendHookCaller') # correct flit pyproject.toml builder = build.ProjectBuilder(package_test_flit) - pep517.wrappers.Pep517HookCaller.assert_called_with( + pyproject_hooks.BuildBackendHookCaller.assert_called_with( package_test_flit, 'flit_core.buildapi', backend_path=None, python_executable=sys.executable, runner=builder._runner ) - pep517.wrappers.Pep517HookCaller.reset_mock() + pyproject_hooks.BuildBackendHookCaller.reset_mock() # custom python builder = build.ProjectBuilder(package_test_flit, python_executable='some-python') - pep517.wrappers.Pep517HookCaller.assert_called_with( + pyproject_hooks.BuildBackendHookCaller.assert_called_with( package_test_flit, 'flit_core.buildapi', backend_path=None, python_executable='some-python', runner=builder._runner ) - pep517.wrappers.Pep517HookCaller.reset_mock() + pyproject_hooks.BuildBackendHookCaller.reset_mock() # FileNotFoundError builder = build.ProjectBuilder(package_legacy) - pep517.wrappers.Pep517HookCaller.assert_called_with( + pyproject_hooks.BuildBackendHookCaller.assert_called_with( package_legacy, 'setuptools.build_meta:__legacy__', backend_path=None, @@ -221,6 +221,13 @@ build.ProjectBuilder(package_test_bad_syntax) +def test_init_makes_srcdir_absolute(package_test_flit): + rel_dir = os.path.relpath(package_test_flit, os.getcwd()) + assert not os.path.isabs(rel_dir) + builder = build.ProjectBuilder(rel_dir) + assert os.path.isabs(builder.srcdir) + + @pytest.mark.parametrize('value', [b'something', 'something_else']) def test_python_executable(package_test_flit, value): builder = build.ProjectBuilder(package_test_flit) @@ -256,15 +263,15 @@ def test_check_dependencies(mocker, package_test_flit): - mocker.patch('pep517.wrappers.Pep517HookCaller.get_requires_for_build_sdist') - mocker.patch('pep517.wrappers.Pep517HookCaller.get_requires_for_build_wheel') + mocker.patch('pyproject_hooks.BuildBackendHookCaller.get_requires_for_build_sdist') + mocker.patch('pyproject_hooks.BuildBackendHookCaller.get_requires_for_build_wheel') builder = build.ProjectBuilder(package_test_flit) side_effects = [ [], ['something'], - pep517.wrappers.BackendUnavailable, + pyproject_hooks.BackendUnavailable, ] builder._hook.get_requires_for_build_sdist.side_effect = copy.copy(side_effects) @@ -285,23 +292,8 @@ not builder.check_dependencies('wheel') -def test_working_directory(tmp_dir): - assert os.path.realpath(os.curdir) != os.path.realpath(tmp_dir) - with build._working_directory(tmp_dir): - assert os.path.realpath(os.curdir) == os.path.realpath(tmp_dir) - - -def test_working_directory_exc_is_not_transformed(mocker, package_test_flit, tmp_dir): - mocker.patch('build._working_directory', side_effect=OSError) - - builder = build.ProjectBuilder(package_test_flit) - with pytest.raises(OSError): - builder._call_backend('build_sdist', tmp_dir) - - def test_build(mocker, package_test_flit, tmp_dir): - mocker.patch('pep517.wrappers.Pep517HookCaller', autospec=True) - mocker.patch('build._working_directory', autospec=True) + mocker.patch('pyproject_hooks.BuildBackendHookCaller', autospec=True) builder = build.ProjectBuilder(package_test_flit) @@ -310,23 +302,19 @@ assert builder.build('sdist', tmp_dir) == os.path.join(tmp_dir, 'dist.tar.gz') builder._hook.build_sdist.assert_called_with(tmp_dir, None) - build._working_directory.assert_called_with(package_test_flit) assert builder.build('wheel', tmp_dir) == os.path.join(tmp_dir, 'dist.whl') builder._hook.build_wheel.assert_called_with(tmp_dir, None) - build._working_directory.assert_called_with(package_test_flit) with pytest.raises(build.BuildBackendException): - build._working_directory.assert_called_with(package_test_flit) builder.build('sdist', tmp_dir) with pytest.raises(build.BuildBackendException): - build._working_directory.assert_called_with(package_test_flit) builder.build('wheel', tmp_dir) def test_default_backend(mocker, package_legacy): - mocker.patch('pep517.wrappers.Pep517HookCaller', autospec=True) + mocker.patch('pyproject_hooks.BuildBackendHookCaller', autospec=True) builder = build.ProjectBuilder(package_legacy) @@ -334,7 +322,7 @@ def test_missing_backend(mocker, package_test_no_backend): - mocker.patch('pep517.wrappers.Pep517HookCaller', autospec=True) + mocker.patch('pyproject_hooks.BuildBackendHookCaller', autospec=True) builder = build.ProjectBuilder(package_test_no_backend) @@ -342,21 +330,21 @@ def test_missing_requires(mocker, package_test_no_requires): - mocker.patch('pep517.wrappers.Pep517HookCaller', autospec=True) + mocker.patch('pyproject_hooks.BuildBackendHookCaller', autospec=True) with pytest.raises(build.BuildException): build.ProjectBuilder(package_test_no_requires) def test_build_system_typo(mocker, package_test_typo): - mocker.patch('pep517.wrappers.Pep517HookCaller', autospec=True) + mocker.patch('pyproject_hooks.BuildBackendHookCaller', autospec=True) with pytest.warns(build.TypoWarning): build.ProjectBuilder(package_test_typo) def test_missing_outdir(mocker, tmp_dir, package_test_flit): - mocker.patch('pep517.wrappers.Pep517HookCaller', autospec=True) + mocker.patch('pyproject_hooks.BuildBackendHookCaller', autospec=True) builder = build.ProjectBuilder(package_test_flit) builder._hook.build_sdist.return_value = 'dist.tar.gz' @@ -368,7 +356,7 @@ def test_relative_outdir(mocker, tmp_dir, package_test_flit): - mocker.patch('pep517.wrappers.Pep517HookCaller', autospec=True) + mocker.patch('pyproject_hooks.BuildBackendHookCaller', autospec=True) builder = build.ProjectBuilder(package_test_flit) builder._hook.build_sdist.return_value = 'dist.tar.gz' @@ -379,7 +367,7 @@ def test_build_not_dir_outdir(mocker, tmp_dir, package_test_flit): - mocker.patch('pep517.wrappers.Pep517HookCaller', autospec=True) + mocker.patch('pyproject_hooks.BuildBackendHookCaller', autospec=True) builder = build.ProjectBuilder(package_test_flit) builder._hook.build_sdist.return_value = 'dist.tar.gz' @@ -449,29 +437,27 @@ def test_prepare(mocker, tmp_dir, package_test_flit): - mocker.patch('pep517.wrappers.Pep517HookCaller', autospec=True) - mocker.patch('build._working_directory', autospec=True) + mocker.patch('pyproject_hooks.BuildBackendHookCaller', autospec=True) builder = build.ProjectBuilder(package_test_flit) builder._hook.prepare_metadata_for_build_wheel.return_value = 'dist-1.0.dist-info' assert builder.prepare('wheel', tmp_dir) == os.path.join(tmp_dir, 'dist-1.0.dist-info') builder._hook.prepare_metadata_for_build_wheel.assert_called_with(tmp_dir, None, _allow_fallback=False) - build._working_directory.assert_called_with(package_test_flit) def test_prepare_no_hook(mocker, tmp_dir, package_test_flit): - mocker.patch('pep517.wrappers.Pep517HookCaller', autospec=True) + mocker.patch('pyproject_hooks.BuildBackendHookCaller', autospec=True) builder = build.ProjectBuilder(package_test_flit) - failure = pep517.wrappers.HookMissing('prepare_metadata_for_build_wheel') + failure = pyproject_hooks.HookMissing('prepare_metadata_for_build_wheel') builder._hook.prepare_metadata_for_build_wheel.side_effect = failure assert builder.prepare('wheel', tmp_dir) is None def test_prepare_error(mocker, tmp_dir, package_test_flit): - mocker.patch('pep517.wrappers.Pep517HookCaller', autospec=True) + mocker.patch('pyproject_hooks.BuildBackendHookCaller', autospec=True) builder = build.ProjectBuilder(package_test_flit) builder._hook.prepare_metadata_for_build_wheel.side_effect = Exception @@ -481,7 +467,7 @@ def test_prepare_not_dir_outdir(mocker, tmp_dir, package_test_flit): - mocker.patch('pep517.wrappers.Pep517HookCaller', autospec=True) + mocker.patch('pyproject_hooks.BuildBackendHookCaller', autospec=True) builder = build.ProjectBuilder(package_test_flit) @@ -493,7 +479,7 @@ def test_no_outdir_single(mocker, tmp_dir, package_test_flit): - mocker.patch('pep517.wrappers.Pep517HookCaller.prepare_metadata_for_build_wheel', return_value='') + mocker.patch('pyproject_hooks.BuildBackendHookCaller.prepare_metadata_for_build_wheel', return_value='') builder = build.ProjectBuilder(package_test_flit) @@ -504,7 +490,7 @@ def test_no_outdir_multiple(mocker, tmp_dir, package_test_flit): - mocker.patch('pep517.wrappers.Pep517HookCaller.prepare_metadata_for_build_wheel', return_value='') + mocker.patch('pyproject_hooks.BuildBackendHookCaller.prepare_metadata_for_build_wheel', return_value='') builder = build.ProjectBuilder(package_test_flit) @@ -578,7 +564,7 @@ @pytest.mark.skipif(sys.version_info >= (3, 11), reason='No need to test old toml support on 3.11+') def test_toml_instead_of_tomli(mocker, mock_tomli_not_available, tmp_dir, package_test_flit): - mocker.patch('pep517.wrappers.Pep517HookCaller', autospec=True) + mocker.patch('pyproject_hooks.BuildBackendHookCaller', autospec=True) builder = build.ProjectBuilder(package_test_flit) builder._hook.build_sdist.return_value = 'dist.tar.gz' @@ -589,7 +575,7 @@ def test_log(mocker, caplog, package_test_flit): - mocker.patch('pep517.wrappers.Pep517HookCaller', autospec=True) + mocker.patch('pyproject_hooks.BuildBackendHookCaller', autospec=True) mocker.patch('build.ProjectBuilder._call_backend', return_value='some_path') caplog.set_level(logging.DEBUG) @@ -609,8 +595,6 @@ ('INFO', 'Building wheel...'), ('INFO', 'something'), ] - if sys.version_info >= (3, 8): # stacklevel - assert caplog.records[-1].lineno == 602 @pytest.mark.parametrize( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/build-0.9.0/tests/test_self_packaging.py new/build-0.10.0/tests/test_self_packaging.py --- old/build-0.9.0/tests/test_self_packaging.py 2022-10-27 12:42:48.000000000 +0200 +++ new/build-0.10.0/tests/test_self_packaging.py 2023-01-11 21:31:00.000000000 +0100 @@ -18,17 +18,6 @@ 'PKG-INFO', 'README.md', 'pyproject.toml', - 'setup.cfg', - 'setup.py', - 'src', - 'src/build', - 'src/build.egg-info', - 'src/build.egg-info/PKG-INFO', - 'src/build.egg-info/SOURCES.txt', - 'src/build.egg-info/dependency_links.txt', - 'src/build.egg-info/entry_points.txt', - 'src/build.egg-info/requires.txt', - 'src/build.egg-info/top_level.txt', 'src/build/__init__.py', 'src/build/__main__.py', 'src/build/env.py', @@ -47,7 +36,6 @@ 'dist-info/RECORD', 'dist-info/WHEEL', 'dist-info/entry_points.txt', - 'dist-info/top_level.txt', } @@ -70,7 +58,7 @@ (sdist,) = tmpdir.visit('*.tar.gz') with tarfile.open(str(sdist), 'r:gz') as tar: - simpler = {n.split('/', 1)[-1] for n in tar.getnames()[1:]} + simpler = {n.split('/', 1)[-1] for n in tar.getnames()} assert simpler == sdist_files diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/build-0.9.0/tox.ini new/build-0.10.0/tox.ini --- old/build-0.9.0/tox.ini 2022-10-27 12:42:48.000000000 +0200 +++ new/build-0.10.0/tox.ini 2023-01-11 21:31:00.000000000 +0100 @@ -4,7 +4,7 @@ type docs path - {py311, py310, py39, py38, py37, py36, pypy37, pypy38, pypy39}{, -min} + {py311, py310, py39, py38, py37, pypy37, pypy38, pypy39}{, -min} isolated_build = true skip_missing_interpreters = true minversion = 3.14 @@ -57,7 +57,7 @@ commands = mypy -[testenv:{py311, py310, py39, py38, py37, py36, pypy37, pypy38, pypy39}-min] +[testenv:{py311, py310, py39, py38, py37, pypy37, pypy38, pypy39}-min] description = check minimum versions required of all dependencies skip_install = true commands_pre = @@ -65,7 +65,7 @@ [testenv:docs] description = build documentations -basepython = python3.8 +basepython = python3.10 extras = docs commands = @@ -100,7 +100,7 @@ coverage xml -o {toxworkdir}/coverage.xml -i coverage html -d {toxworkdir}/htmlcov -i python -m diff_cover.diff_cover_tool --compare-branch {env:DIFF_AGAINST:origin/main} {toxworkdir}/coverage.xml -depends = {py311, py310, py39, py38, py37, py36, pypy37, pypy38, pypy39}{,-min}, path +depends = {py311, py310, py39, py38, py37, pypy37, pypy38, pypy39}{,-min}, path [flake8] max-line-length = 127