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 2022-11-09 12:56:03 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-build (Old) and /work/SRC/openSUSE:Factory/.python-build.new.1597 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-build" Wed Nov 9 12:56:03 2022 rev:5 rq:1034384 version:0.9.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-build/python-build.changes 2022-07-14 16:34:44.232654965 +0200 +++ /work/SRC/openSUSE:Factory/.python-build.new.1597/python-build.changes 2022-11-09 12:56:09.211914307 +0100 @@ -1,0 +2,12 @@ +Mon Nov 7 20:52:13 UTC 2022 - Yogalakshmi Arunachalam <yarunacha...@suse.com> + +- Update to v0.9.0 + * Hide a Python 3.11.0 unavoidable warning with venv (PR #527) + * Fix infinite recursion error in check_dependency with circular dependencies (PR #512, Fixes #511) + * Only import colorama on Windows (PR #494, Fixes #493) + * Flush output more often to reduce interleaved output (PR #494) + * Small API cleanup, like better __all__ and srcdir being read only. (PR #477) + * Only use importlib_metadata when needed (PR #401) + * Clarify in printout when build dependencies are being installed (PR #514) + +------------------------------------------------------------------- Old: ---- build-0.8.0.tar.gz New: ---- build-0.9.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-build.spec ++++++ --- /var/tmp/diff_new_pack.zCAXyJ/_old 2022-11-09 12:56:10.883923733 +0100 +++ /var/tmp/diff_new_pack.zCAXyJ/_new 2022-11-09 12:56:10.887923756 +0100 @@ -27,7 +27,7 @@ %{?!python_module:%define python_module() python3-%{**}} %define skip_python2 1 Name: python-build%{psuffix} -Version: 0.8.0 +Version: 0.9.0 Release: 0 Summary: Simple PEP517 package builder License: MIT ++++++ build-0.8.0.tar.gz -> build-0.9.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/build-0.8.0/.github/dependabot.yml new/build-0.9.0/.github/dependabot.yml --- old/build-0.8.0/.github/dependabot.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/build-0.9.0/.github/dependabot.yml 2022-10-27 12:42:48.000000000 +0200 @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/build-0.8.0/.github/workflows/check.yml new/build-0.9.0/.github/workflows/check.yml --- old/build-0.8.0/.github/workflows/check.yml 2022-05-22 17:07:46.000000000 +0200 +++ new/build-0.9.0/.github/workflows/check.yml 2022-10-27 12:42:48.000000000 +0200 @@ -19,7 +19,7 @@ - uses: actions/checkout@v3 - name: Setup Python 3.9 - uses: actions/setup-python@v3 + uses: actions/setup-python@v4 with: python-version: 3.9 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/build-0.8.0/.github/workflows/test.yml new/build-0.9.0/.github/workflows/test.yml --- old/build-0.8.0/.github/workflows/test.yml 2022-05-22 17:07:46.000000000 +0200 +++ new/build-0.9.0/.github/workflows/test.yml 2022-10-27 12:42:48.000000000 +0200 @@ -4,14 +4,14 @@ branches: - main paths-ignore: - - 'docs/**' - - '*.md' + - "docs/**" + - "*.md" pull_request: branches: - main paths-ignore: - - 'docs/**' - - '*.md' + - "docs/**" + - "*.md" schedule: - cron: "0 8 * * *" workflow_dispatch: @@ -33,27 +33,26 @@ - macos - windows py: - - 'pypy-3.7' - - 'pypy-3.8' - - 'pypy-3.9' - - '3.11-dev' - - '3.10' - - '3.9' - - '3.8' - - '3.7' - - '3.6' + - "pypy-3.7" + - "pypy-3.8" + - "pypy-3.9" + - "3.11" + - "3.10" + - "3.9" + - "3.8" + - "3.7" + - "3.6" tox-target: - - 'tox' - - 'min' - exclude: - - { py: '3.11-dev', os: macos } - - { py: '3.11-dev', os: windows } + - "tox" + - "min" steps: - uses: actions/checkout@v3 + with: + fetch-depth: 0 - name: Setup python for test ${{ matrix.py }} - uses: actions/setup-python@v3 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.py }} @@ -74,7 +73,7 @@ shell: python - name: Setup python for tox - uses: actions/setup-python@v3 + uses: actions/setup-python@v4 with: python-version: 3.9 @@ -91,12 +90,15 @@ if: matrix.tox-target == 'min' run: tox -e ${{env.BASE}}-${{ matrix.tox-target }} - - name: Rename coverage report file - if: matrix.tox-target == 'tox' - run: mv ".tox/coverage.${BASE}.xml" .tox/coverage.xml - shell: bash + - name: Run path test + if: matrix.tox-target == 'tox' && matrix.py == '3.10' + run: tox -e path - - uses: codecov/codecov-action@v1 + - name: Combine coverage files + if: always() + run: tox -e coverage + + - uses: codecov/codecov-action@v3 if: always() env: PYTHON: ${{ matrix.python }} @@ -106,10 +108,6 @@ env_vars: PYTHON name: ${{ matrix.py }} - ${{ matrix.os }} - - name: Run path test - if: matrix.tox-target == 'tox' && matrix.py == '3.10' - run: tox -e path - type: runs-on: ubuntu-latest env: @@ -119,7 +117,7 @@ - uses: actions/checkout@v3 - name: Setup Python 3.9 - uses: actions/setup-python@v3 + uses: actions/setup-python@v4 with: python-version: 3.9 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/build-0.8.0/.gitignore new/build-0.9.0/.gitignore --- old/build-0.8.0/.gitignore 2022-05-22 17:07:46.000000000 +0200 +++ new/build-0.9.0/.gitignore 2022-10-27 12:42:48.000000000 +0200 @@ -20,3 +20,6 @@ .integration-sources .tox Dockerfile + +# Restore src/build in case user ignores 'build' +!src/build diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/build-0.8.0/.pre-commit-config.yaml new/build-0.9.0/.pre-commit-config.yaml --- old/build-0.8.0/.pre-commit-config.yaml 2022-05-22 17:07:46.000000000 +0200 +++ new/build-0.9.0/.pre-commit-config.yaml 2022-10-27 12:42:48.000000000 +0200 @@ -1,63 +1,68 @@ ci: autofix_prs: false - autoupdate_commit_msg: 'pre-commit: bump repositories' + autoupdate_commit_msg: "pre-commit: bump repositories" repos: -- repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.2.0 - hooks: - - id: check-ast - - id: check-builtin-literals - - id: check-docstring-first - - id: check-merge-conflict - - id: check-yaml - - id: check-toml - exclude: tests/packages/test-(bad-syntax|no-permission)/pyproject.toml - - id: debug-statements - - id: end-of-file-fixer - - id: trailing-whitespace - - id: double-quote-string-fixer -- repo: https://github.com/asottile/pyupgrade - rev: v2.32.1 - hooks: - - id: pyupgrade - args: ["--py36-plus"] -- repo: https://github.com/psf/black - rev: 22.3.0 - hooks: - - id: black -- repo: https://github.com/asottile/blacken-docs - rev: v1.12.1 - hooks: - - id: blacken-docs - additional_dependencies: [black==22.3.0] -- repo: https://github.com/PyCQA/isort - rev: 5.10.1 - hooks: - - id: isort -- repo: https://github.com/asottile/setup-cfg-fmt - rev: v1.20.1 - hooks: - - id: setup-cfg-fmt -- repo: https://github.com/PyCQA/flake8 - rev: "4.0.1" - hooks: - - id: flake8 - additional_dependencies: ["flake8-bugbear == 22.3.23"] - language_version: python3.9 -- repo: https://github.com/codespell-project/codespell - rev: "v2.1.0" - hooks: - - id: codespell - args: ["-L", "sur"] -- repo: https://github.com/pre-commit/pygrep-hooks - rev: "v1.9.0" - hooks: - - id: python-check-blanket-noqa - - id: python-check-blanket-type-ignore - - id: python-no-log-warn - - id: python-no-eval - - id: python-use-type-annotations - - id: rst-backticks - - id: rst-directive-colons - - id: rst-inline-touching-normal + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.3.0 + hooks: + - id: check-ast + - id: check-builtin-literals + - id: check-docstring-first + - id: check-merge-conflict + - id: check-yaml + - id: check-toml + exclude: tests/packages/test-(bad-syntax|no-permission)/pyproject.toml + - id: debug-statements + - id: end-of-file-fixer + - id: trailing-whitespace + - id: double-quote-string-fixer + - repo: https://github.com/asottile/pyupgrade + rev: v3.1.0 + hooks: + - id: pyupgrade + args: ["--py36-plus"] + - repo: https://github.com/psf/black + rev: 22.10.0 + hooks: + - id: black + - repo: https://github.com/asottile/blacken-docs + rev: v1.12.1 + hooks: + - id: blacken-docs + additional_dependencies: [black==22.6] + - repo: https://github.com/pre-commit/mirrors-prettier + rev: "v3.0.0-alpha.2" + hooks: + - id: prettier + - repo: https://github.com/PyCQA/isort + rev: 5.10.1 + 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" + hooks: + - id: flake8 + additional_dependencies: ["flake8-bugbear==22.7.1"] + language_version: python3.9 + - repo: https://github.com/codespell-project/codespell + rev: "v2.2.2" + hooks: + - id: codespell + args: ["-L", "sur"] + - repo: https://github.com/pre-commit/pygrep-hooks + rev: "v1.9.0" + hooks: + - id: python-check-blanket-noqa + - id: python-check-blanket-type-ignore + - id: python-no-log-warn + - id: python-no-eval + - id: python-use-type-annotations + - id: rst-backticks + - id: rst-directive-colons + - id: rst-inline-touching-normal diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/build-0.8.0/.readthedocs.yml new/build-0.9.0/.readthedocs.yml --- old/build-0.8.0/.readthedocs.yml 2022-05-22 17:07:46.000000000 +0200 +++ new/build-0.9.0/.readthedocs.yml 2022-10-27 12:42:48.000000000 +0200 @@ -1,9 +1,9 @@ version: 2 build: - os: ubuntu-20.04 - tools: - python: '3.10' + os: ubuntu-20.04 + tools: + python: "3.10" python: install: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/build-0.8.0/CHANGELOG.rst new/build-0.9.0/CHANGELOG.rst --- old/build-0.8.0/CHANGELOG.rst 2022-05-22 17:07:46.000000000 +0200 +++ new/build-0.9.0/CHANGELOG.rst 2022-10-27 12:42:48.000000000 +0200 @@ -3,7 +3,29 @@ +++++++++ -0.8.0 (2021-05-22) +0.9.0 (2022-10-27) +================== + +- Hide a Python 3.11.0 unavoidable warning with venv (`PR #527`_) +- Fix infinite recursion error in ``check_dependency`` with circular + dependencies (`PR #512`_, Fixes `#511`_) +- Only import colorama on Windows (`PR #494`_, Fixes `#493`_) +- Flush output more often to reduce interleaved output (`PR #494`_) +- Small API cleanup, like better ``__all__`` and srcdir being read only. (`PR #477`_) +- Only use ``importlib_metadata`` when needed (`PR #401`_) +- Clarify in printout when build dependencies are being installed (`PR #514`_) + +.. _PR #401: https://github.com/pypa/build/pull/401 +.. _PR #477: https://github.com/pypa/build/pull/477 +.. _PR #494: https://github.com/pypa/build/pull/494 +.. _PR #512: https://github.com/pypa/build/pull/512 +.. _PR #514: https://github.com/pypa/build/pull/514 +.. _PR #527: https://github.com/pypa/build/pull/527 +.. _#493: https://github.com/pypa/build/issues/493 +.. _#511: https://github.com/pypa/build/issues/511 + + +0.8.0 (2022-05-22) ================== - Accept ``os.PathLike[str]`` in addition to ``str`` for paths in public diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/build-0.8.0/docs/api.rst new/build-0.9.0/docs/api.rst --- old/build-0.8.0/docs/api.rst 2022-05-22 17:07:46.000000000 +0200 +++ new/build-0.9.0/docs/api.rst 2022-10-27 12:42:48.000000000 +0200 @@ -1,8 +1,6 @@ API Documentation ================= -This project exposes 2 modules: - ``build`` module ---------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/build-0.8.0/pyproject.toml new/build-0.9.0/pyproject.toml --- old/build-0.8.0/pyproject.toml 2022-05-22 17:07:46.000000000 +0200 +++ new/build-0.9.0/pyproject.toml 2022-10-27 12:42:48.000000000 +0200 @@ -39,6 +39,7 @@ filterwarnings = [ "error", "ignore:path is deprecated.:DeprecationWarning", + "ignore:The --rsyncdir command line argument and rsyncdirs config variable are deprecated.:DeprecationWarning", ] [tool.mypy] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/build-0.8.0/setup.cfg new/build-0.9.0/setup.cfg --- old/build-0.8.0/setup.cfg 2022-05-22 17:07:46.000000000 +0200 +++ new/build-0.9.0/setup.cfg 2022-10-27 12:42:48.000000000 +0200 @@ -1,6 +1,6 @@ [metadata] name = build -version = 0.8.0 +version = 0.9.0 description = A simple, correct PEP 517 build frontend long_description = file: README.md long_description_content_type = text/markdown @@ -17,6 +17,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 = diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/build-0.8.0/src/build/__init__.py new/build-0.9.0/src/build/__init__.py --- old/build-0.8.0/src/build/__init__.py 2022-05-22 17:07:46.000000000 +0200 +++ new/build-0.9.0/src/build/__init__.py 2022-10-27 12:42:48.000000000 +0200 @@ -4,7 +4,7 @@ build - A simple, correct PEP 517 build frontend """ -__version__ = '0.8.0' +__version__ = '0.9.0' import contextlib import difflib @@ -176,6 +176,13 @@ import importlib_metadata req = packaging.requirements.Requirement(req_string) + normalised_req_string = str(req) + + # ``Requirement`` doesn't implement ``__eq__`` so we cannot compare reqs for + # equality directly but the string representation is stable. + if normalised_req_string in ancestral_req_strings: + # cyclical dependency, already checked. + return if req.marker: extras = frozenset(('',)).union(parent_extras) @@ -190,15 +197,15 @@ dist = importlib_metadata.distribution(req.name) # type: ignore[no-untyped-call] except importlib_metadata.PackageNotFoundError: # dependency is not installed in the environment. - yield ancestral_req_strings + (req_string,) + yield ancestral_req_strings + (normalised_req_string,) else: if req.specifier and not req.specifier.contains(dist.version, prereleases=True): # the installed version is incompatible. - yield ancestral_req_strings + (req_string,) + yield ancestral_req_strings + (normalised_req_string,) elif dist.requires: for other_req_string in dist.requires: # yields transitive dependencies that are not satisfied. - yield from check_dependency(other_req_string, ancestral_req_strings + (req_string,), req.extras) + yield from check_dependency(other_req_string, ancestral_req_strings + (normalised_req_string,), req.extras) def _find_typo(dictionary: Mapping[str, str], expected: str) -> None: @@ -279,7 +286,7 @@ The default runner simply calls the backend hooks in a subprocess, writing backend output to stdout/stderr. """ - self.srcdir: str = os.path.abspath(srcdir) + self._srcdir: str = os.path.abspath(srcdir) _validate_source_directory(srcdir) spec_file = os.path.join(srcdir, 'pyproject.toml') @@ -290,9 +297,9 @@ except FileNotFoundError: spec = {} except PermissionError as e: - raise BuildException(f"{e.strerror}: '{e.filename}' ") + raise BuildException(f"{e.strerror}: '{e.filename}' ") # noqa: B904 # use raise from except TOMLDecodeError as e: - raise BuildException(f'Failed to parse {spec_file}: {e} ') + raise BuildException(f'Failed to parse {spec_file}: {e} ') # noqa: B904 # use raise from self._build_system = _parse_build_system_table(spec) self._backend = self._build_system['build-backend'] @@ -320,6 +327,11 @@ self._hook_runner(cmd, cwd, extra_environ) @property + def srcdir(self) -> str: + """Project source directory.""" + return self._srcdir + + @property def python_executable(self) -> str: """ The Python executable used to invoke the backend. @@ -361,7 +373,7 @@ (``sdist`` or ``wheel``) :param config_settings: Config settings for the build backend """ - self.log(f'Getting dependencies for {distribution}...') + self.log(f'Getting build dependencies for {distribution}...') hook_name = f'get_requires_for_build_{distribution}' get_requires = getattr(self._hook, hook_name) @@ -481,15 +493,17 @@ try: yield except pep517.wrappers.BackendUnavailable as exception: - raise BuildBackendException( + 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(exception, f'Backend subprocess exited when trying to invoke {hook}') + 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()) + raise BuildBackendException(exception, exc_info=sys.exc_info()) # noqa: B904 # use raise from @staticmethod def log(message: str) -> None: @@ -509,6 +523,7 @@ __all__ = [ '__version__', + 'BuildSystemTableValidationError', 'BuildBackendException', 'BuildException', 'ConfigSettingsType', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/build-0.8.0/src/build/__main__.py new/build-0.9.0/src/build/__main__.py --- old/build-0.8.0/src/build/__main__.py 2022-05-22 17:07:46.000000000 +0200 +++ new/build-0.9.0/src/build/__main__.py 2022-10-27 12:42:48.000000000 +0200 @@ -4,6 +4,7 @@ import argparse import contextlib import os +import platform import shutil import subprocess import sys @@ -21,9 +22,6 @@ from build.env import IsolatedEnvBuilder -__all__ = ['build', 'main', 'main_parser'] - - _COLORS = { 'red': '\33[91m', 'green': '\33[92m', @@ -49,6 +47,10 @@ _STYLES = _init_colors() +def _cprint(fmt: str = '', msg: str = '') -> None: + print(fmt.format(msg, **_STYLES), flush=True) + + def _showwarning( message: Union[Warning, str], category: Type[Warning], @@ -57,18 +59,19 @@ file: Optional[TextIO] = None, line: Optional[str] = None, ) -> None: # pragma: no cover - print('{yellow}WARNING{reset} {}'.format(message, **_STYLES)) + _cprint('{yellow}WARNING{reset} {}', str(message)) def _setup_cli() -> None: warnings.showwarning = _showwarning - try: - import colorama - except ModuleNotFoundError: - pass - else: - colorama.init() # fix colors on windows + if platform.system() == 'Windows': + try: + import colorama + + colorama.init() + except ModuleNotFoundError: + pass def _error(msg: str, code: int = 1) -> NoReturn: # pragma: no cover @@ -78,20 +81,20 @@ :param msg: Error message :param code: Error code """ - print('{red}ERROR{reset} {}'.format(msg, **_STYLES)) + _cprint('{red}ERROR{reset} {}', msg) raise SystemExit(code) class _ProjectBuilder(ProjectBuilder): @staticmethod def log(message: str) -> None: - print('{bold}* {}{reset}'.format(message, **_STYLES)) + _cprint('{bold}* {}{reset}', message) class _IsolatedEnvBuilder(IsolatedEnvBuilder): @staticmethod def log(message: str) -> None: - print('{bold}* {}{reset}'.format(message, **_STYLES)) + _cprint('{bold}* {}{reset}', message) def _format_dep_chain(dep_chain: Sequence[str]) -> str: @@ -122,7 +125,7 @@ missing = builder.check_dependencies(distribution) if missing: dependencies = ''.join('\n\t' + dep for deps in missing for dep in (deps[0], _format_dep_chain(deps[1:])) if dep) - print() + _cprint() _error(f'Missing dependencies:{dependencies}') return builder.build(distribution, outdir, config_settings or {}) @@ -150,7 +153,7 @@ _error(str(e)) except BuildBackendException as e: if isinstance(e.exception, subprocess.CalledProcessError): - print() + _cprint() _error(str(e)) if e.exc_info: @@ -163,7 +166,7 @@ tb = ''.join(tb_lines) else: tb = traceback.format_exc(-1) - print('\n{dim}{}{reset}\n'.format(tb.strip('\n'), **_STYLES)) + _cprint('\n{dim}{}{reset}\n', tb.strip('\n')) _error(str(e)) @@ -373,10 +376,10 @@ artifact_list = _natural_language_list( ['{underline}{}{reset}{bold}{green}'.format(artifact, **_STYLES) for artifact in built] ) - print('{bold}{green}Successfully built {}{reset}'.format(artifact_list, **_STYLES)) + _cprint('{bold}{green}Successfully built {}{reset}', artifact_list) except Exception as e: # pragma: no cover tb = traceback.format_exc().strip('\n') - print('\n{dim}{}{reset}\n'.format(tb, **_STYLES)) + _cprint('\n{dim}{}{reset}\n', tb) _error(str(e)) @@ -386,3 +389,9 @@ if __name__ == '__main__': # pragma: no cover main(sys.argv[1:], 'python -m build') + + +__all__ = [ + 'main', + 'main_parser', +] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/build-0.8.0/src/build/env.py new/build-0.9.0/src/build/env.py --- old/build-0.8.0/src/build/env.py 2022-05-22 17:07:46.000000000 +0200 +++ new/build-0.9.0/src/build/env.py 2022-10-27 12:42:48.000000000 +0200 @@ -11,6 +11,7 @@ import sys import sysconfig import tempfile +import warnings from types import TracebackType from typing import Callable, Collection, List, Optional, Tuple, Type @@ -18,18 +19,13 @@ import build -if sys.version_info < (3, 8): - import importlib_metadata as metadata -else: - from importlib import metadata - try: import virtualenv except ModuleNotFoundError: virtualenv = None -_logger = logging.getLogger('build.env') +_logger = logging.getLogger(__name__) class IsolatedEnv(metaclass=abc.ABCMeta): @@ -260,9 +256,17 @@ import packaging.version + if sys.version_info < (3, 8): + import importlib_metadata as metadata + else: + from importlib import metadata + symlinks = _fs_supports_symlink() try: - venv.EnvBuilder(with_pip=True, symlinks=symlinks).create(path) + with warnings.catch_warnings(): + if sys.version_info[:3] == (3, 11, 0): + warnings.filterwarnings('ignore', 'check_home argument is deprecated and ignored.', DeprecationWarning) + venv.EnvBuilder(with_pip=True, symlinks=symlinks).create(path) except subprocess.CalledProcessError as exc: raise build.FailedProcessError(exc, 'Failed to create venv. Maybe try installing virtualenv.') from None @@ -330,7 +334,7 @@ return executable, paths['scripts'], paths['purelib'] -__all__ = ( +__all__ = [ 'IsolatedEnvBuilder', 'IsolatedEnv', -) +] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/build-0.8.0/src/build/util.py new/build-0.9.0/src/build/util.py --- old/build-0.8.0/src/build/util.py 2022-05-22 17:07:46.000000000 +0200 +++ new/build-0.9.0/src/build/util.py 2022-10-27 12:42:48.000000000 +0200 @@ -55,4 +55,6 @@ return _project_wheel_metadata(builder) -__all__ = ('project_wheel_metadata',) +__all__ = [ + 'project_wheel_metadata', +] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/build-0.8.0/tests/test_env.py new/build-0.9.0/tests/test_env.py --- old/build-0.8.0/tests/test_env.py 2022-05-22 17:07:46.000000000 +0200 +++ new/build-0.9.0/tests/test_env.py 2022-10-27 12:42:48.000000000 +0200 @@ -117,7 +117,11 @@ ('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, 107, 198] + assert [(record.lineno) for record in caplog.records] == [ + frameinfo.lineno + 1, + frameinfo.lineno - 6, + frameinfo.lineno + 85, + ] @pytest.mark.isolated @@ -139,7 +143,8 @@ mocker.patch('platform.system', return_value='Darwin') mocker.patch('platform.machine', return_value=arch) mocker.patch('platform.mac_ver', return_value=('11.0', ('', '', ''), '')) - mocker.patch('build.env.metadata.distributions', return_value=(SimpleNamespace(version=pip_version),)) + metadata_name = 'importlib_metadata' if sys.version_info < (3, 8) else 'importlib.metadata' + mocker.patch(metadata_name + '.distributions', return_value=(SimpleNamespace(version=pip_version),)) min_version = Version('20.3' if arch == 'x86_64' else '21.0.1') with build.env.IsolatedEnvBuilder(): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/build-0.8.0/tests/test_main.py new/build-0.9.0/tests/test_main.py --- old/build-0.8.0/tests/test_main.py 2022-05-22 17:07:46.000000000 +0200 +++ new/build-0.9.0/tests/test_main.py 2022-10-27 12:42:48.000000000 +0200 @@ -226,12 +226,12 @@ [ '* Creating venv isolated environment...', '* Installing packages in isolated environment... (setuptools >= 42.0.0, wheel >= 0.36.0)', - '* Getting dependencies for sdist...', + '* Getting build dependencies for sdist...', '* Building sdist...', '* Building wheel from sdist', '* Creating venv isolated environment...', '* Installing packages in isolated environment... (setuptools >= 42.0.0, wheel >= 0.36.0)', - '* Getting dependencies for wheel...', + '* Getting build dependencies for wheel...', '* Installing packages in isolated environment... (wheel)', '* Building wheel...', 'Successfully built test_setuptools-1.0.0.tar.gz and test_setuptools-1.0.0-py2.py3-none-any.whl', @@ -240,10 +240,10 @@ ( ['--no-isolation'], [ - '* Getting dependencies for sdist...', + '* Getting build dependencies for sdist...', '* Building sdist...', '* Building wheel from sdist', - '* Getting dependencies for wheel...', + '* Getting build dependencies for wheel...', '* Building wheel...', 'Successfully built test_setuptools-1.0.0.tar.gz and test_setuptools-1.0.0-py2.py3-none-any.whl', ], @@ -253,7 +253,7 @@ [ '* Creating venv isolated environment...', '* Installing packages in isolated environment... (setuptools >= 42.0.0, wheel >= 0.36.0)', - '* Getting dependencies for wheel...', + '* Getting build dependencies for wheel...', '* Installing packages in isolated environment... (wheel)', '* Building wheel...', 'Successfully built test_setuptools-1.0.0-py2.py3-none-any.whl', @@ -262,21 +262,25 @@ ( ['--wheel', '--no-isolation'], [ - '* Getting dependencies for wheel...', + '* Getting build dependencies for wheel...', '* Building wheel...', 'Successfully built test_setuptools-1.0.0-py2.py3-none-any.whl', ], ), ( ['--sdist', '--no-isolation'], - ['* Getting dependencies for sdist...', '* Building sdist...', 'Successfully built test_setuptools-1.0.0.tar.gz'], + [ + '* Getting build dependencies for sdist...', + '* Building sdist...', + 'Successfully built test_setuptools-1.0.0.tar.gz', + ], ), ( ['--sdist', '--wheel', '--no-isolation'], [ - '* Getting dependencies for sdist...', + '* Getting build dependencies for sdist...', '* Building sdist...', - '* Getting dependencies for wheel...', + '* Getting build dependencies for wheel...', '* Building wheel...', 'Successfully built test_setuptools-1.0.0.tar.gz and test_setuptools-1.0.0-py2.py3-none-any.whl', ], @@ -411,6 +415,8 @@ monkeypatch.setattr(venv.EnvBuilder, 'create', raise_called_process_err) monkeypatch.setenv('NO_COLOR', '') + importlib.reload(build.__main__) # reload module to set _STYLES + with pytest.raises(SystemExit): build.__main__.main([package_test_flit, '-o', tmp_dir]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/build-0.8.0/tests/test_projectbuilder.py new/build-0.9.0/tests/test_projectbuilder.py --- old/build-0.8.0/tests/test_projectbuilder.py 2022-05-22 17:07:46.000000000 +0200 +++ new/build-0.9.0/tests/test_projectbuilder.py 2022-10-27 12:42:48.000000000 +0200 @@ -45,55 +45,93 @@ return RecursiveMockDistribution() elif name == 'prerelease_dep': return PrereleaseMockDistribution() + elif name == 'circular_dep': + return CircularMockDistribution() + elif name == 'nested_circular_dep': + return NestedCircularMockDistribution() raise importlib_metadata.PackageNotFoundError class ExtraMockDistribution(MockDistribution): def read_text(self, filename): if filename == 'METADATA': - return """ -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' -""".strip() + return textwrap.dedent( + """ + 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' + """ + ).strip() class RequirelessMockDistribution(MockDistribution): def read_text(self, filename): if filename == 'METADATA': - return """ -Metadata-Version: 2.2 -Name: requireless_dep -Version: 1.0.0 -""".strip() + return textwrap.dedent( + """ + Metadata-Version: 2.2 + Name: requireless_dep + Version: 1.0.0 + """ + ).strip() class RecursiveMockDistribution(MockDistribution): def read_text(self, filename): if filename == 'METADATA': - return """ -Metadata-Version: 2.2 -Name: recursive_dep -Version: 1.0.0 -Requires-Dist: recursive_unmet_dep -""".strip() + return textwrap.dedent( + """ + Metadata-Version: 2.2 + Name: recursive_dep + Version: 1.0.0 + Requires-Dist: recursive_unmet_dep + """ + ).strip() class PrereleaseMockDistribution(MockDistribution): def read_text(self, filename): if filename == 'METADATA': - return """ -Metadata-Version: 2.2 -Name: prerelease_dep -Version: 1.0.1a0 -""".strip() + return textwrap.dedent( + """ + Metadata-Version: 2.2 + Name: prerelease_dep + Version: 1.0.1a0 + """ + ).strip() + + +class CircularMockDistribution(MockDistribution): + def read_text(self, filename): + if filename == 'METADATA': + return textwrap.dedent( + """ + Metadata-Version: 2.2 + Name: circular_dep + Version: 1.0.0 + Requires-Dist: nested_circular_dep + """ + ).strip() + + +class NestedCircularMockDistribution(MockDistribution): + def read_text(self, filename): + if filename == 'METADATA': + return textwrap.dedent( + """ + Metadata-Version: 2.2 + Name: nested_circular_dep + Version: 1.0.0 + Requires-Dist: circular_dep + """ + ).strip() @pytest.mark.parametrize( @@ -107,25 +145,26 @@ ('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]', 'unmet_dep; extra == "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'", + 'recursive_dep; extra == "recursive_extra_with_unmet_deps"', 'recursive_unmet_dep', ), ), ('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"',)), + ('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 == 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] == 2.0.0', ('extras_dep[extra_without_associated_deps]==2.0.0',)), ('prerelease_dep >= 1.0.0', None), + ('circular_dep', None), ], ) def test_check_dependency(monkeypatch, requirement_string, expected): @@ -232,12 +271,12 @@ builder._hook.get_requires_for_build_wheel.side_effect = copy.copy(side_effects) # requires = [] - assert builder.check_dependencies('sdist') == {('flit_core >=2,<3',)} - assert builder.check_dependencies('wheel') == {('flit_core >=2,<3',)} + assert builder.check_dependencies('sdist') == {('flit_core<3,>=2',)} + assert builder.check_dependencies('wheel') == {('flit_core<3,>=2',)} # requires = ['something'] - assert builder.check_dependencies('sdist') == {('flit_core >=2,<3',), ('something',)} - assert builder.check_dependencies('wheel') == {('flit_core >=2,<3',), ('something',)} + assert builder.check_dependencies('sdist') == {('flit_core<3,>=2',), ('something',)} + assert builder.check_dependencies('wheel') == {('flit_core<3,>=2',), ('something',)} # BackendUnavailable with pytest.raises(build.BuildBackendException): @@ -537,6 +576,7 @@ importlib.reload(build) +@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) @@ -562,15 +602,15 @@ builder.log('something') assert [(record.levelname, record.message) for record in caplog.records] == [ - ('INFO', 'Getting dependencies for sdist...'), - ('INFO', 'Getting dependencies for wheel...'), + ('INFO', 'Getting build dependencies for sdist...'), + ('INFO', 'Getting build dependencies for wheel...'), ('INFO', 'Getting metadata for wheel...'), ('INFO', 'Building sdist...'), ('INFO', 'Building wheel...'), ('INFO', 'something'), ] if sys.version_info >= (3, 8): # stacklevel - assert caplog.records[-1].lineno == 562 + assert caplog.records[-1].lineno == 602 @pytest.mark.parametrize( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/build-0.8.0/tox.ini new/build-0.9.0/tox.ini --- old/build-0.8.0/tox.ini 2022-05-22 17:07:46.000000000 +0200 +++ new/build-0.9.0/tox.ini 2022-10-27 12:42:48.000000000 +0200 @@ -18,6 +18,7 @@ LC_ALL PIP_* PYTEST_* + TERM setenv = COVERAGE_FILE = {toxworkdir}/.coverage.{envname} TEST_STATUS_DIR = {envtmpdir} @@ -46,9 +47,9 @@ description = verify build can run from source (bootstrap) setenv = PYTHONPATH = {toxinidir}/src -commands = - python -E -m pip uninstall -y build - pytest -ra {posargs:-n auto} + COVERAGE_FILE = {toxworkdir}/.coverage.{envname} +commands_pre = + python -E -m pip uninstall -y build colorama [testenv:type] description = run type check on code base @@ -59,9 +60,8 @@ [testenv:{py311, py310, py39, py38, py37, py36, pypy37, pypy38, pypy39}-min] description = check minimum versions required of all dependencies skip_install = true -commands = +commands_pre = pip install .[test] -c tests/constraints.txt - pytest -ra {posargs:-n auto} [testenv:docs] description = build documentations @@ -89,19 +89,18 @@ passenv = DIFF_AGAINST setenv = - COVERAGE_FILE = {toxworkdir}/.coverage skip_install = true deps = - coverage>=5.1 + coverage[toml]>=5.1 diff_cover>=3 parallel_show_output = true commands = - coverage combine + coverage combine {toxworkdir} coverage report --skip-covered --show-missing -i 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} +depends = {py311, py310, py39, py38, py37, py36, pypy37, pypy38, pypy39}{,-min}, path [flake8] max-line-length = 127