Hello community, here is the log from the commit of package python-pep517 for openSUSE:Factory checked in at 2019-11-04 17:07:08 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-pep517 (Old) and /work/SRC/openSUSE:Factory/.python-pep517.new.2990 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pep517" Mon Nov 4 17:07:08 2019 rev:3 rq:741051 version:0.7.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-pep517/python-pep517.changes 2019-08-30 14:39:45.333436446 +0200 +++ /work/SRC/openSUSE:Factory/.python-pep517.new.2990/python-pep517.changes 2019-11-04 17:07:11.728311707 +0100 @@ -1,0 +2,8 @@ +Fri Oct 18 10:47:59 UTC 2019 - Marketa Calabkova <[email protected]> + +- Update to version 0.7.0 + * Migrate from pytoml to toml. + * Include name of missing hook in HookMissing + * Support back-end path in pyproject.toml + +------------------------------------------------------------------- Old: ---- pep517-0.6.0.tar.gz New: ---- pep517-0.7.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pep517.spec ++++++ --- /var/tmp/diff_new_pack.GeMrnb/_old 2019-11-04 17:07:12.372312395 +0100 +++ /var/tmp/diff_new_pack.GeMrnb/_new 2019-11-04 17:07:12.376312399 +0100 @@ -18,22 +18,21 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-pep517 -Version: 0.6.0 +Version: 0.7.0 Release: 0 Summary: Wrappers to build Python packages using PEP 517 hooks License: MIT -Group: Development/Languages/Python URL: https://github.com/takluyver/pep517 Source: https://files.pythonhosted.org/packages/source/p/pep517/pep517-%{version}.tar.gz +BuildRequires: %{python_module mock} +BuildRequires: %{python_module pytest} BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module testpath} +BuildRequires: %{python_module toml} BuildRequires: fdupes BuildRequires: python-rpm-macros +Requires: python-toml BuildArch: noarch -Requires: python-pytoml -BuildRequires: %{python_module mock} -BuildRequires: %{python_module pytest} -BuildRequires: %{python_module pytoml} -BuildRequires: %{python_module testpath} %python_subpackages %description ++++++ pep517-0.6.0.tar.gz -> pep517-0.7.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep517-0.6.0/PKG-INFO new/pep517-0.7.0/PKG-INFO --- old/pep517-0.6.0/PKG-INFO 1970-01-01 01:00:00.000000000 +0100 +++ new/pep517-0.7.0/PKG-INFO 1970-01-01 01:00:00.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: pep517 -Version: 0.6.0 +Version: 0.7.0 Summary: Wrappers to build Python packages using PEP 517 hooks Home-page: https://github.com/takluyver/pep517 Author: Thomas Kluyver diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep517-0.6.0/README.rst new/pep517-0.7.0/README.rst --- old/pep517-0.6.0/README.rst 2019-02-01 13:28:28.911631300 +0100 +++ new/pep517-0.7.0/README.rst 2019-09-27 13:13:51.062879800 +0200 @@ -34,16 +34,20 @@ .. code-block:: python import os - import pytoml + import toml from pep517.wrappers import Pep517HookCaller src = 'path/to/source' # Folder containing 'pyproject.toml' with open(os.path.join(src, 'pyproject.toml')) as f: - build_sys = pytoml.load(f)['build-system'] + build_sys = toml.load(f)['build-system'] print(build_sys['requires']) # List of static requirements - hooks = Pep517HookCaller(src, build_backend=build_sys['build_backend']) + hooks = Pep517HookCaller( + src, + build_backend=build_sys['build_backend'], + backend_path=build_sys.get('backend-path'), + ) config_options = {} # Optional parameters for backend # List of dynamic requirements: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep517-0.6.0/dev-requirements.txt new/pep517-0.7.0/dev-requirements.txt --- old/pep517-0.6.0/dev-requirements.txt 2019-08-06 12:38:22.919091000 +0200 +++ new/pep517-0.7.0/dev-requirements.txt 2019-09-27 13:13:51.062879800 +0200 @@ -2,7 +2,7 @@ pytest-flake8 mock testpath -pytoml +toml setuptools>=30 importlib_metadata zipp diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep517-0.6.0/pep517/__init__.py new/pep517-0.7.0/pep517/__init__.py --- old/pep517-0.6.0/pep517/__init__.py 2019-08-06 12:40:43.178316800 +0200 +++ new/pep517-0.7.0/pep517/__init__.py 2019-09-27 13:14:30.881992300 +0200 @@ -1,4 +1,4 @@ """Wrappers to build Python packages using PEP 517 hooks """ -__version__ = '0.6.0' +__version__ = '0.7.0' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep517-0.6.0/pep517/_in_process.py new/pep517-0.7.0/pep517/_in_process.py --- old/pep517-0.6.0/pep517/_in_process.py 2019-05-19 11:07:04.276072700 +0200 +++ new/pep517-0.7.0/pep517/_in_process.py 2019-09-27 13:13:51.062879800 +0200 @@ -38,6 +38,10 @@ self.message = message +class HookMissing(Exception): + """Raised if a hook is missing and we are not executing the fallback""" + + def contained_in(filename, directory): """Test if a file is located within the given directory.""" filename = os.path.normcase(os.path.abspath(filename)) @@ -87,15 +91,19 @@ return hook(config_settings) -def prepare_metadata_for_build_wheel(metadata_directory, config_settings): +def prepare_metadata_for_build_wheel( + metadata_directory, config_settings, _allow_fallback): """Invoke optional prepare_metadata_for_build_wheel - Implements a fallback by building a wheel if the hook isn't defined. + Implements a fallback by building a wheel if the hook isn't defined, + unless _allow_fallback is False in which case HookMissing is raised. """ backend = _build_backend() try: hook = backend.prepare_metadata_for_build_wheel except AttributeError: + if not _allow_fallback: + raise HookMissing() return _get_wheel_metadata_from_wheel(backend, metadata_directory, config_settings) else: @@ -239,6 +247,8 @@ except GotUnsupportedOperation as e: json_out['unsupported'] = True json_out['traceback'] = e.traceback + except HookMissing: + json_out['hook_missing'] = True compat.write_json(json_out, pjoin(control_dir, 'output.json'), indent=2) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep517-0.6.0/pep517/build.py new/pep517-0.7.0/pep517/build.py --- old/pep517-0.6.0/pep517/build.py 2019-08-06 12:38:22.919091000 +0200 +++ new/pep517-0.7.0/pep517/build.py 2019-09-27 13:13:51.063879700 +0200 @@ -3,7 +3,7 @@ import argparse import logging import os -import pytoml +import toml import shutil from .envbuild import BuildEnvironment @@ -32,7 +32,7 @@ """ pyproject = os.path.join(source_dir, 'pyproject.toml') with open(pyproject) as f: - pyproject_data = pytoml.load(f) + pyproject_data = toml.load(f) return pyproject_data['build-system'] @@ -79,7 +79,9 @@ mkdir_p(dest) validate_system(system) - hooks = Pep517HookCaller(source_dir, system['build-backend']) + hooks = Pep517HookCaller( + source_dir, system['build-backend'], system.get('backend-path') + ) with BuildEnvironment() as env: env.pip_install(system['requires']) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep517-0.6.0/pep517/check.py new/pep517-0.7.0/pep517/check.py --- old/pep517-0.6.0/pep517/check.py 2019-02-01 13:23:08.962486300 +0100 +++ new/pep517-0.7.0/pep517/check.py 2019-09-27 13:13:51.063879700 +0200 @@ -4,7 +4,7 @@ import logging import os from os.path import isfile, join as pjoin -from pytoml import TomlError, load as toml_load +from toml import TomlDecodeError, load as toml_load import shutil from subprocess import CalledProcessError import sys @@ -147,12 +147,13 @@ buildsys = pyproject_data['build-system'] requires = buildsys['requires'] backend = buildsys['build-backend'] + backend_path = buildsys.get('backend-path') log.info('Loaded pyproject.toml') - except (TomlError, KeyError): + except (TomlDecodeError, KeyError): log.error("Invalid pyproject.toml", exc_info=True) return False - hooks = Pep517HookCaller(source_dir, backend) + hooks = Pep517HookCaller(source_dir, backend, backend_path) sdist_ok = check_build_sdist(hooks, requires) wheel_ok = check_build_wheel(hooks, requires) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep517-0.6.0/pep517/envbuild.py new/pep517-0.7.0/pep517/envbuild.py --- old/pep517-0.6.0/pep517/envbuild.py 2019-08-06 12:38:22.920091000 +0200 +++ new/pep517-0.7.0/pep517/envbuild.py 2019-09-27 13:13:51.063879700 +0200 @@ -3,7 +3,7 @@ import os import logging -import pytoml +import toml import shutil from subprocess import check_call import sys @@ -17,9 +17,13 @@ def _load_pyproject(source_dir): with open(os.path.join(source_dir, 'pyproject.toml')) as f: - pyproject_data = pytoml.load(f) + pyproject_data = toml.load(f) buildsys = pyproject_data['build-system'] - return buildsys['requires'], buildsys['build-backend'] + return ( + buildsys['requires'], + buildsys['build-backend'], + buildsys.get('backend-path'), + ) class BuildEnvironment(object): @@ -131,8 +135,8 @@ """ if config_settings is None: config_settings = {} - requires, backend = _load_pyproject(source_dir) - hooks = Pep517HookCaller(source_dir, backend) + requires, backend, backend_path = _load_pyproject(source_dir) + hooks = Pep517HookCaller(source_dir, backend, backend_path) with BuildEnvironment() as env: env.pip_install(requires) @@ -153,8 +157,8 @@ """ if config_settings is None: config_settings = {} - requires, backend = _load_pyproject(source_dir) - hooks = Pep517HookCaller(source_dir, backend) + requires, backend, backend_path = _load_pyproject(source_dir) + hooks = Pep517HookCaller(source_dir, backend, backend_path) with BuildEnvironment() as env: env.pip_install(requires) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep517-0.6.0/pep517/meta.py new/pep517-0.7.0/pep517/meta.py --- old/pep517-0.6.0/pep517/meta.py 2019-08-06 12:38:22.920091000 +0200 +++ new/pep517-0.7.0/pep517/meta.py 2019-09-27 13:13:51.063879700 +0200 @@ -43,7 +43,9 @@ dest = os.path.join(source_dir, dest or 'dist') mkdir_p(dest) validate_system(system) - hooks = Pep517HookCaller(source_dir, system['build-backend']) + hooks = Pep517HookCaller( + source_dir, system['build-backend'], system.get('backend-path') + ) with hooks.subprocess_runner(quiet_subprocess_runner): with BuildEnvironment() as env: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep517-0.6.0/pep517/wrappers.py new/pep517-0.7.0/pep517/wrappers.py --- old/pep517-0.6.0/pep517/wrappers.py 2019-08-06 12:38:22.921090800 +0200 +++ new/pep517-0.7.0/pep517/wrappers.py 2019-09-27 13:13:51.064879700 +0200 @@ -35,6 +35,13 @@ self.message = message +class HookMissing(Exception): + """Will be raised on missing hooks.""" + def __init__(self, hook_name): + super(HookMissing, self).__init__(hook_name) + self.hook_name = hook_name + + class UnsupportedOperation(Exception): """May be raised by build_sdist if the backend indicates that it can't.""" def __init__(self, traceback): @@ -87,9 +94,18 @@ """A wrapper around a source directory to be built with a PEP 517 backend. source_dir : The path to the source directory, containing pyproject.toml. - backend : The build backend spec, as per PEP 517, from pyproject.toml. + build_backend : The build backend spec, as per PEP 517, from + pyproject.toml. backend_path : The backend path, as per PEP 517, from pyproject.toml. runner : A callable that invokes the wrapper subprocess. + + The 'runner', if provided, must expect the following: + cmd : a list of strings representing the command and arguments to + execute, as would be passed to e.g. 'subprocess.check_call'. + cwd : a string representing the working directory that must be + used for the subprocess. Corresponds to the provided source_dir. + extra_environ : a dict mapping environment variable names to values + which must be set for the subprocess execution. """ def __init__( self, @@ -114,6 +130,9 @@ # set this when creating the wrapper, not on every call. @contextmanager def subprocess_runner(self, runner): + """A context manager for temporarily overriding the default subprocess + runner. + """ prev = self._subprocess_runner self._subprocess_runner = runner yield @@ -134,18 +153,21 @@ }) def prepare_metadata_for_build_wheel( - self, metadata_directory, config_settings=None): + self, metadata_directory, config_settings=None, + _allow_fallback=True): """Prepare a *.dist-info folder with metadata for this project. Returns the name of the newly created folder. If the build backend defines a hook with this name, it will be called in a subprocess. If not, the backend will be asked to build a wheel, - and the dist-info extracted from that. + and the dist-info extracted from that (unless _allow_fallback is + False). """ return self._call_hook('prepare_metadata_for_build_wheel', { 'metadata_directory': abspath(metadata_directory), 'config_settings': config_settings, + '_allow_fallback': _allow_fallback, }) def build_wheel( @@ -237,6 +259,8 @@ backend_path=self.backend_path, message=data.get('backend_error', '') ) + if data.get('hook_missing'): + raise HookMissing(hook_name) return data['return_val'] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep517-0.6.0/pyproject.toml new/pep517-0.7.0/pyproject.toml --- old/pep517-0.6.0/pyproject.toml 2019-08-06 12:38:22.921090800 +0200 +++ new/pep517-0.7.0/pyproject.toml 2019-09-27 13:13:51.064879700 +0200 @@ -9,7 +9,7 @@ home-page = "https://github.com/takluyver/pep517" description-file = "README.rst" requires = [ - "pytoml", + "toml", "importlib_metadata", "zipp", ] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep517-0.6.0/setup.py new/pep517-0.7.0/setup.py --- old/pep517-0.6.0/setup.py 1970-01-01 01:00:00.000000000 +0100 +++ new/pep517-0.7.0/setup.py 1970-01-01 01:00:00.000000000 +0100 @@ -10,10 +10,10 @@ {'': ['*']} install_requires = \ -['pytoml', 'importlib_metadata', 'zipp'] +['toml', 'importlib_metadata', 'zipp'] setup(name='pep517', - version='0.6.0', + version='0.7.0', description='Wrappers to build Python packages using PEP 517 hooks', author='Thomas Kluyver', author_email='[email protected]', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep517-0.6.0/tests/test_call_hooks.py new/pep517-0.7.0/tests/test_call_hooks.py --- old/pep517-0.6.0/tests/test_call_hooks.py 2019-02-01 22:12:20.028384200 +0100 +++ new/pep517-0.7.0/tests/test_call_hooks.py 2019-09-27 13:13:51.064879700 +0200 @@ -4,7 +4,7 @@ from testpath import modified_env, assert_isfile from testpath.tempdir import TemporaryDirectory, TemporaryWorkingDirectory import pytest -import pytoml +import toml import zipfile from pep517.wrappers import Pep517HookCaller @@ -17,7 +17,7 @@ def get_hooks(pkg): source_dir = pjoin(SAMPLES_DIR, pkg) with open(pjoin(source_dir, 'pyproject.toml')) as f: - data = pytoml.load(f) + data = toml.load(f) return Pep517HookCaller(source_dir, data['build-system']['build-backend']) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep517-0.6.0/tests/test_hook_fallbacks.py new/pep517-0.7.0/tests/test_hook_fallbacks.py --- old/pep517-0.6.0/tests/test_hook_fallbacks.py 2019-02-01 13:23:08.968486500 +0100 +++ new/pep517-0.7.0/tests/test_hook_fallbacks.py 2019-09-27 13:13:51.064879700 +0200 @@ -1,9 +1,10 @@ from os.path import dirname, abspath, join as pjoin -import pytoml +import pytest +import toml from testpath import modified_env, assert_isfile from testpath.tempdir import TemporaryDirectory -from pep517.wrappers import Pep517HookCaller +from pep517.wrappers import HookMissing, Pep517HookCaller SAMPLES_DIR = pjoin(dirname(abspath(__file__)), 'samples') BUILDSYS_PKGS = pjoin(SAMPLES_DIR, 'buildsys_pkgs') @@ -12,7 +13,7 @@ def get_hooks(pkg): source_dir = pjoin(SAMPLES_DIR, pkg) with open(pjoin(source_dir, 'pyproject.toml')) as f: - data = pytoml.load(f) + data = toml.load(f) return Pep517HookCaller(source_dir, data['build-system']['build-backend']) @@ -37,3 +38,18 @@ hooks.prepare_metadata_for_build_wheel(metadatadir, {}) assert_isfile(pjoin(metadatadir, 'pkg2-0.5.dist-info', 'METADATA')) + + +def test_prepare_metadata_for_build_wheel_no_fallback(): + hooks = get_hooks('pkg2') + + with TemporaryDirectory() as metadatadir: + with modified_env({'PYTHONPATH': BUILDSYS_PKGS}): + with pytest.raises(HookMissing) as exc_info: + hooks.prepare_metadata_for_build_wheel( + metadatadir, {}, _allow_fallback=False + ) + + e = exc_info.value + assert 'prepare_metadata_for_build_wheel' == e.hook_name + assert 'prepare_metadata_for_build_wheel' in str(e) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep517-0.6.0/tests/test_inplace_hooks.py new/pep517-0.7.0/tests/test_inplace_hooks.py --- old/pep517-0.6.0/tests/test_inplace_hooks.py 2019-05-19 11:07:04.277072700 +0200 +++ new/pep517-0.7.0/tests/test_inplace_hooks.py 2019-09-27 13:13:51.064879700 +0200 @@ -1,5 +1,5 @@ from os.path import dirname, abspath, join as pjoin -import pytoml +import toml from testpath import modified_env import pytest @@ -12,7 +12,7 @@ def get_hooks(pkg, backend=None, path=None): source_dir = pjoin(SAMPLES_DIR, pkg) with open(pjoin(source_dir, 'pyproject.toml')) as f: - data = pytoml.load(f) + data = toml.load(f) if backend is None: backend = data['build-system']['build-backend'] if path is None:
