Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-pep517 for openSUSE:Factory checked in at 2022-09-17 20:08:15 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-pep517 (Old) and /work/SRC/openSUSE:Factory/.python-pep517.new.2083 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pep517" Sat Sep 17 20:08:15 2022 rev:12 rq:1003052 version:0.13.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-pep517/python-pep517.changes 2022-01-09 22:49:57.627272609 +0100 +++ /work/SRC/openSUSE:Factory/.python-pep517.new.2083/python-pep517.changes 2022-09-17 20:08:19.756808850 +0200 @@ -1,0 +2,8 @@ +Mon Sep 12 20:20:13 UTC 2022 - Dirk M??ller <dmuel...@suse.com> + +- update to 0.13.0: + - Remove support for end-of-life Pythons. Now requires Python3.6+. + - Remove support for ``toml`` package. Now requires ``tomli``. + - Rely on preferred "files" API on Python 3.9 and later (#140). + +------------------------------------------------------------------- Old: ---- pep517-0.12.0.tar.gz New: ---- pep517-0.13.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pep517.spec ++++++ --- /var/tmp/diff_new_pack.FvMkCr/_old 2022-09-17 20:08:20.356810580 +0200 +++ /var/tmp/diff_new_pack.FvMkCr/_new 2022-09-17 20:08:20.360810592 +0200 @@ -27,7 +27,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %bcond_without python2 Name: python-pep517%{psuffix} -Version: 0.12.0 +Version: 0.13.0 Release: 0 Summary: Wrappers to build Python packages using PEP 517 hooks License: MIT @@ -54,11 +54,7 @@ %ifpython2 Requires: python-xml %endif -%if 0%{?python_version_nodots} < 36 -Requires: python-toml -%else Requires: python-tomli -%endif %if 0%{?python_version_nodots} < 38 Requires: python-importlib-metadata Requires: python-zipp ++++++ pep517-0.12.0.tar.gz -> pep517-0.13.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep517-0.12.0/.bumpversion.cfg new/pep517-0.13.0/.bumpversion.cfg --- old/pep517-0.12.0/.bumpversion.cfg 2021-10-18 11:14:10.253351700 +0200 +++ new/pep517-0.13.0/.bumpversion.cfg 2022-07-29 17:17:34.856011200 +0200 @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.12.0 +current_version = 0.13.0 commit = True tag = True diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep517-0.12.0/.github/workflows/tests.yml new/pep517-0.13.0/.github/workflows/tests.yml --- old/pep517-0.12.0/.github/workflows/tests.yml 2021-10-18 11:14:10.253351700 +0200 +++ new/pep517-0.13.0/.github/workflows/tests.yml 2022-07-29 17:17:34.856011200 +0200 @@ -3,11 +3,30 @@ on: [push, pull_request] jobs: - tests: + isort: runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + + - name: Install Tox + run: | + pip install tox tox-venv + + - name: Run tests + run: tox -e isort + + tests: + runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: - python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9] + python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"] + os: [ubuntu-latest, macos-latest, windows-latest] steps: - name: Checkout @@ -17,6 +36,8 @@ uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} + cache: pip + cache-dependency-path: "dev-requirements.txt" - name: Install Tox run: | @@ -33,10 +54,12 @@ - name: Checkout uses: actions/checkout@v2 - - name: Set up Python 3.9 + - name: Set up Python uses: actions/setup-python@v2 with: - python-version: 3.9 + python-version: "3.10" + cache: pip + cache-dependency-path: "tox.ini" - name: Install Tox run: | diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep517-0.12.0/PKG-INFO new/pep517-0.13.0/PKG-INFO --- old/pep517-0.12.0/PKG-INFO 1970-01-01 01:00:00.000000000 +0100 +++ new/pep517-0.13.0/PKG-INFO 1970-01-01 01:00:00.000000000 +0100 @@ -1,16 +1,16 @@ Metadata-Version: 2.1 Name: pep517 -Version: 0.12.0 +Version: 0.13.0 Summary: Wrappers to build Python packages using PEP 517 hooks Home-page: https://github.com/pypa/pep517 Author: Thomas Kluyver Author-email: tho...@kluyver.me.uk +Requires-Python: >=3.6 Description-Content-Type: text/x-rst Classifier: License :: OSI Approved :: MIT License -Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 -Requires-Dist: toml;python_version<'3.6' -Requires-Dist: tomli >=1.1.0;python_version>='3.6' +Classifier: Programming Language :: Python :: 3 :: Only +Requires-Dist: tomli >=1.1.0;python_version<'3.11' Requires-Dist: importlib_metadata;python_version<'3.8' Requires-Dist: zipp;python_version<'3.8' @@ -42,7 +42,7 @@ from pep517.wrappers import Pep517HookCaller src = 'path/to/source' # Folder containing 'pyproject.toml' - with open(os.path.join(src, 'pyproject.toml')) as f: + with open(os.path.join(src, 'pyproject.toml'), 'rb') as f: build_sys = tomli.load(f)['build-system'] print(build_sys['requires']) # List of static requirements diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep517-0.12.0/README.rst new/pep517-0.13.0/README.rst --- old/pep517-0.12.0/README.rst 2021-10-18 11:14:10.253351700 +0200 +++ new/pep517-0.13.0/README.rst 2022-07-29 17:17:34.856011200 +0200 @@ -26,7 +26,7 @@ from pep517.wrappers import Pep517HookCaller src = 'path/to/source' # Folder containing 'pyproject.toml' - with open(os.path.join(src, 'pyproject.toml')) as f: + with open(os.path.join(src, 'pyproject.toml'), 'rb') as f: build_sys = tomli.load(f)['build-system'] print(build_sys['requires']) # List of static requirements diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep517-0.12.0/appveyor.yml new/pep517-0.13.0/appveyor.yml --- old/pep517-0.12.0/appveyor.yml 2021-10-18 11:14:10.253351700 +0200 +++ new/pep517-0.13.0/appveyor.yml 1970-01-01 01:00:00.000000000 +0100 @@ -1,25 +0,0 @@ -environment: - matrix: - - PYTHON: "C:\\Python27" - - PYTHON: "C:\\Python27-x64" - - PYTHON: "C:\\Python34" - - PYTHON: "C:\\Python34-x64" - - PYTHON: "C:\\Python35" - - PYTHON: "C:\\Python35-x64" - - PYTHON: "C:\\Python36" - - PYTHON: "C:\\Python36-x64" - - PYTHON: "C:\\Python37" - - PYTHON: "C:\\Python37-x64" - -install: - - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%" - - "python --version" - - "pip install tox" - -build: off - -cache: - - '%LOCALAPPDATA%\pip\Cache' - -test_script: - - "tox -e py" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep517-0.12.0/dev-requirements.txt new/pep517-0.13.0/dev-requirements.txt --- old/pep517-0.12.0/dev-requirements.txt 2021-10-18 11:14:10.253351700 +0200 +++ new/pep517-0.13.0/dev-requirements.txt 2022-07-29 17:17:34.856011200 +0200 @@ -1,11 +1,8 @@ pytest pytest-flake8 -flake8 < 4 # https://github.com/tholo/pytest-flake8/issues/81 -pytest-forward-compatibility; python_version<'3' -mock ; python_version<'3.6' +flake8 testpath -toml ; python_version<'3.6' -tomli ; python_version>='3.6' +tomli setuptools>=30 importlib_metadata ; python_version<'3.8' zipp ; python_version<'3.8' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep517-0.12.0/doc/changelog.rst new/pep517-0.13.0/doc/changelog.rst --- old/pep517-0.12.0/doc/changelog.rst 2021-10-18 11:14:10.253351700 +0200 +++ new/pep517-0.13.0/doc/changelog.rst 2022-07-29 17:17:34.856011200 +0200 @@ -1,6 +1,19 @@ Changelog ========= +0.13 +---- + +- Remove support for end-of-life Pythons. Now requires Python3.6+. +- Remove support for ``toml`` package. Now requires ``tomli``. +- Rely on preferred "files" API on Python 3.9 and later (#140). + +0.12 +---- + +- Add method for pip to check if build_editable hook is supported. + This is a private API for now. + 0.11.1 ------ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep517-0.12.0/doc/conf.py new/pep517-0.13.0/doc/conf.py --- old/pep517-0.12.0/doc/conf.py 2021-10-18 11:14:10.253351700 +0200 +++ new/pep517-0.13.0/doc/conf.py 2022-07-29 17:17:34.856011200 +0200 @@ -12,6 +12,7 @@ # import os import sys + sys.path.insert(0, os.path.abspath('..')) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep517-0.12.0/doc/requirements.txt new/pep517-0.13.0/doc/requirements.txt --- old/pep517-0.12.0/doc/requirements.txt 2021-10-18 11:14:10.253351700 +0200 +++ new/pep517-0.13.0/doc/requirements.txt 2022-07-29 17:17:34.860011000 +0200 @@ -1,2 +1 @@ -toml ; python_version<'3.6' -tomli ; python_version>='3.6' +tomli diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep517-0.12.0/pep517/__init__.py new/pep517-0.13.0/pep517/__init__.py --- old/pep517-0.12.0/pep517/__init__.py 2021-10-18 11:14:10.253351700 +0200 +++ new/pep517-0.13.0/pep517/__init__.py 2022-07-29 17:17:34.860011000 +0200 @@ -1,6 +1,6 @@ """Wrappers to build Python packages using PEP 517 hooks """ -__version__ = '0.12.0' +__version__ = '0.13.0' from .wrappers import * # noqa: F401, F403 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep517-0.12.0/pep517/_compat.py new/pep517-0.13.0/pep517/_compat.py --- old/pep517-0.12.0/pep517/_compat.py 1970-01-01 01:00:00.000000000 +0100 +++ new/pep517-0.13.0/pep517/_compat.py 2022-07-29 17:17:34.860011000 +0200 @@ -0,0 +1,8 @@ +__all__ = ("tomllib",) + +import sys + +if sys.version_info >= (3, 11): + import tomllib +else: + import tomli as tomllib diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep517-0.12.0/pep517/build.py new/pep517-0.13.0/pep517/build.py --- old/pep517-0.12.0/pep517/build.py 2021-10-18 11:14:10.253351700 +0200 +++ new/pep517-0.13.0/pep517/build.py 2022-07-29 17:17:34.860011000 +0200 @@ -1,15 +1,14 @@ """Build a project using PEP 517 hooks. """ import argparse -import io import logging import os import shutil +import tempfile +from ._compat import tomllib from .envbuild import BuildEnvironment from .wrappers import Pep517HookCaller -from .dirtools import tempdir, mkdir_p -from .compat import FileNotFoundError, toml_load log = logging.getLogger(__name__) @@ -31,8 +30,8 @@ Load the build system from a source dir (pyproject.toml). """ pyproject = os.path.join(source_dir, 'pyproject.toml') - with io.open(pyproject, 'rb') as f: - pyproject_data = toml_load(f) + with open(pyproject, 'rb') as f: + pyproject_data = tomllib.load(f) return pyproject_data['build-system'] @@ -64,7 +63,7 @@ env.pip_install(reqs) log.info('Installed dynamic build dependencies') - with tempdir() as td: + with tempfile.TemporaryDirectory() as td: log.info('Trying to build %s in %s', dist, td) build_name = 'build_{dist}'.format(**locals()) build = getattr(hooks, build_name) @@ -76,7 +75,7 @@ def build(source_dir, dist, dest=None, system=None): system = system or load_system(source_dir) dest = os.path.join(source_dir, dest or 'dist') - mkdir_p(dest) + os.makedirs(dest, exist_ok=True) validate_system(system) hooks = Pep517HookCaller( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep517-0.12.0/pep517/check.py new/pep517-0.13.0/pep517/check.py --- old/pep517-0.12.0/pep517/check.py 2021-10-18 11:14:10.253351700 +0200 +++ new/pep517-0.13.0/pep517/check.py 2022-07-29 17:17:34.860011000 +0200 @@ -1,19 +1,19 @@ """Check a project and backend by attempting to build using PEP 517 hooks. """ import argparse -import io import logging import os -from os.path import isfile, join as pjoin import shutil -from subprocess import CalledProcessError import sys import tarfile -from tempfile import mkdtemp import zipfile +from os.path import isfile +from os.path import join as pjoin +from subprocess import CalledProcessError +from tempfile import mkdtemp +from ._compat import tomllib from .colorlog import enable_colourful_output -from .compat import TOMLDecodeError, toml_load from .envbuild import BuildEnvironment from .wrappers import Pep517HookCaller @@ -142,15 +142,15 @@ return False try: - with io.open(pyproject, 'rb') as f: - pyproject_data = toml_load(f) + with open(pyproject, 'rb') as f: + pyproject_data = tomllib.load(f) # Ensure the mandatory data can be loaded buildsys = pyproject_data['build-system'] requires = buildsys['requires'] backend = buildsys['build-backend'] backend_path = buildsys.get('backend-path') log.info('Loaded pyproject.toml') - except (TOMLDecodeError, KeyError): + except (tomllib.TOMLDecodeError, KeyError): log.error("Invalid pyproject.toml", exc_info=True) return False diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep517-0.12.0/pep517/colorlog.py new/pep517-0.13.0/pep517/colorlog.py --- old/pep517-0.12.0/pep517/colorlog.py 2021-10-18 11:14:10.253351700 +0200 +++ new/pep517-0.13.0/pep517/colorlog.py 2022-07-29 17:17:34.860011000 +0200 @@ -73,8 +73,6 @@ # right conversion in python 3. fg_color = (curses.tigetstr("setaf") or curses.tigetstr("setf") or "") - if (3, 0) < sys.version_info < (3, 2, 3): - fg_color = str(fg_color, "ascii") for levelno, code in self.DEFAULT_COLORS.items(): self._colors[levelno] = str( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep517-0.12.0/pep517/compat.py new/pep517-0.13.0/pep517/compat.py --- old/pep517-0.12.0/pep517/compat.py 2021-10-18 11:14:10.253351700 +0200 +++ new/pep517-0.13.0/pep517/compat.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,51 +0,0 @@ -"""Python 2/3 compatibility""" -import io -import json -import sys - - -# Handle reading and writing JSON in UTF-8, on Python 3 and 2. - -if sys.version_info[0] >= 3: - # Python 3 - def write_json(obj, path, **kwargs): - with open(path, 'w', encoding='utf-8') as f: - json.dump(obj, f, **kwargs) - - def read_json(path): - with open(path, 'r', encoding='utf-8') as f: - return json.load(f) - -else: - # Python 2 - def write_json(obj, path, **kwargs): - with open(path, 'wb') as f: - json.dump(obj, f, encoding='utf-8', **kwargs) - - def read_json(path): - with open(path, 'rb') as f: - return json.load(f) - - -# FileNotFoundError - -try: - FileNotFoundError = FileNotFoundError -except NameError: - FileNotFoundError = IOError - - -if sys.version_info < (3, 6): - from toml import load as _toml_load # noqa: F401 - - def toml_load(f): - w = io.TextIOWrapper(f, encoding="utf8", newline="") - try: - return _toml_load(w) - finally: - w.detach() - - from toml import TomlDecodeError as TOMLDecodeError # noqa: F401 -else: - from tomli import load as toml_load # noqa: F401 - from tomli import TOMLDecodeError # noqa: F401 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep517-0.12.0/pep517/dirtools.py new/pep517-0.13.0/pep517/dirtools.py --- old/pep517-0.12.0/pep517/dirtools.py 2021-10-18 11:14:10.253351700 +0200 +++ new/pep517-0.13.0/pep517/dirtools.py 2022-07-29 17:17:34.860011000 +0200 @@ -1,33 +1,8 @@ -import os import io -import contextlib -import tempfile -import shutil -import errno +import os import zipfile -@contextlib.contextmanager -def tempdir(): - """Create a temporary directory in a context manager.""" - td = tempfile.mkdtemp() - try: - yield td - finally: - shutil.rmtree(td) - - -def mkdir_p(*args, **kwargs): - """Like `mkdir`, but does not raise an exception if the - directory already exists. - """ - try: - return os.mkdir(*args, **kwargs) - except OSError as exc: - if exc.errno != errno.EEXIST: - raise - - def dir_to_zipfile(root): """Construct an in-memory zip file for a directory.""" buffer = io.BytesIO() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep517-0.12.0/pep517/envbuild.py new/pep517-0.13.0/pep517/envbuild.py --- old/pep517-0.12.0/pep517/envbuild.py 2021-10-18 11:14:10.253351700 +0200 +++ new/pep517-0.13.0/pep517/envbuild.py 2022-07-29 17:17:34.860011000 +0200 @@ -1,27 +1,26 @@ """Build wheels/sdists by installing build deps to a temporary environment. """ -import io -import os import logging +import os import shutil -from subprocess import check_call import sys +from subprocess import check_call from sysconfig import get_paths from tempfile import mkdtemp -from .compat import toml_load -from .wrappers import Pep517HookCaller, LoggerWrapper +from ._compat import tomllib +from .wrappers import LoggerWrapper, Pep517HookCaller log = logging.getLogger(__name__) def _load_pyproject(source_dir): - with io.open( + with open( os.path.join(source_dir, 'pyproject.toml'), 'rb', ) as f: - pyproject_data = toml_load(f) + pyproject_data = tomllib.load(f) buildsys = pyproject_data['build-system'] return ( buildsys['requires'], @@ -30,7 +29,7 @@ ) -class BuildEnvironment(object): +class BuildEnvironment: """Context manager to install build deps in a simple temporary environment Based on code I wrote for pip, which is MIT licensed. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep517-0.12.0/pep517/in_process/__init__.py new/pep517-0.13.0/pep517/in_process/__init__.py --- old/pep517-0.12.0/pep517/in_process/__init__.py 2021-10-18 11:14:10.253351700 +0200 +++ new/pep517-0.13.0/pep517/in_process/__init__.py 2022-07-29 17:17:34.860011000 +0200 @@ -3,15 +3,24 @@ The subpackage should stay as empty as possible to avoid shadowing modules that the backend might import. """ -from os.path import dirname, abspath, join as pjoin from contextlib import contextmanager +from os.path import abspath, dirname +from os.path import join as pjoin try: import importlib.resources as resources - - def _in_proc_script_path(): - return resources.path(__package__, '_in_process.py') + try: + resources.files + except AttributeError: + # Python 3.8 compatibility + def _in_proc_script_path(): + return resources.path(__package__, '_in_process.py') + else: + def _in_proc_script_path(): + return resources.as_file( + resources.files(__package__).joinpath('_in_process.py')) except ImportError: + # Python 3.6 compatibility @contextmanager def _in_proc_script_path(): yield pjoin(dirname(abspath(__file__)), '_in_process.py') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep517-0.12.0/pep517/in_process/_in_process.py new/pep517-0.13.0/pep517/in_process/_in_process.py --- old/pep517-0.12.0/pep517/in_process/_in_process.py 2021-10-18 11:14:10.253351700 +0200 +++ new/pep517-0.13.0/pep517/in_process/_in_process.py 2022-07-29 17:17:34.860011000 +0200 @@ -12,41 +12,29 @@ - control_dir/output.json - {"return_val": ...} """ -from glob import glob -from importlib import import_module import json import os import os.path -from os.path import join as pjoin import re import shutil import sys import traceback +from glob import glob +from importlib import import_module +from os.path import join as pjoin + +# This file is run as a script, and `import wrappers` is not zip-safe, so we +# include write_json() and read_json() from wrappers.py. + + +def write_json(obj, path, **kwargs): + with open(path, 'w', encoding='utf-8') as f: + json.dump(obj, f, **kwargs) + -# This file is run as a script, and `import compat` is not zip-safe, so we -# include write_json() and read_json() from compat.py. -# -# Handle reading and writing JSON in UTF-8, on Python 3 and 2. - -if sys.version_info[0] >= 3: - # Python 3 - def write_json(obj, path, **kwargs): - with open(path, 'w', encoding='utf-8') as f: - json.dump(obj, f, **kwargs) - - def read_json(path): - with open(path, 'r', encoding='utf-8') as f: - return json.load(f) - -else: - # Python 2 - def write_json(obj, path, **kwargs): - with open(path, 'wb') as f: - json.dump(obj, f, encoding='utf-8', **kwargs) - - def read_json(path): - with open(path, 'rb') as f: - return json.load(f) +def read_json(path): + with open(path, encoding='utf-8') as f: + return json.load(f) class BackendUnavailable(Exception): @@ -64,7 +52,7 @@ class HookMissing(Exception): """Raised if a hook is missing and we are not executing the fallback""" def __init__(self, hook_name=None): - super(HookMissing, self).__init__(hook_name) + super().__init__(hook_name) self.hook_name = hook_name diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep517-0.12.0/pep517/meta.py new/pep517-0.13.0/pep517/meta.py --- old/pep517-0.12.0/pep517/meta.py 2021-10-18 11:14:10.253351700 +0200 +++ new/pep517-0.13.0/pep517/meta.py 2022-07-29 17:17:34.860011000 +0200 @@ -1,10 +1,11 @@ """Build metadata for a project using PEP 517 hooks. """ import argparse +import functools import logging import os import shutil -import functools +import tempfile try: import importlib.metadata as imp_meta @@ -16,10 +17,10 @@ except ImportError: from zipp import Path +from .build import compat_system, load_system, validate_system +from .dirtools import dir_to_zipfile from .envbuild import BuildEnvironment from .wrappers import Pep517HookCaller, quiet_subprocess_runner -from .dirtools import tempdir, mkdir_p, dir_to_zipfile -from .build import validate_system, load_system, compat_system log = logging.getLogger(__name__) @@ -31,7 +32,7 @@ env.pip_install(reqs) log.info('Installed dynamic build dependencies') - with tempdir() as td: + with tempfile.TemporaryDirectory() as td: log.info('Trying to build metadata in %s', td) filename = hooks.prepare_metadata_for_build_wheel(td, {}) source = os.path.join(td, filename) @@ -41,7 +42,7 @@ def build(source_dir='.', dest=None, system=None): system = system or load_system(source_dir) dest = os.path.join(source_dir, dest or 'dist') - mkdir_p(dest) + os.makedirs(dest, exist_ok=True) validate_system(system) hooks = Pep517HookCaller( source_dir, system['build-backend'], system.get('backend-path') @@ -54,7 +55,7 @@ def build_as_zip(builder=build): - with tempdir() as out_dir: + with tempfile.TemporaryDirectory() as out_dir: builder(dest=out_dir) return dir_to_zipfile(out_dir) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep517-0.12.0/pep517/wrappers.py new/pep517-0.13.0/pep517/wrappers.py --- old/pep517-0.12.0/pep517/wrappers.py 2021-10-18 11:14:10.253351700 +0200 +++ new/pep517-0.13.0/pep517/wrappers.py 2022-07-29 17:17:34.860011000 +0200 @@ -1,13 +1,13 @@ -import threading -from contextlib import contextmanager +import json import os -from os.path import abspath, join as pjoin -import shutil -from subprocess import check_call, check_output, STDOUT import sys -from tempfile import mkdtemp +import tempfile +import threading +from contextlib import contextmanager +from os.path import abspath +from os.path import join as pjoin +from subprocess import STDOUT, check_call, check_output -from . import compat from .in_process import _in_proc_script_path __all__ = [ @@ -21,13 +21,14 @@ ] -@contextmanager -def tempdir(): - td = mkdtemp() - try: - yield td - finally: - shutil.rmtree(td) +def write_json(obj, path, **kwargs): + with open(path, 'w', encoding='utf-8') as f: + json.dump(obj, f, **kwargs) + + +def read_json(path): + with open(path, encoding='utf-8') as f: + return json.load(f) class BackendUnavailable(Exception): @@ -47,7 +48,7 @@ class HookMissing(Exception): """Will be raised on missing hooks.""" def __init__(self, hook_name): - super(HookMissing, self).__init__(hook_name) + super().__init__(hook_name) self.hook_name = hook_name @@ -99,7 +100,7 @@ return abs_requested -class Pep517HookCaller(object): +class Pep517HookCaller: """A wrapper around a source directory to be built with a PEP 517 backend. :param source_dir: The path to the source directory, containing @@ -292,29 +293,15 @@ }) def _call_hook(self, hook_name, kwargs): - # On Python 2, pytoml returns Unicode values (which is correct) but the - # environment passed to check_call needs to contain string values. We - # convert here by encoding using ASCII (the backend can only contain - # letters, digits and _, . and : characters, and will be used as a - # Python identifier, so non-ASCII content is wrong on Python 2 in - # any case). - # For backend_path, we use sys.getfilesystemencoding. - if sys.version_info[0] == 2: - build_backend = self.build_backend.encode('ASCII') - else: - build_backend = self.build_backend - extra_environ = {'PEP517_BUILD_BACKEND': build_backend} + extra_environ = {'PEP517_BUILD_BACKEND': self.build_backend} if self.backend_path: backend_path = os.pathsep.join(self.backend_path) - if sys.version_info[0] == 2: - backend_path = backend_path.encode(sys.getfilesystemencoding()) extra_environ['PEP517_BACKEND_PATH'] = backend_path - with tempdir() as td: + with tempfile.TemporaryDirectory() as td: hook_input = {'kwargs': kwargs} - compat.write_json(hook_input, pjoin(td, 'input.json'), - indent=2) + write_json(hook_input, pjoin(td, 'input.json'), indent=2) # Run the hook in a subprocess with _in_proc_script_path() as script: @@ -325,7 +312,7 @@ extra_environ=extra_environ ) - data = compat.read_json(pjoin(td, 'output.json')) + data = read_json(pjoin(td, 'output.json')) if data.get('unsupported'): raise UnsupportedOperation(data.get('traceback', '')) if data.get('no_backend'): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep517-0.12.0/pyproject.toml new/pep517-0.13.0/pyproject.toml --- old/pep517-0.12.0/pyproject.toml 2021-10-18 11:14:10.253351700 +0200 +++ new/pep517-0.13.0/pyproject.toml 2022-07-29 17:17:34.860011000 +0200 @@ -9,13 +9,16 @@ home-page = "https://github.com/pypa/pep517" description-file = "README.rst" requires = [ - "toml;python_version<'3.6'", - "tomli >=1.1.0;python_version>='3.6'", + "tomli >=1.1.0;python_version<'3.11'", "importlib_metadata;python_version<'3.8'", "zipp;python_version<'3.8'", ] +requires-python = ">=3.6" classifiers = [ "License :: OSI Approved :: MIT License", - "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only", ] + +[tool.isort] +profile = "black" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep517-0.12.0/setup.py new/pep517-0.13.0/setup.py --- old/pep517-0.12.0/setup.py 1970-01-01 01:00:00.000000000 +0100 +++ new/pep517-0.13.0/setup.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,26 +0,0 @@ -#!/usr/bin/env python -# setup.py generated by flit for tools that don't yet use PEP 517 - -from distutils.core import setup - -packages = \ -['pep517', 'pep517.in_process'] - -package_data = \ -{'': ['*']} - -extras_require = \ -{":python_version<'3.6'": ['toml'], - ":python_version<'3.8'": ['importlib_metadata', 'zipp'], - ":python_version>='3.6'": ['tomli >=1.1.0']} - -setup(name='pep517', - version='0.12.0', - description='Wrappers to build Python packages using PEP 517 hooks', - author='Thomas Kluyver', - author_email='tho...@kluyver.me.uk', - url='https://github.com/pypa/pep517', - packages=packages, - package_data=package_data, - extras_require=extras_require, - ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep517-0.12.0/tests/samples/buildsys_pkgs/buildsys.py new/pep517-0.13.0/tests/samples/buildsys_pkgs/buildsys.py --- old/pep517-0.12.0/tests/samples/buildsys_pkgs/buildsys.py 2021-10-18 11:14:10.253351700 +0200 +++ new/pep517-0.13.0/tests/samples/buildsys_pkgs/buildsys.py 2022-07-29 17:17:34.860011000 +0200 @@ -3,10 +3,10 @@ Don't use this for any real code. """ -from glob import glob -from os.path import join as pjoin import shutil import tarfile +from glob import glob +from os.path import join as pjoin from zipfile import ZipFile diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep517-0.12.0/tests/samples/buildsys_pkgs/buildsys_minimal.py new/pep517-0.13.0/tests/samples/buildsys_pkgs/buildsys_minimal.py --- old/pep517-0.12.0/tests/samples/buildsys_pkgs/buildsys_minimal.py 2021-10-18 11:14:10.253351700 +0200 +++ new/pep517-0.13.0/tests/samples/buildsys_pkgs/buildsys_minimal.py 2022-07-29 17:17:34.860011000 +0200 @@ -2,9 +2,9 @@ Don't use this for any real code. """ +import tarfile from glob import glob from os.path import join as pjoin -import tarfile from zipfile import ZipFile diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep517-0.12.0/tests/samples/buildsys_pkgs/buildsys_minimal_editable.py new/pep517-0.13.0/tests/samples/buildsys_pkgs/buildsys_minimal_editable.py --- old/pep517-0.12.0/tests/samples/buildsys_pkgs/buildsys_minimal_editable.py 2021-10-18 11:14:10.253351700 +0200 +++ new/pep517-0.13.0/tests/samples/buildsys_pkgs/buildsys_minimal_editable.py 2022-07-29 17:17:34.860011000 +0200 @@ -1,4 +1,3 @@ from buildsys_minimal import build_sdist, build_wheel # noqa - build_editable = build_wheel diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep517-0.12.0/tests/samples/test-for-issue-104/setup.py new/pep517-0.13.0/tests/samples/test-for-issue-104/setup.py --- old/pep517-0.12.0/tests/samples/test-for-issue-104/setup.py 2021-10-18 11:14:10.257351900 +0200 +++ new/pep517-0.13.0/tests/samples/test-for-issue-104/setup.py 2022-07-29 17:17:34.864011000 +0200 @@ -1,7 +1,8 @@ +import json import sys +from os import environ, listdir, path + from setuptools import setup -from os import path, environ, listdir -import json children = listdir(sys.path[0]) out = path.join(environ['PEP517_ISSUE104_OUTDIR'], 'out.json') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep517-0.12.0/tests/test_call_hooks.py new/pep517-0.13.0/tests/test_call_hooks.py --- old/pep517-0.12.0/tests/test_call_hooks.py 2021-10-18 11:14:10.257351900 +0200 +++ new/pep517-0.13.0/tests/test_call_hooks.py 2022-07-29 17:17:34.864011000 +0200 @@ -1,27 +1,22 @@ -import io +import json import os -from os.path import dirname, abspath, join as pjoin import tarfile -from testpath import modified_env, assert_isfile -from testpath.tempdir import TemporaryDirectory, TemporaryWorkingDirectory -import pytest import zipfile -import sys -import json - -try: - from mock import Mock # Prefer the backport below python 3.6 -except ImportError: - from unittest.mock import Mock +from os.path import abspath, dirname +from os.path import join as pjoin +from unittest.mock import Mock -from pep517.compat import toml_load -from pep517.wrappers import Pep517HookCaller, default_subprocess_runner -from pep517.wrappers import UnsupportedOperation, BackendUnavailable - - -if sys.version_info[0] == 2: - FileNotFoundError = IOError +import pytest +import tomli +from testpath import assert_isfile, modified_env +from testpath.tempdir import TemporaryDirectory, TemporaryWorkingDirectory +from pep517.wrappers import ( + BackendUnavailable, + Pep517HookCaller, + UnsupportedOperation, + default_subprocess_runner, +) SAMPLES_DIR = pjoin(dirname(abspath(__file__)), 'samples') BUILDSYS_PKGS = pjoin(SAMPLES_DIR, 'buildsys_pkgs') @@ -29,8 +24,8 @@ def get_hooks(pkg, **kwargs): source_dir = pjoin(SAMPLES_DIR, pkg) - with io.open(pjoin(source_dir, 'pyproject.toml'), 'rb') as f: - data = toml_load(f) + with open(pjoin(source_dir, 'pyproject.toml'), 'rb') as f: + data = tomli.load(f) return Pep517HookCaller( source_dir, data['build-system']['build-backend'], **kwargs ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep517-0.12.0/tests/test_envbuild.py new/pep517-0.13.0/tests/test_envbuild.py --- old/pep517-0.12.0/tests/test_envbuild.py 2021-10-18 11:14:10.257351900 +0200 +++ new/pep517-0.13.0/tests/test_envbuild.py 2022-07-29 17:17:34.864011000 +0200 @@ -1,14 +1,13 @@ -from os.path import dirname, abspath, join as pjoin import tarfile -from testpath import modified_env, assert_isfile -from testpath.tempdir import TemporaryDirectory -try: - from unittest.mock import patch, call -except ImportError: - from mock import patch, call # Python 2 fallback import zipfile +from os.path import abspath, dirname +from os.path import join as pjoin +from unittest.mock import call, patch + +from testpath import assert_isfile, modified_env +from testpath.tempdir import TemporaryDirectory -from pep517.envbuild import build_sdist, build_wheel, BuildEnvironment +from pep517.envbuild import BuildEnvironment, build_sdist, build_wheel SAMPLES_DIR = pjoin(dirname(abspath(__file__)), 'samples') BUILDSYS_PKGS = pjoin(SAMPLES_DIR, 'buildsys_pkgs') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep517-0.12.0/tests/test_hook_fallbacks.py new/pep517-0.13.0/tests/test_hook_fallbacks.py --- old/pep517-0.12.0/tests/test_hook_fallbacks.py 2021-10-18 11:14:10.257351900 +0200 +++ new/pep517-0.13.0/tests/test_hook_fallbacks.py 2022-07-29 17:17:34.864011000 +0200 @@ -1,10 +1,11 @@ -import io -from os.path import dirname, abspath, join as pjoin +from os.path import abspath, dirname +from os.path import join as pjoin + import pytest -from testpath import modified_env, assert_isfile +import tomli +from testpath import assert_isfile, modified_env from testpath.tempdir import TemporaryDirectory -from pep517.compat import toml_load from pep517.wrappers import HookMissing, Pep517HookCaller SAMPLES_DIR = pjoin(dirname(abspath(__file__)), 'samples') @@ -13,8 +14,8 @@ def get_hooks(pkg): source_dir = pjoin(SAMPLES_DIR, pkg) - with io.open(pjoin(source_dir, 'pyproject.toml'), 'rb') as f: - data = toml_load(f) + with open(pjoin(source_dir, 'pyproject.toml'), 'rb') as f: + data = tomli.load(f) return Pep517HookCaller(source_dir, data['build-system']['build-backend']) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep517-0.12.0/tests/test_inplace_hooks.py new/pep517-0.13.0/tests/test_inplace_hooks.py --- old/pep517-0.12.0/tests/test_inplace_hooks.py 2021-10-18 11:14:10.257351900 +0200 +++ new/pep517-0.13.0/tests/test_inplace_hooks.py 2022-07-29 17:17:34.864011000 +0200 @@ -1,10 +1,11 @@ -import io -from os.path import dirname, abspath, join as pjoin -from testpath import modified_env +from os.path import abspath, dirname +from os.path import join as pjoin + import pytest +import tomli +from testpath import modified_env -from pep517.compat import toml_load -from pep517.wrappers import Pep517HookCaller, BackendInvalid +from pep517.wrappers import BackendInvalid, Pep517HookCaller SAMPLES_DIR = pjoin(dirname(abspath(__file__)), 'samples') BUILDSYS_PKGS = pjoin(SAMPLES_DIR, 'buildsys_pkgs') @@ -13,8 +14,8 @@ def get_hooks(pkg, backend=None, path=None): source_dir = pjoin(SAMPLES_DIR, pkg) - with io.open(pjoin(source_dir, 'pyproject.toml'), 'rb') as f: - data = toml_load(f) + with open(pjoin(source_dir, 'pyproject.toml'), 'rb') as f: + data = tomli.load(f) if backend is None: backend = data['build-system']['build-backend'] if path is None: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep517-0.12.0/tests/test_meta.py new/pep517-0.13.0/tests/test_meta.py --- old/pep517-0.12.0/tests/test_meta.py 2021-10-18 11:14:10.257351900 +0200 +++ new/pep517-0.13.0/tests/test_meta.py 2022-07-29 17:17:34.864011000 +0200 @@ -1,18 +1,8 @@ -from __future__ import unicode_literals, absolute_import, division - import re -import pytest - from pep517 import meta -pep517_needs_python_3 = pytest.mark.xfail( - 'sys.version_info < (3,)', - reason="pep517 cannot be built on Python 2", -) - - def test_meta_for_this_package(): dist = meta.load('.') assert re.match(r'[\d.]+', dist.version) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep517-0.12.0/tox.ini new/pep517-0.13.0/tox.ini --- old/pep517-0.12.0/tox.ini 2021-10-18 11:14:10.257351900 +0200 +++ new/pep517-0.13.0/tox.ini 2022-07-29 17:17:34.864011000 +0200 @@ -1,11 +1,15 @@ [tox] -envlist = py27, py34, py35, py36, py37, py38, py39, pypy, pypy3 +envlist = py36, py37, py38, py39, py310, pypy3, isort skipsdist = true [testenv] deps = -rdev-requirements.txt commands = pytest [] +[testenv:isort] +deps = isort +commands = python -m isort --check --diff {toxinidir} + [testenv:release] skip_install = True deps =