+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages + /usr/bin/pytest -ra -p no:randomly ==================================================================== test session starts ===================================================================== platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0 rootdir: /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4, configfile: pytest.ini, testpaths: setuptools/tests plugins: forked-1.4.0, shutil-1.7.0, cov-3.0.0, virtualenv-1.7.0, xdist-2.5.0, flake8-1.1.1, checkdocs-2.7.1 collected 875 items / 2 skipped setuptools/tests/test_archive_util.py X [ 0%] setuptools/tests/test_bdist_deprecations.py F [ 0%] setuptools/tests/test_bdist_egg.py .x [ 0%] setuptools/tests/test_build_clib.py . [ 0%] setuptools/tests/test_build_ext.py .... [ 1%] setuptools/tests/test_build_meta.py .................................................................................................................. [ 14%] ................................................................ [ 21%] setuptools/tests/test_build_py.py ....x [ 21%] setuptools/tests/test_config_discovery.py ................................................................................ [ 31%] setuptools/tests/test_dep_util.py . [ 31%] setuptools/tests/test_depends.py . [ 31%] setuptools/tests/test_develop.py s....F [ 32%] setuptools/tests/test_dist.py F......x...x............................................. [ 38%] setuptools/tests/test_dist_info.py ................................... [ 42%] setuptools/tests/test_distutils_adoption.py ............. [ 44%] setuptools/tests/test_easy_install.py .F...FFF......FF.F...FFFFFFFFFFFFFFFFFFF..........F [ 49%] setuptools/tests/test_editable_install.py .x [ 50%] setuptools/tests/test_egg_info.py .........................x............................................... [ 58%] setuptools/tests/test_extern.py ... [ 58%] setuptools/tests/test_find_packages.py ................... [ 60%] setuptools/tests/test_find_py_modules.py ......... [ 61%] setuptools/tests/test_glob.py .... [ 62%] setuptools/tests/test_install_scripts.py .s.s [ 62%] setuptools/tests/test_integration.py sssss [ 63%] setuptools/tests/test_logging.py .. [ 63%] setuptools/tests/test_manifest.py ................................................................... [ 71%] setuptools/tests/test_msvc14.py ssss [ 71%] setuptools/tests/test_namespaces.py .... [ 72%] setuptools/tests/test_packageindex.py .................... [ 74%] setuptools/tests/test_register.py . [ 74%] setuptools/tests/test_sandbox.py .......... [ 75%] setuptools/tests/test_sdist.py ................. [ 77%] setuptools/tests/test_setopt.py .. [ 77%] setuptools/tests/test_setuptools.py ....................... [ 80%] setuptools/tests/test_test.py . [ 80%] setuptools/tests/test_unicode_utils.py . [ 80%] setuptools/tests/test_upload.py . [ 80%] setuptools/tests/test_virtualenv.py ..x...X.. [ 81%] setuptools/tests/test_wheel.py ........................ [ 84%] setuptools/tests/test_windows_wrappers.py sss [ 85%] setuptools/tests/config/test_apply_pyprojecttoml.py ..................................... [ 89%] setuptools/tests/config/test_expand.py .................. [ 91%] setuptools/tests/config/test_pyprojecttoml.py ....................... [ 93%] setuptools/tests/config/test_setupcfg.py ............................................. [ 99%] setuptools/tests/integration/test_pip_install_sdist.py ssssssss [100%] ========================================================================== FAILURES ========================================================================== ___________________________________________________________________ test_bdist_rpm_warning ___________________________________________________________________ distutils_cmd = , tmpdir_cwd = local('/home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4') @pytest.mark.skipif(sys.platform == 'win32', reason='non-Windows only') @mock.patch('distutils.command.bdist_rpm.bdist_rpm') def test_bdist_rpm_warning(distutils_cmd, tmpdir_cwd): dist = Distribution( dict( script_name='setup.py', script_args=['bdist_rpm'], name='foo', py_modules=['hi'], ) ) > dist.parse_command_line() /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/setuptools/tests/test_bdist_deprecations.py:23: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/setuptools/_distutils/dist.py:484: in parse_command_line args = self._parse_command_opts(parser, args) /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/setuptools/dist.py:1119: in _parse_command_opts nargs = _Distribution._parse_command_opts(self, parser, args) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , parser = , args = ['bdist_rpm'] def _parse_command_opts(self, parser, args): """Parse the command-line options for a single command. 'parser' must be a FancyGetopt instance; 'args' must be the list of arguments, starting with the current command (whose options we are about to parse). Returns a new version of 'args' with the next command at the front of the list; will be the empty list if there are no more commands on the command line. Returns None if the user asked for help on this command. """ # late import because of mutual dependence between these modules from distutils.cmd import Command # Pull the current command from the head of the command line command = args[0] if not command_re.match(command): raise SystemExit("invalid command name '%s'" % command) self.commands.append(command) # Dig up the command class that implements this command, so we # 1) know that it's a valid command, and 2) know which options # it takes. try: cmd_class = self.get_command_class(command) except DistutilsModuleError as msg: raise DistutilsArgError(msg) # Require that the command class be derived from Command -- want # to be sure that the basic "command" interface is implemented. > if not issubclass(cmd_class, Command): E TypeError: issubclass() arg 1 must be a class /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/setuptools/_distutils/dist.py:546: TypeError ____________________________________________________________ TestNamespaces.test_editable_prefix _____________________________________________________________ self = tmp_path = PosixPath('/tmp/pytest-of-tkloczko/pytest-40/test_editable_prefix0') sample_project = PosixPath('/tmp/pytest-of-tkloczko/pytest-40/test_editable_prefix0/sampleproject') @pytest.mark.xfail( platform.python_implementation() == 'PyPy', reason="Workaround fails on PyPy (why?)", ) def test_editable_prefix(self, tmp_path, sample_project): """ Editable install to a prefix should be discoverable. """ prefix = tmp_path / 'prefix' # figure out where pip will likely install the package site_packages = prefix / next( pathlib.Path(path).relative_to(sys.prefix) for path in sys.path if 'site-packages' in path and path.startswith(sys.prefix) ) site_packages.mkdir(parents=True) # install workaround pip_run.launch.inject_sitecustomize(str(site_packages)) env = dict(os.environ, PYTHONPATH=str(site_packages)) cmd = [ sys.executable, '-m', 'pip', 'install', '--editable', str(sample_project), '--prefix', str(prefix), '--no-build-isolation', ] > subprocess.check_call(cmd, env=env) setuptools/tests/test_develop.py:202: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ popenargs = (['/usr/bin/python3', '-m', 'pip', 'install', '--editable', '/tmp/pytest-of-tkloczko/pytest-40/test_editable_prefix0/sampleproject', ...],) kwargs = {'env': {'AR': '/usr/bin/gcc-ar', 'BASH_ENV': '/usr/share/lmod/lmod/init/bash', 'BASH_FUNC_ml%%': '() { eval "$($LMOD...-}" ]; then\n echo "Shell debugging restarted" 1>&2;\n set -$__lmod_sh_dbg;\n fi;\n return $__lmod_my_status\n}', ...}} retcode = 2, cmd = ['/usr/bin/python3', '-m', 'pip', 'install', '--editable', '/tmp/pytest-of-tkloczko/pytest-40/test_editable_prefix0/sampleproject', ...] def check_call(*popenargs, **kwargs): """Run command with arguments. Wait for command to complete. If the exit code was zero then return, otherwise raise CalledProcessError. The CalledProcessError object will have the return code in the returncode attribute. The arguments are the same as for the call function. Example: check_call(["ls", "-l"]) """ retcode = call(*popenargs, **kwargs) if retcode: cmd = kwargs.get("args") if cmd is None: cmd = popenargs[0] > raise CalledProcessError(retcode, cmd) E subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'pip', 'install', '--editable', '/tmp/pytest-of-tkloczko/pytest-40/test_editable_prefix0/sampleproject', '--prefix', '/tmp/pytest-of-tkloczko/pytest-40/test_editable_prefix0/prefix', '--no-build-isolation']' returned non-zero exit status 2. /usr/lib64/python3.8/subprocess.py:364: CalledProcessError ------------------------------------------------------------------- Captured stderr setup -------------------------------------------------------------------- Cloning into 'sampleproject'... -------------------------------------------------------------------- Captured stdout call -------------------------------------------------------------------- Obtaining file:///tmp/pytest-of-tkloczko/pytest-40/test_editable_prefix0/sampleproject Checking if build backend supports build_editable: started Checking if build backend supports build_editable: finished with status 'done' -------------------------------------------------------------------- Captured stderr call -------------------------------------------------------------------- ERROR: Exception: Traceback (most recent call last): File "/usr/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 167, in exc_logging_wrapper status = run_func(*args) File "/usr/lib/python3.8/site-packages/pip/_internal/cli/req_command.py", line 205, in wrapper return func(self, options, args) File "/usr/lib/python3.8/site-packages/pip/_internal/commands/install.py", line 339, in run requirement_set = resolver.resolve( File "/usr/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 75, in resolve collected = self.factory.collect_root_requirements(root_reqs) File "/usr/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 508, in collect_root_requirements req = self._make_requirement_from_install_req( File "/usr/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 470, in _make_requirement_from_install_req cand = self._make_candidate_from_link( File "/usr/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 190, in _make_candidate_from_link self._editable_candidate_cache[link] = EditableCandidate( File "/usr/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 313, in __init__ super().__init__( File "/usr/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 158, in __init__ self.dist = self._prepare() File "/usr/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 227, in _prepare dist = self._prepare_distribution() File "/usr/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 323, in _prepare_distribution return self._factory.preparer.prepare_editable_requirement(self._ireq) File "/usr/lib/python3.8/site-packages/pip/_internal/operations/prepare.py", line 609, in prepare_editable_requirement dist = _get_prepared_distribution( File "/usr/lib/python3.8/site-packages/pip/_internal/operations/prepare.py", line 58, in _get_prepared_distribution abstract_dist.prepare_distribution_metadata(finder, build_isolation) File "/usr/lib/python3.8/site-packages/pip/_internal/distributions/sdist.py", line 47, in prepare_distribution_metadata self.req.prepare_metadata() File "/usr/lib/python3.8/site-packages/pip/_internal/req/req_install.py", line 514, in prepare_metadata and self.supports_pyproject_editable() File "/usr/lib/python3.8/site-packages/pip/_internal/req/req_install.py", line 229, in supports_pyproject_editable return "build_editable" in self.pep517_backend._supported_features() File "/usr/lib/python3.8/site-packages/pip/_vendor/pep517/wrappers.py", line 159, in _supported_features return self._call_hook('_supported_features', {}) File "/usr/lib/python3.8/site-packages/pip/_vendor/pep517/wrappers.py", line 332, in _call_hook raise BackendUnavailable(data.get('traceback', '')) pip._vendor.pep517.wrappers.BackendUnavailable: Traceback (most recent call last): File "/usr/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 89, in _build_backend obj = import_module(mod_path) File "/usr/lib64/python3.8/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 961, in _find_and_load_unlocked File "", line 219, in _call_with_frames_removed File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 973, in _find_and_load_unlocked ModuleNotFoundError: No module named 'setuptools' _________________________________________________________________ test_dist_fetch_build_egg __________________________________________________________________ v = '1.17.1-unknown' def parse_version(v): try: > return packaging.version.Version(v) ../../BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:121: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'Version' object has no attribute '_version'") raised in repr()] Version object at 0x7ffb61770e80>, version = '1.17.1-unknown' def __init__(self, version: str) -> None: # Validate the version and parse it into pieces match = self._regex.search(version) if not match: > raise InvalidVersion(f"Invalid version: '{version}'") E pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: '1.17.1-unknown' ../../BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/version.py:266: InvalidVersion During handling of the above exception, another exception occurred: tmpdir = local('/tmp/pytest-of-tkloczko/pytest-40/test_dist_fetch_build_egg0') def test_dist_fetch_build_egg(tmpdir): """ Check multiple calls to `Distribution.fetch_build_egg` work as expected. """ index = tmpdir.mkdir('index') index_url = urllib.parse.urljoin( 'file://', urllib.request.pathname2url(str(index))) def sdist_with_index(distname, version): dist_dir = index.mkdir(distname) dist_sdist = '%s-%s.tar.gz' % (distname, version) make_nspkg_sdist(str(dist_dir.join(dist_sdist)), distname, version) with dist_dir.join('index.html').open('w') as fp: fp.write(DALS( ''' {dist_sdist}
''' ).format(dist_sdist=dist_sdist)) sdist_with_index('barbazquux', '3.2.0') sdist_with_index('barbazquux-runner', '2.11.1') with tmpdir.join('setup.cfg').open('w') as fp: fp.write(DALS( ''' [easy_install] index_url = {index_url} ''' ).format(index_url=index_url)) reqs = ''' barbazquux-runner barbazquux '''.split() with tmpdir.as_cwd(): dist = Distribution() dist.parse_config_files() > resolved_dists = [ dist.fetch_build_egg(r) for r in reqs ] setuptools/tests/test_dist.py:63: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setuptools/tests/test_dist.py:64: in dist.fetch_build_egg(r) setuptools/dist.py:956: in fetch_build_egg return fetch_build_egg(self, req) setuptools/installer.py:60: in fetch_build_egg environment = pkg_resources.Environment() ../../BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:994: in __init__ self.scan(search_path) ../../BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:1027: in scan self.add(dist) ../../BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:1047: in add dists.sort(key=operator.attrgetter('hashcmp'), reverse=True) ../../BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:2620: in hashcmp self.parsed_version, ../../BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:2667: in parsed_version self._parsed_version = parse_version(self.version) ../../BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:128: in parse_version return packaging.version.LegacyVersion(v) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , version = '1.17.1-unknown' def __init__(self, version: str) -> None: self._version = str(version) self._key = _legacy_cmpkey(self._version) > warnings.warn( "Creating a LegacyVersion has been deprecated and will be " "removed in the next major release", DeprecationWarning, ) E DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release ../../BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/version.py:111: DeprecationWarning ___________________________________________________________ TestEasyInstallTest.test_no_find_links ___________________________________________________________ v = '1.17.1-unknown' def parse_version(v): try: > return packaging.version.Version(v) ../../BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:121: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'Version' object has no attribute '_version'") raised in repr()] Version object at 0x7ffb61786880>, version = '1.17.1-unknown' def __init__(self, version: str) -> None: # Validate the version and parse it into pieces match = self._regex.search(version) if not match: > raise InvalidVersion(f"Invalid version: '{version}'") E pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: '1.17.1-unknown' ../../BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/version.py:266: InvalidVersion During handling of the above exception, another exception occurred: self = def test_no_find_links(self): # new option '--no-find-links', that blocks find-links added at # the project level dist = Distribution() cmd = ei.easy_install(dist) cmd.check_pth_processing = lambda: True cmd.no_find_links = True cmd.find_links = ['link1', 'link2'] cmd.install_dir = os.path.join(tempfile.mkdtemp(), 'ok') cmd.args = ['ok'] > cmd.ensure_finalized() setuptools/tests/test_easy_install.py:95: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setuptools/_distutils/cmd.py:107: in ensure_finalized self.finalize_options() setuptools/command/easy_install.py:311: in finalize_options self.local_index = Environment(self.shadow_path + sys.path) ../../BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:994: in __init__ self.scan(search_path) ../../BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:1027: in scan self.add(dist) ../../BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:1047: in add dists.sort(key=operator.attrgetter('hashcmp'), reverse=True) ../../BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:2620: in hashcmp self.parsed_version, ../../BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:2667: in parsed_version self._parsed_version = parse_version(self.version) ../../BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:128: in parse_version return packaging.version.LegacyVersion(v) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , version = '1.17.1-unknown' def __init__(self, version: str) -> None: self._version = str(version) self._key = _legacy_cmpkey(self._version) > warnings.warn( "Creating a LegacyVersion has been deprecated and will be " "removed in the next major release", DeprecationWarning, ) E DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release ../../BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/version.py:111: DeprecationWarning _____________________________________________________ TestEasyInstallTest.test_unicode_filename_in_sdist _____________________________________________________ v = '1.17.1-unknown' def parse_version(v): try: > return packaging.version.Version(v) ../../BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:121: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'Version' object has no attribute '_version'") raised in repr()] Version object at 0x7ffb61668130>, version = '1.17.1-unknown' def __init__(self, version: str) -> None: # Validate the version and parse it into pieces match = self._regex.search(version) if not match: > raise InvalidVersion(f"Invalid version: '{version}'") E pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: '1.17.1-unknown' ../../BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/version.py:266: InvalidVersion During handling of the above exception, another exception occurred: self = sdist_unicode = '/tmp/pytest-of-tkloczko/pytest-40/test_unicode_filename_in_sdist0/setuptools-test-unicode-1.0.zip' tmpdir = local('/tmp/pytest-of-tkloczko/pytest-40/test_unicode_filename_in_sdist0'), monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7ffb6160ddc0> @fail_on_ascii def test_unicode_filename_in_sdist( self, sdist_unicode, tmpdir, monkeypatch): """ The install command should execute correctly even if the package has unicode filenames. """ dist = Distribution({'script_args': ['easy_install']}) target = (tmpdir / 'target').ensure_dir() cmd = ei.easy_install( dist, install_dir=str(target), args=['x'], ) monkeypatch.setitem(os.environ, 'PYTHONPATH', str(target)) > cmd.ensure_finalized() setuptools/tests/test_easy_install.py:183: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setuptools/_distutils/cmd.py:107: in ensure_finalized self.finalize_options() setuptools/command/easy_install.py:311: in finalize_options self.local_index = Environment(self.shadow_path + sys.path) ../../BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:994: in __init__ self.scan(search_path) ../../BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:1027: in scan self.add(dist) ../../BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:1047: in add dists.sort(key=operator.attrgetter('hashcmp'), reverse=True) ../../BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:2620: in hashcmp self.parsed_version, ../../BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:2667: in parsed_version self._parsed_version = parse_version(self.version) ../../BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:128: in parse_version return packaging.version.LegacyVersion(v) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , version = '1.17.1-unknown' def __init__(self, version: str) -> None: self._version = str(version) self._key = _legacy_cmpkey(self._version) > warnings.warn( "Creating a LegacyVersion has been deprecated and will be " "removed in the next major release", DeprecationWarning, ) E DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release ../../BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/version.py:111: DeprecationWarning _____________________________________________________ TestEasyInstallTest.test_unicode_content_in_sdist ______________________________________________________ v = '1.17.1-unknown' def parse_version(v): try: > return packaging.version.Version(v) ../../BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:121: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'Version' object has no attribute '_version'") raised in repr()] Version object at 0x7ffb616354c0>, version = '1.17.1-unknown' def __init__(self, version: str) -> None: # Validate the version and parse it into pieces match = self._regex.search(version) if not match: > raise InvalidVersion(f"Invalid version: '{version}'") E pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: '1.17.1-unknown' ../../BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/version.py:266: InvalidVersion During handling of the above exception, another exception occurred: self = sdist_unicode_in_script = '/tmp/pytest-of-tkloczko/pytest-40/test_unicode_content_in_sdist0/setuptools-test-unicode-script-1.0.zip' tmpdir = local('/tmp/pytest-of-tkloczko/pytest-40/test_unicode_content_in_sdist0'), monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7ffb613f9940> @fail_on_ascii def test_unicode_content_in_sdist( self, sdist_unicode_in_script, tmpdir, monkeypatch): """ The install command should execute correctly even if the package has unicode in scripts. """ dist = Distribution({"script_args": ["easy_install"]}) target = (tmpdir / "target").ensure_dir() cmd = ei.easy_install(dist, install_dir=str(target), args=["x"]) monkeypatch.setitem(os.environ, "PYTHONPATH", str(target)) > cmd.ensure_finalized() setuptools/tests/test_easy_install.py:236: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setuptools/_distutils/cmd.py:107: in ensure_finalized self.finalize_options() setuptools/command/easy_install.py:311: in finalize_options self.local_index = Environment(self.shadow_path + sys.path) ../../BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:994: in __init__ self.scan(search_path) ../../BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:1027: in scan self.add(dist) ../../BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:1047: in add dists.sort(key=operator.attrgetter('hashcmp'), reverse=True) ../../BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:2620: in hashcmp self.parsed_version, ../../BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:2667: in parsed_version self._parsed_version = parse_version(self.version) ../../BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:128: in parse_version return packaging.version.LegacyVersion(v) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , version = '1.17.1-unknown' def __init__(self, version: str) -> None: self._version = str(version) self._key = _legacy_cmpkey(self._version) > warnings.warn( "Creating a LegacyVersion has been deprecated and will be " "removed in the next major release", DeprecationWarning, ) E DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release ../../BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/version.py:111: DeprecationWarning __________________________________________________________ TestEasyInstallTest.test_script_install ___________________________________________________________ v = '1.17.1-unknown' def parse_version(v): try: > return packaging.version.Version(v) ../../BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:121: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'Version' object has no attribute '_version'") raised in repr()] Version object at 0x7ffb613e6040>, version = '1.17.1-unknown' def __init__(self, version: str) -> None: # Validate the version and parse it into pieces match = self._regex.search(version) if not match: > raise InvalidVersion(f"Invalid version: '{version}'") E pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: '1.17.1-unknown' ../../BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/version.py:266: InvalidVersion During handling of the above exception, another exception occurred: self = sdist_script = '/tmp/pytest-of-tkloczko/pytest-40/test_script_install0/setuptools-test-script-1.0.zip' tmpdir = local('/tmp/pytest-of-tkloczko/pytest-40/test_script_install0'), monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7ffb61346670> @pytest.mark.skipif(not sys.platform.startswith('linux'), reason="Test can only be run on Linux") def test_script_install(self, sdist_script, tmpdir, monkeypatch): """ Check scripts are installed. """ dist = Distribution({'script_args': ['easy_install']}) target = (tmpdir / 'target').ensure_dir() cmd = ei.easy_install( dist, install_dir=str(target), args=['x'], ) monkeypatch.setitem(os.environ, 'PYTHONPATH', str(target)) > cmd.ensure_finalized() setuptools/tests/test_easy_install.py:280: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setuptools/_distutils/cmd.py:107: in ensure_finalized self.finalize_options() setuptools/command/easy_install.py:311: in finalize_options self.local_index = Environment(self.shadow_path + sys.path) ../../BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:994: in __init__ self.scan(search_path) ../../BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:1027: in scan self.add(dist) ../../BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:1047: in add dists.sort(key=operator.attrgetter('hashcmp'), reverse=True) ../../BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:2620: in hashcmp self.parsed_version, ../../BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:2667: in parsed_version self._parsed_version = parse_version(self.version) ../../BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:128: in parse_version return packaging.version.LegacyVersion(v) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , version = '1.17.1-unknown' def __init__(self, version: str) -> None: self._version = str(version) self._key = _legacy_cmpkey(self._version) > warnings.warn( "Creating a LegacyVersion has been deprecated and will be " "removed in the next major release", DeprecationWarning, ) E DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release ../../BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/version.py:111: DeprecationWarning ____________________________________________ TestUserInstallTest.test_user_install_not_implied_user_site_enabled _____________________________________________ v = '1.17.1-unknown' def parse_version(v): try: > return packaging.version.Version(v) /home/tkloczko/rpmbuild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:121: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'Version' object has no attribute '_version'") raised in repr()] Version object at 0x7ffb614a71f0>, version = '1.17.1-unknown' def __init__(self, version: str) -> None: # Validate the version and parse it into pieces match = self._regex.search(version) if not match: > raise InvalidVersion(f"Invalid version: '{version}'") E pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: '1.17.1-unknown' /home/tkloczko/rpmbuild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/version.py:266: InvalidVersion During handling of the above exception, another exception occurred: self = @mock.patch('setuptools.command.easy_install.__file__', site.USER_SITE) @mock.patch('site.ENABLE_USER_SITE', True) @prev_sp_write def test_user_install_not_implied_user_site_enabled(self): > self.assert_not_user_site() /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/setuptools/tests/test_easy_install.py:347: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/setuptools/tests/test_easy_install.py:361: in assert_not_user_site cmd.ensure_finalized() /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/setuptools/_distutils/cmd.py:107: in ensure_finalized self.finalize_options() /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/setuptools/command/easy_install.py:311: in finalize_options self.local_index = Environment(self.shadow_path + sys.path) /home/tkloczko/rpmbuild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:994: in __init__ self.scan(search_path) /home/tkloczko/rpmbuild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:1027: in scan self.add(dist) /home/tkloczko/rpmbuild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:1047: in add dists.sort(key=operator.attrgetter('hashcmp'), reverse=True) /home/tkloczko/rpmbuild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:2620: in hashcmp self.parsed_version, /home/tkloczko/rpmbuild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:2667: in parsed_version self._parsed_version = parse_version(self.version) /home/tkloczko/rpmbuild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:128: in parse_version return packaging.version.LegacyVersion(v) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , version = '1.17.1-unknown' def __init__(self, version: str) -> None: self._version = str(version) self._key = _legacy_cmpkey(self._version) > warnings.warn( "Creating a LegacyVersion has been deprecated and will be " "removed in the next major release", DeprecationWarning, ) E DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release /home/tkloczko/rpmbuild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/version.py:111: DeprecationWarning ____________________________________________ TestUserInstallTest.test_user_install_not_implied_user_site_disabled ____________________________________________ v = '1.17.1-unknown' def parse_version(v): try: > return packaging.version.Version(v) /home/tkloczko/rpmbuild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:121: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'Version' object has no attribute '_version'") raised in repr()] Version object at 0x7ffb6382fd30>, version = '1.17.1-unknown' def __init__(self, version: str) -> None: # Validate the version and parse it into pieces match = self._regex.search(version) if not match: > raise InvalidVersion(f"Invalid version: '{version}'") E pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: '1.17.1-unknown' /home/tkloczko/rpmbuild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/version.py:266: InvalidVersion During handling of the above exception, another exception occurred: self = @mock.patch('site.ENABLE_USER_SITE', False) @prev_sp_write def test_user_install_not_implied_user_site_disabled(self): > self.assert_not_user_site() /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/setuptools/tests/test_easy_install.py:352: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/setuptools/tests/test_easy_install.py:361: in assert_not_user_site cmd.ensure_finalized() /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/setuptools/_distutils/cmd.py:107: in ensure_finalized self.finalize_options() /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/setuptools/command/easy_install.py:311: in finalize_options self.local_index = Environment(self.shadow_path + sys.path) /home/tkloczko/rpmbuild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:994: in __init__ self.scan(search_path) /home/tkloczko/rpmbuild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:1027: in scan self.add(dist) /home/tkloczko/rpmbuild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:1047: in add dists.sort(key=operator.attrgetter('hashcmp'), reverse=True) /home/tkloczko/rpmbuild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:2620: in hashcmp self.parsed_version, /home/tkloczko/rpmbuild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:2667: in parsed_version self._parsed_version = parse_version(self.version) /home/tkloczko/rpmbuild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:128: in parse_version return packaging.version.LegacyVersion(v) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , version = '1.17.1-unknown' def __init__(self, version: str) -> None: self._version = str(version) self._key = _legacy_cmpkey(self._version) > warnings.warn( "Creating a LegacyVersion has been deprecated and will be " "removed in the next major release", DeprecationWarning, ) E DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release /home/tkloczko/rpmbuild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/version.py:111: DeprecationWarning ____________________________________________________________ TestUserInstallTest.test_local_index ____________________________________________________________ v = '1.17.1-unknown' def parse_version(v): try: > return packaging.version.Version(v) /home/tkloczko/rpmbuild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:121: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'Version' object has no attribute '_version'") raised in repr()] Version object at 0x7ffb61b68820>, version = '1.17.1-unknown' def __init__(self, version: str) -> None: # Validate the version and parse it into pieces match = self._regex.search(version) if not match: > raise InvalidVersion(f"Invalid version: '{version}'") E pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: '1.17.1-unknown' /home/tkloczko/rpmbuild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/version.py:266: InvalidVersion During handling of the above exception, another exception occurred: self = , foo_package = '/tmp/pytest-of-tkloczko/pytest-40/test_local_index0' install_target = '/tmp/pytest-of-tkloczko/pytest-40/test_local_index0' def test_local_index(self, foo_package, install_target): """ The local index must be used when easy_install locates installed packages. """ dist = Distribution() dist.script_name = 'setup.py' cmd = ei.easy_install(dist) cmd.install_dir = install_target cmd.args = ['foo'] > cmd.ensure_finalized() /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/setuptools/tests/test_easy_install.py:396: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/setuptools/_distutils/cmd.py:107: in ensure_finalized self.finalize_options() /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/setuptools/command/easy_install.py:311: in finalize_options self.local_index = Environment(self.shadow_path + sys.path) /home/tkloczko/rpmbuild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:994: in __init__ self.scan(search_path) /home/tkloczko/rpmbuild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:1027: in scan self.add(dist) /home/tkloczko/rpmbuild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:1047: in add dists.sort(key=operator.attrgetter('hashcmp'), reverse=True) /home/tkloczko/rpmbuild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:2620: in hashcmp self.parsed_version, /home/tkloczko/rpmbuild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:2667: in parsed_version self._parsed_version = parse_version(self.version) /home/tkloczko/rpmbuild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:128: in parse_version return packaging.version.LegacyVersion(v) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , version = '1.17.1-unknown' def __init__(self, version: str) -> None: self._version = str(version) self._key = _legacy_cmpkey(self._version) > warnings.warn( "Creating a LegacyVersion has been deprecated and will be " "removed in the next major release", DeprecationWarning, ) E DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release /home/tkloczko/rpmbuild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/version.py:111: DeprecationWarning ______________________________________ TestSetupRequires.test_setup_requires_overrides_version_conflict[use_setup_cfg0] ______________________________________ v = '1.17.1-unknown' def parse_version(v): try: > return packaging.version.Version(v) pkg_resources/__init__.py:121: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'Version' object has no attribute '_version'") raised in repr()] Version object at 0x7ffb607f10d0>, version = '1.17.1-unknown' def __init__(self, version: str) -> None: # Validate the version and parse it into pieces match = self._regex.search(version) if not match: > raise InvalidVersion(f"Invalid version: '{version}'") E pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: '1.17.1-unknown' pkg_resources/_vendor/packaging/version.py:266: InvalidVersion During handling of the above exception, another exception occurred: @contextlib.contextmanager def save_modules(): """ Context in which imported modules are saved. Translates exceptions internal to the context into the equivalent exception outside the context. """ saved = sys.modules.copy() with ExceptionSaver() as saved_exc: > yield saved setuptools/sandbox.py:156: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setup_dir = '/tmp/tmpayn0o6ka/test_pkg' @contextlib.contextmanager def setup_context(setup_dir): temp_dir = os.path.join(setup_dir, 'temp') with save_pkg_resources_state(): with save_modules(): with save_path(): hide_setuptools() with save_argv(): with override_temp(temp_dir): with pushd(setup_dir): # ensure setuptools commands are available __import__('setuptools') > yield setuptools/sandbox.py:198: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setup_script = '/tmp/tmpayn0o6ka/test_pkg/setup.py', args = ['--name'] def run_setup(setup_script, args): """Run a distutils setup script, sandboxed in its directory""" setup_dir = os.path.abspath(os.path.dirname(setup_script)) with setup_context(setup_dir): try: sys.argv[:] = [setup_script] + list(args) sys.path.insert(0, setup_dir) # reset to include setup dir, w/clean callback list working_set.__init__() working_set.callbacks.append(lambda dist: dist.activate()) with DirectorySandbox(setup_dir): ns = dict(__file__=setup_script, __name__='__main__') > _execfile(setup_script, ns) setuptools/sandbox.py:259: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ filename = '/tmp/tmpayn0o6ka/test_pkg/setup.py' globals = {'__builtins__': {'ArithmeticError': , 'AssertionError': , 'Attribute...__', 'setuptools': } locals = {'__builtins__': {'ArithmeticError': , 'AssertionError': , 'Attribute...__', 'setuptools': } def _execfile(filename, globals, locals=None): """ Python 3 implementation of execfile. """ mode = 'rb' with open(filename, mode) as stream: script = stream.read() if locals is None: locals = globals code = compile(script, filename, 'exec') > exec(code, globals, locals) setuptools/sandbox.py:46: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > ??? /tmp/tmpayn0o6ka/test_pkg/setup.py:2: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ attrs = {'dependency_links': ['/tmp/tmpayn0o6ka'], 'name': 'test_pkg', 'setup_requires': ['foobar==0.1'], 'version': '0.0'} def setup(**attrs): # Make sure we have any requirements needed to interpret 'attrs'. logging.configure() > _install_setup_requires(attrs) setuptools/__init__.py:86: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ attrs = {'dependency_links': ['/tmp/tmpayn0o6ka'], 'name': 'test_pkg', 'setup_requires': ['foobar==0.1'], 'version': '0.0'} def _install_setup_requires(attrs): # Note: do not use `setuptools.Distribution` directly, as # our PEP 517 backend patch `distutils.core.Distribution`. class MinimalDistribution(distutils.core.Distribution): """ A minimal version of a distribution for supporting the fetch_build_eggs interface. """ def __init__(self, attrs): _incl = 'dependency_links', 'setup_requires' filtered = {k: attrs[k] for k in set(_incl) & set(attrs)} super().__init__(filtered) # Prevent accidentally triggering discovery with incomplete set of attrs self.set_defaults._disable() def _get_project_config_files(self, filenames=None): """Ignore ``pyproject.toml``, they are not related to setup_requires""" try: cfg, toml = super()._split_standard_project_metadata(filenames) return cfg, () except Exception: return filenames, () def finalize_options(self): """ Disable finalize_options to avoid building the working set. Ref #2158. """ dist = MinimalDistribution(attrs) # Honor setup.cfg's options. dist.parse_config_files(ignore_option_errors=True) if dist.setup_requires: > dist.fetch_build_eggs(dist.setup_requires) setuptools/__init__.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .MinimalDistribution object at 0x7ffb60800610>, requires = ['foobar==0.1'] def fetch_build_eggs(self, requires): """Resolve pre-setup requirements""" > resolved_dists = pkg_resources.working_set.resolve( _reqs.parse(requires), installer=self.fetch_build_egg, replace_conflicting=True, ) setuptools/dist.py:876: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , requirements = [], env = None installer = .MinimalDistribution object at 0x7ffb60800610>> replace_conflicting = True, extras = None def resolve(self, requirements, env=None, installer=None, # noqa: C901 replace_conflicting=False, extras=None): """List all distributions needed to (recursively) meet `requirements` `requirements` must be a sequence of ``Requirement`` objects. `env`, if supplied, should be an ``Environment`` instance. If not supplied, it defaults to all distributions available within any entry or distribution in the working set. `installer`, if supplied, will be invoked with each requirement that cannot be met by an already-installed distribution; it should return a ``Distribution`` or ``None``. Unless `replace_conflicting=True`, raises a VersionConflict exception if any requirements are found on the path that have the correct name but the wrong version. Otherwise, if an `installer` is supplied it will be invoked to obtain the correct version of the requirement and activate it. `extras` is a list of the extras to be used with these requirements. This is important because extra requirements may look like `my_req; extra = "my_extra"`, which would otherwise be interpreted as a purely optional requirement. Instead, we want to be able to assert that these requirements are truly required. """ # set up the stack requirements = list(requirements)[::-1] # set of processed requirements processed = {} # key -> dist best = {} to_activate = [] req_extras = _ReqExtras() # Mapping of requirement to set of distributions that required it; # useful for reporting info about conflicts. required_by = collections.defaultdict(set) while requirements: # process dependencies breadth-first req = requirements.pop(0) if req in processed: # Ignore cyclic or redundant dependencies continue if not req_extras.markers_pass(req, extras): continue dist = best.get(req.key) if dist is None: # Find the best distribution and add it to the map dist = self.by_key.get(req.key) if dist is None or (dist not in req and replace_conflicting): ws = self if env is None: if dist is None: > env = Environment(self.entries) pkg_resources/__init__.py:782: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = search_path = ['does-not-matter', '/home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4', '/usr/bin', '/home/tkloczko/rpmbuild/BUILDROOT/...uild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages', '/usr/lib64/python38.zip', ...] platform = 'linux-x86_64', python = '3.8' def __init__( self, search_path=None, platform=get_supported_platform(), python=PY_MAJOR): """Snapshot distributions available on a search path Any distributions found on `search_path` are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. `platform` is an optional string specifying the name of the platform that platform-specific distributions must be compatible with. If unspecified, it defaults to the current platform. `python` is an optional string naming the desired version of Python (e.g. ``'3.6'``); it defaults to the current version. You may explicitly set `platform` (and/or `python`) to ``None`` if you wish to map *all* distributions, not just those compatible with the running platform or Python version. """ self._distmap = {} self.platform = platform self.python = python > self.scan(search_path) pkg_resources/__init__.py:994: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = search_path = ['does-not-matter', '/home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4', '/usr/bin', '/home/tkloczko/rpmbuild/BUILDROOT/...uild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages', '/usr/lib64/python38.zip', ...] def scan(self, search_path=None): """Scan `search_path` for distributions usable in this environment Any distributions found are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. Only distributions conforming to the platform/python version defined at initialization are added. """ if search_path is None: search_path = sys.path for item in search_path: for dist in find_distributions(item): > self.add(dist) pkg_resources/__init__.py:1027: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , dist = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) def add(self, dist): """Add `dist` if we ``can_add()`` it and it has not already been added """ if self.can_add(dist) and dist.has_version(): dists = self._distmap.setdefault(dist.key, []) if dist not in dists: dists.append(dist) > dists.sort(key=operator.attrgetter('hashcmp'), reverse=True) pkg_resources/__init__.py:1047: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) @property def hashcmp(self): return ( > self.parsed_version, self.precedence, self.key, self.location, self.py_version or '', self.platform or '', ) pkg_resources/__init__.py:2620: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) @property def parsed_version(self): if not hasattr(self, "_parsed_version"): > self._parsed_version = parse_version(self.version) pkg_resources/__init__.py:2667: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ v = '1.17.1-unknown' def parse_version(v): try: return packaging.version.Version(v) except packaging.version.InvalidVersion: warnings.warn( f"{v} is an invalid version and will not be supported in " "a future release", PkgResourcesDeprecationWarning, ) > return packaging.version.LegacyVersion(v) pkg_resources/__init__.py:128: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , version = '1.17.1-unknown' def __init__(self, version: str) -> None: self._version = str(version) self._key = _legacy_cmpkey(self._version) > warnings.warn( "Creating a LegacyVersion has been deprecated and will be " "removed in the next major release", DeprecationWarning, ) E DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release pkg_resources/_vendor/packaging/version.py:111: DeprecationWarning During handling of the above exception, another exception occurred: self = , use_setup_cfg = () @pytest.mark.parametrize('use_setup_cfg', use_setup_cfg) def test_setup_requires_overrides_version_conflict(self, use_setup_cfg): """ Regression test for distribution issue 323: https://bitbucket.org/tarek/distribute/issues/323 Ensures that a distribution's setup_requires requirements can still be installed and used locally even if a conflicting version of that requirement is already on the path. """ fake_dist = PRDistribution('does-not-matter', project_name='foobar', version='0.0') working_set.add(fake_dist) with contexts.save_pkg_resources_state(): with contexts.tempdir() as temp_dir: test_pkg = create_setup_requires_package( temp_dir, use_setup_cfg=use_setup_cfg) test_setup_py = os.path.join(test_pkg, 'setup.py') with contexts.quiet() as (stdout, stderr): # Don't even need to install the package, just # running the setup.py at all is sufficient > run_setup(test_setup_py, [str('--name')]) setuptools/tests/test_easy_install.py:595: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setuptools/sandbox.py:262: in run_setup raise /usr/lib64/python3.8/contextlib.py:131: in __exit__ self.gen.throw(type, value, traceback) setuptools/sandbox.py:198: in setup_context yield /usr/lib64/python3.8/contextlib.py:131: in __exit__ self.gen.throw(type, value, traceback) setuptools/sandbox.py:169: in save_modules saved_exc.resume() setuptools/sandbox.py:143: in resume raise exc.with_traceback(self._tb) setuptools/sandbox.py:156: in save_modules yield saved setuptools/sandbox.py:198: in setup_context yield setuptools/sandbox.py:259: in run_setup _execfile(setup_script, ns) setuptools/sandbox.py:46: in _execfile exec(code, globals, locals) /tmp/tmpayn0o6ka/test_pkg/setup.py:2: in ??? setuptools/__init__.py:86: in setup _install_setup_requires(attrs) setuptools/__init__.py:80: in _install_setup_requires dist.fetch_build_eggs(dist.setup_requires) setuptools/dist.py:876: in fetch_build_eggs resolved_dists = pkg_resources.working_set.resolve( pkg_resources/__init__.py:782: in resolve env = Environment(self.entries) pkg_resources/__init__.py:994: in __init__ self.scan(search_path) pkg_resources/__init__.py:1027: in scan self.add(dist) pkg_resources/__init__.py:1047: in add dists.sort(key=operator.attrgetter('hashcmp'), reverse=True) pkg_resources/__init__.py:2620: in hashcmp self.parsed_version, pkg_resources/__init__.py:2667: in parsed_version self._parsed_version = parse_version(self.version) pkg_resources/__init__.py:128: in parse_version return packaging.version.LegacyVersion(v) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , version = '1.17.1-unknown' def __init__(self, version: str) -> None: self._version = str(version) self._key = _legacy_cmpkey(self._version) > warnings.warn( "Creating a LegacyVersion has been deprecated and will be " "removed in the next major release", DeprecationWarning, ) E DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release pkg_resources/_vendor/packaging/version.py:111: DeprecationWarning ______________________________________ TestSetupRequires.test_setup_requires_overrides_version_conflict[use_setup_cfg1] ______________________________________ v = '1.17.1-unknown' def parse_version(v): try: > return packaging.version.Version(v) pkg_resources/__init__.py:121: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'Version' object has no attribute '_version'") raised in repr()] Version object at 0x7ffb6025e610>, version = '1.17.1-unknown' def __init__(self, version: str) -> None: # Validate the version and parse it into pieces match = self._regex.search(version) if not match: > raise InvalidVersion(f"Invalid version: '{version}'") E pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: '1.17.1-unknown' pkg_resources/_vendor/packaging/version.py:266: InvalidVersion During handling of the above exception, another exception occurred: @contextlib.contextmanager def save_modules(): """ Context in which imported modules are saved. Translates exceptions internal to the context into the equivalent exception outside the context. """ saved = sys.modules.copy() with ExceptionSaver() as saved_exc: > yield saved setuptools/sandbox.py:156: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setup_dir = '/tmp/tmp2jtzw4b2/test_pkg' @contextlib.contextmanager def setup_context(setup_dir): temp_dir = os.path.join(setup_dir, 'temp') with save_pkg_resources_state(): with save_modules(): with save_path(): hide_setuptools() with save_argv(): with override_temp(temp_dir): with pushd(setup_dir): # ensure setuptools commands are available __import__('setuptools') > yield setuptools/sandbox.py:198: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setup_script = '/tmp/tmp2jtzw4b2/test_pkg/setup.py', args = ['--name'] def run_setup(setup_script, args): """Run a distutils setup script, sandboxed in its directory""" setup_dir = os.path.abspath(os.path.dirname(setup_script)) with setup_context(setup_dir): try: sys.argv[:] = [setup_script] + list(args) sys.path.insert(0, setup_dir) # reset to include setup dir, w/clean callback list working_set.__init__() working_set.callbacks.append(lambda dist: dist.activate()) with DirectorySandbox(setup_dir): ns = dict(__file__=setup_script, __name__='__main__') > _execfile(setup_script, ns) setuptools/sandbox.py:259: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ filename = '/tmp/tmp2jtzw4b2/test_pkg/setup.py' globals = {'__builtins__': {'ArithmeticError': , 'AssertionError': , 'Attribute...__', 'setuptools': } locals = {'__builtins__': {'ArithmeticError': , 'AssertionError': , 'Attribute...__', 'setuptools': } def _execfile(filename, globals, locals=None): """ Python 3 implementation of execfile. """ mode = 'rb' with open(filename, mode) as stream: script = stream.read() if locals is None: locals = globals code = compile(script, filename, 'exec') > exec(code, globals, locals) setuptools/sandbox.py:46: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > ??? /tmp/tmp2jtzw4b2/test_pkg/setup.py:2: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ attrs = {'name': 'test_pkg', 'setup_requires': ['foobar==0.1'], 'version': '0.0'} def setup(**attrs): # Make sure we have any requirements needed to interpret 'attrs'. logging.configure() > _install_setup_requires(attrs) setuptools/__init__.py:86: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ attrs = {'name': 'test_pkg', 'setup_requires': ['foobar==0.1'], 'version': '0.0'} def _install_setup_requires(attrs): # Note: do not use `setuptools.Distribution` directly, as # our PEP 517 backend patch `distutils.core.Distribution`. class MinimalDistribution(distutils.core.Distribution): """ A minimal version of a distribution for supporting the fetch_build_eggs interface. """ def __init__(self, attrs): _incl = 'dependency_links', 'setup_requires' filtered = {k: attrs[k] for k in set(_incl) & set(attrs)} super().__init__(filtered) # Prevent accidentally triggering discovery with incomplete set of attrs self.set_defaults._disable() def _get_project_config_files(self, filenames=None): """Ignore ``pyproject.toml``, they are not related to setup_requires""" try: cfg, toml = super()._split_standard_project_metadata(filenames) return cfg, () except Exception: return filenames, () def finalize_options(self): """ Disable finalize_options to avoid building the working set. Ref #2158. """ dist = MinimalDistribution(attrs) # Honor setup.cfg's options. dist.parse_config_files(ignore_option_errors=True) if dist.setup_requires: > dist.fetch_build_eggs(dist.setup_requires) setuptools/__init__.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .MinimalDistribution object at 0x7ffb60409ca0>, requires = ['foobar==0.1'] def fetch_build_eggs(self, requires): """Resolve pre-setup requirements""" > resolved_dists = pkg_resources.working_set.resolve( _reqs.parse(requires), installer=self.fetch_build_egg, replace_conflicting=True, ) setuptools/dist.py:876: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , requirements = [], env = None installer = .MinimalDistribution object at 0x7ffb60409ca0>> replace_conflicting = True, extras = None def resolve(self, requirements, env=None, installer=None, # noqa: C901 replace_conflicting=False, extras=None): """List all distributions needed to (recursively) meet `requirements` `requirements` must be a sequence of ``Requirement`` objects. `env`, if supplied, should be an ``Environment`` instance. If not supplied, it defaults to all distributions available within any entry or distribution in the working set. `installer`, if supplied, will be invoked with each requirement that cannot be met by an already-installed distribution; it should return a ``Distribution`` or ``None``. Unless `replace_conflicting=True`, raises a VersionConflict exception if any requirements are found on the path that have the correct name but the wrong version. Otherwise, if an `installer` is supplied it will be invoked to obtain the correct version of the requirement and activate it. `extras` is a list of the extras to be used with these requirements. This is important because extra requirements may look like `my_req; extra = "my_extra"`, which would otherwise be interpreted as a purely optional requirement. Instead, we want to be able to assert that these requirements are truly required. """ # set up the stack requirements = list(requirements)[::-1] # set of processed requirements processed = {} # key -> dist best = {} to_activate = [] req_extras = _ReqExtras() # Mapping of requirement to set of distributions that required it; # useful for reporting info about conflicts. required_by = collections.defaultdict(set) while requirements: # process dependencies breadth-first req = requirements.pop(0) if req in processed: # Ignore cyclic or redundant dependencies continue if not req_extras.markers_pass(req, extras): continue dist = best.get(req.key) if dist is None: # Find the best distribution and add it to the map dist = self.by_key.get(req.key) if dist is None or (dist not in req and replace_conflicting): ws = self if env is None: if dist is None: > env = Environment(self.entries) pkg_resources/__init__.py:782: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = search_path = ['does-not-matter', '/home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4', '/usr/bin', '/home/tkloczko/rpmbuild/BUILDROOT/...uild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages', '/usr/lib64/python38.zip', ...] platform = 'linux-x86_64', python = '3.8' def __init__( self, search_path=None, platform=get_supported_platform(), python=PY_MAJOR): """Snapshot distributions available on a search path Any distributions found on `search_path` are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. `platform` is an optional string specifying the name of the platform that platform-specific distributions must be compatible with. If unspecified, it defaults to the current platform. `python` is an optional string naming the desired version of Python (e.g. ``'3.6'``); it defaults to the current version. You may explicitly set `platform` (and/or `python`) to ``None`` if you wish to map *all* distributions, not just those compatible with the running platform or Python version. """ self._distmap = {} self.platform = platform self.python = python > self.scan(search_path) pkg_resources/__init__.py:994: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = search_path = ['does-not-matter', '/home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4', '/usr/bin', '/home/tkloczko/rpmbuild/BUILDROOT/...uild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages', '/usr/lib64/python38.zip', ...] def scan(self, search_path=None): """Scan `search_path` for distributions usable in this environment Any distributions found are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. Only distributions conforming to the platform/python version defined at initialization are added. """ if search_path is None: search_path = sys.path for item in search_path: for dist in find_distributions(item): > self.add(dist) pkg_resources/__init__.py:1027: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , dist = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) def add(self, dist): """Add `dist` if we ``can_add()`` it and it has not already been added """ if self.can_add(dist) and dist.has_version(): dists = self._distmap.setdefault(dist.key, []) if dist not in dists: dists.append(dist) > dists.sort(key=operator.attrgetter('hashcmp'), reverse=True) pkg_resources/__init__.py:1047: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) @property def hashcmp(self): return ( > self.parsed_version, self.precedence, self.key, self.location, self.py_version or '', self.platform or '', ) pkg_resources/__init__.py:2620: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) @property def parsed_version(self): if not hasattr(self, "_parsed_version"): > self._parsed_version = parse_version(self.version) pkg_resources/__init__.py:2667: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ v = '1.17.1-unknown' def parse_version(v): try: return packaging.version.Version(v) except packaging.version.InvalidVersion: warnings.warn( f"{v} is an invalid version and will not be supported in " "a future release", PkgResourcesDeprecationWarning, ) > return packaging.version.LegacyVersion(v) pkg_resources/__init__.py:128: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , version = '1.17.1-unknown' def __init__(self, version: str) -> None: self._version = str(version) self._key = _legacy_cmpkey(self._version) > warnings.warn( "Creating a LegacyVersion has been deprecated and will be " "removed in the next major release", DeprecationWarning, ) E DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release pkg_resources/_vendor/packaging/version.py:111: DeprecationWarning During handling of the above exception, another exception occurred: self = , use_setup_cfg = ('dependency_links',) @pytest.mark.parametrize('use_setup_cfg', use_setup_cfg) def test_setup_requires_overrides_version_conflict(self, use_setup_cfg): """ Regression test for distribution issue 323: https://bitbucket.org/tarek/distribute/issues/323 Ensures that a distribution's setup_requires requirements can still be installed and used locally even if a conflicting version of that requirement is already on the path. """ fake_dist = PRDistribution('does-not-matter', project_name='foobar', version='0.0') working_set.add(fake_dist) with contexts.save_pkg_resources_state(): with contexts.tempdir() as temp_dir: test_pkg = create_setup_requires_package( temp_dir, use_setup_cfg=use_setup_cfg) test_setup_py = os.path.join(test_pkg, 'setup.py') with contexts.quiet() as (stdout, stderr): # Don't even need to install the package, just # running the setup.py at all is sufficient > run_setup(test_setup_py, [str('--name')]) setuptools/tests/test_easy_install.py:595: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setuptools/sandbox.py:262: in run_setup raise /usr/lib64/python3.8/contextlib.py:131: in __exit__ self.gen.throw(type, value, traceback) setuptools/sandbox.py:198: in setup_context yield /usr/lib64/python3.8/contextlib.py:131: in __exit__ self.gen.throw(type, value, traceback) setuptools/sandbox.py:169: in save_modules saved_exc.resume() setuptools/sandbox.py:143: in resume raise exc.with_traceback(self._tb) setuptools/sandbox.py:156: in save_modules yield saved setuptools/sandbox.py:198: in setup_context yield setuptools/sandbox.py:259: in run_setup _execfile(setup_script, ns) setuptools/sandbox.py:46: in _execfile exec(code, globals, locals) /tmp/tmp2jtzw4b2/test_pkg/setup.py:2: in ??? setuptools/__init__.py:86: in setup _install_setup_requires(attrs) setuptools/__init__.py:80: in _install_setup_requires dist.fetch_build_eggs(dist.setup_requires) setuptools/dist.py:876: in fetch_build_eggs resolved_dists = pkg_resources.working_set.resolve( pkg_resources/__init__.py:782: in resolve env = Environment(self.entries) pkg_resources/__init__.py:994: in __init__ self.scan(search_path) pkg_resources/__init__.py:1027: in scan self.add(dist) pkg_resources/__init__.py:1047: in add dists.sort(key=operator.attrgetter('hashcmp'), reverse=True) pkg_resources/__init__.py:2620: in hashcmp self.parsed_version, pkg_resources/__init__.py:2667: in parsed_version self._parsed_version = parse_version(self.version) pkg_resources/__init__.py:128: in parse_version return packaging.version.LegacyVersion(v) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , version = '1.17.1-unknown' def __init__(self, version: str) -> None: self._version = str(version) self._key = _legacy_cmpkey(self._version) > warnings.warn( "Creating a LegacyVersion has been deprecated and will be " "removed in the next major release", DeprecationWarning, ) E DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release pkg_resources/_vendor/packaging/version.py:111: DeprecationWarning ______________________________________ TestSetupRequires.test_setup_requires_overrides_version_conflict[use_setup_cfg2] ______________________________________ v = '1.17.1-unknown' def parse_version(v): try: > return packaging.version.Version(v) pkg_resources/__init__.py:121: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'Version' object has no attribute '_version'") raised in repr()] Version object at 0x7ffb53c3e640>, version = '1.17.1-unknown' def __init__(self, version: str) -> None: # Validate the version and parse it into pieces match = self._regex.search(version) if not match: > raise InvalidVersion(f"Invalid version: '{version}'") E pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: '1.17.1-unknown' pkg_resources/_vendor/packaging/version.py:266: InvalidVersion During handling of the above exception, another exception occurred: @contextlib.contextmanager def save_modules(): """ Context in which imported modules are saved. Translates exceptions internal to the context into the equivalent exception outside the context. """ saved = sys.modules.copy() with ExceptionSaver() as saved_exc: > yield saved setuptools/sandbox.py:156: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setup_dir = '/tmp/tmp8gpfqr7x/test_pkg' @contextlib.contextmanager def setup_context(setup_dir): temp_dir = os.path.join(setup_dir, 'temp') with save_pkg_resources_state(): with save_modules(): with save_path(): hide_setuptools() with save_argv(): with override_temp(temp_dir): with pushd(setup_dir): # ensure setuptools commands are available __import__('setuptools') > yield setuptools/sandbox.py:198: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setup_script = '/tmp/tmp8gpfqr7x/test_pkg/setup.py', args = ['--name'] def run_setup(setup_script, args): """Run a distutils setup script, sandboxed in its directory""" setup_dir = os.path.abspath(os.path.dirname(setup_script)) with setup_context(setup_dir): try: sys.argv[:] = [setup_script] + list(args) sys.path.insert(0, setup_dir) # reset to include setup dir, w/clean callback list working_set.__init__() working_set.callbacks.append(lambda dist: dist.activate()) with DirectorySandbox(setup_dir): ns = dict(__file__=setup_script, __name__='__main__') > _execfile(setup_script, ns) setuptools/sandbox.py:259: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ filename = '/tmp/tmp8gpfqr7x/test_pkg/setup.py' globals = {'__builtins__': {'ArithmeticError': , 'AssertionError': , 'Attribute...__', 'setuptools': } locals = {'__builtins__': {'ArithmeticError': , 'AssertionError': , 'Attribute...__', 'setuptools': } def _execfile(filename, globals, locals=None): """ Python 3 implementation of execfile. """ mode = 'rb' with open(filename, mode) as stream: script = stream.read() if locals is None: locals = globals code = compile(script, filename, 'exec') > exec(code, globals, locals) setuptools/sandbox.py:46: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > ??? /tmp/tmp8gpfqr7x/test_pkg/setup.py:2: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ attrs = {'dependency_links': ['/tmp/tmp8gpfqr7x'], 'name': 'test_pkg', 'version': '0.0'} def setup(**attrs): # Make sure we have any requirements needed to interpret 'attrs'. logging.configure() > _install_setup_requires(attrs) setuptools/__init__.py:86: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ attrs = {'dependency_links': ['/tmp/tmp8gpfqr7x'], 'name': 'test_pkg', 'version': '0.0'} def _install_setup_requires(attrs): # Note: do not use `setuptools.Distribution` directly, as # our PEP 517 backend patch `distutils.core.Distribution`. class MinimalDistribution(distutils.core.Distribution): """ A minimal version of a distribution for supporting the fetch_build_eggs interface. """ def __init__(self, attrs): _incl = 'dependency_links', 'setup_requires' filtered = {k: attrs[k] for k in set(_incl) & set(attrs)} super().__init__(filtered) # Prevent accidentally triggering discovery with incomplete set of attrs self.set_defaults._disable() def _get_project_config_files(self, filenames=None): """Ignore ``pyproject.toml``, they are not related to setup_requires""" try: cfg, toml = super()._split_standard_project_metadata(filenames) return cfg, () except Exception: return filenames, () def finalize_options(self): """ Disable finalize_options to avoid building the working set. Ref #2158. """ dist = MinimalDistribution(attrs) # Honor setup.cfg's options. dist.parse_config_files(ignore_option_errors=True) if dist.setup_requires: > dist.fetch_build_eggs(dist.setup_requires) setuptools/__init__.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .MinimalDistribution object at 0x7ffb53fb4a90>, requires = ['foobar==0.1'] def fetch_build_eggs(self, requires): """Resolve pre-setup requirements""" > resolved_dists = pkg_resources.working_set.resolve( _reqs.parse(requires), installer=self.fetch_build_egg, replace_conflicting=True, ) setuptools/dist.py:876: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , requirements = [], env = None installer = .MinimalDistribution object at 0x7ffb53fb4a90>> replace_conflicting = True, extras = None def resolve(self, requirements, env=None, installer=None, # noqa: C901 replace_conflicting=False, extras=None): """List all distributions needed to (recursively) meet `requirements` `requirements` must be a sequence of ``Requirement`` objects. `env`, if supplied, should be an ``Environment`` instance. If not supplied, it defaults to all distributions available within any entry or distribution in the working set. `installer`, if supplied, will be invoked with each requirement that cannot be met by an already-installed distribution; it should return a ``Distribution`` or ``None``. Unless `replace_conflicting=True`, raises a VersionConflict exception if any requirements are found on the path that have the correct name but the wrong version. Otherwise, if an `installer` is supplied it will be invoked to obtain the correct version of the requirement and activate it. `extras` is a list of the extras to be used with these requirements. This is important because extra requirements may look like `my_req; extra = "my_extra"`, which would otherwise be interpreted as a purely optional requirement. Instead, we want to be able to assert that these requirements are truly required. """ # set up the stack requirements = list(requirements)[::-1] # set of processed requirements processed = {} # key -> dist best = {} to_activate = [] req_extras = _ReqExtras() # Mapping of requirement to set of distributions that required it; # useful for reporting info about conflicts. required_by = collections.defaultdict(set) while requirements: # process dependencies breadth-first req = requirements.pop(0) if req in processed: # Ignore cyclic or redundant dependencies continue if not req_extras.markers_pass(req, extras): continue dist = best.get(req.key) if dist is None: # Find the best distribution and add it to the map dist = self.by_key.get(req.key) if dist is None or (dist not in req and replace_conflicting): ws = self if env is None: if dist is None: > env = Environment(self.entries) pkg_resources/__init__.py:782: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = search_path = ['does-not-matter', '/home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4', '/usr/bin', '/home/tkloczko/rpmbuild/BUILDROOT/...uild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages', '/usr/lib64/python38.zip', ...] platform = 'linux-x86_64', python = '3.8' def __init__( self, search_path=None, platform=get_supported_platform(), python=PY_MAJOR): """Snapshot distributions available on a search path Any distributions found on `search_path` are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. `platform` is an optional string specifying the name of the platform that platform-specific distributions must be compatible with. If unspecified, it defaults to the current platform. `python` is an optional string naming the desired version of Python (e.g. ``'3.6'``); it defaults to the current version. You may explicitly set `platform` (and/or `python`) to ``None`` if you wish to map *all* distributions, not just those compatible with the running platform or Python version. """ self._distmap = {} self.platform = platform self.python = python > self.scan(search_path) pkg_resources/__init__.py:994: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = search_path = ['does-not-matter', '/home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4', '/usr/bin', '/home/tkloczko/rpmbuild/BUILDROOT/...uild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages', '/usr/lib64/python38.zip', ...] def scan(self, search_path=None): """Scan `search_path` for distributions usable in this environment Any distributions found are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. Only distributions conforming to the platform/python version defined at initialization are added. """ if search_path is None: search_path = sys.path for item in search_path: for dist in find_distributions(item): > self.add(dist) pkg_resources/__init__.py:1027: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , dist = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) def add(self, dist): """Add `dist` if we ``can_add()`` it and it has not already been added """ if self.can_add(dist) and dist.has_version(): dists = self._distmap.setdefault(dist.key, []) if dist not in dists: dists.append(dist) > dists.sort(key=operator.attrgetter('hashcmp'), reverse=True) pkg_resources/__init__.py:1047: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) @property def hashcmp(self): return ( > self.parsed_version, self.precedence, self.key, self.location, self.py_version or '', self.platform or '', ) pkg_resources/__init__.py:2620: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) @property def parsed_version(self): if not hasattr(self, "_parsed_version"): > self._parsed_version = parse_version(self.version) pkg_resources/__init__.py:2667: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ v = '1.17.1-unknown' def parse_version(v): try: return packaging.version.Version(v) except packaging.version.InvalidVersion: warnings.warn( f"{v} is an invalid version and will not be supported in " "a future release", PkgResourcesDeprecationWarning, ) > return packaging.version.LegacyVersion(v) pkg_resources/__init__.py:128: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , version = '1.17.1-unknown' def __init__(self, version: str) -> None: self._version = str(version) self._key = _legacy_cmpkey(self._version) > warnings.warn( "Creating a LegacyVersion has been deprecated and will be " "removed in the next major release", DeprecationWarning, ) E DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release pkg_resources/_vendor/packaging/version.py:111: DeprecationWarning During handling of the above exception, another exception occurred: self = , use_setup_cfg = ('setup_requires',) @pytest.mark.parametrize('use_setup_cfg', use_setup_cfg) def test_setup_requires_overrides_version_conflict(self, use_setup_cfg): """ Regression test for distribution issue 323: https://bitbucket.org/tarek/distribute/issues/323 Ensures that a distribution's setup_requires requirements can still be installed and used locally even if a conflicting version of that requirement is already on the path. """ fake_dist = PRDistribution('does-not-matter', project_name='foobar', version='0.0') working_set.add(fake_dist) with contexts.save_pkg_resources_state(): with contexts.tempdir() as temp_dir: test_pkg = create_setup_requires_package( temp_dir, use_setup_cfg=use_setup_cfg) test_setup_py = os.path.join(test_pkg, 'setup.py') with contexts.quiet() as (stdout, stderr): # Don't even need to install the package, just # running the setup.py at all is sufficient > run_setup(test_setup_py, [str('--name')]) setuptools/tests/test_easy_install.py:595: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setuptools/sandbox.py:262: in run_setup raise /usr/lib64/python3.8/contextlib.py:131: in __exit__ self.gen.throw(type, value, traceback) setuptools/sandbox.py:198: in setup_context yield /usr/lib64/python3.8/contextlib.py:131: in __exit__ self.gen.throw(type, value, traceback) setuptools/sandbox.py:169: in save_modules saved_exc.resume() setuptools/sandbox.py:143: in resume raise exc.with_traceback(self._tb) setuptools/sandbox.py:156: in save_modules yield saved setuptools/sandbox.py:198: in setup_context yield setuptools/sandbox.py:259: in run_setup _execfile(setup_script, ns) setuptools/sandbox.py:46: in _execfile exec(code, globals, locals) /tmp/tmp8gpfqr7x/test_pkg/setup.py:2: in ??? setuptools/__init__.py:86: in setup _install_setup_requires(attrs) setuptools/__init__.py:80: in _install_setup_requires dist.fetch_build_eggs(dist.setup_requires) setuptools/dist.py:876: in fetch_build_eggs resolved_dists = pkg_resources.working_set.resolve( pkg_resources/__init__.py:782: in resolve env = Environment(self.entries) pkg_resources/__init__.py:994: in __init__ self.scan(search_path) pkg_resources/__init__.py:1027: in scan self.add(dist) pkg_resources/__init__.py:1047: in add dists.sort(key=operator.attrgetter('hashcmp'), reverse=True) pkg_resources/__init__.py:2620: in hashcmp self.parsed_version, pkg_resources/__init__.py:2667: in parsed_version self._parsed_version = parse_version(self.version) pkg_resources/__init__.py:128: in parse_version return packaging.version.LegacyVersion(v) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , version = '1.17.1-unknown' def __init__(self, version: str) -> None: self._version = str(version) self._key = _legacy_cmpkey(self._version) > warnings.warn( "Creating a LegacyVersion has been deprecated and will be " "removed in the next major release", DeprecationWarning, ) E DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release pkg_resources/_vendor/packaging/version.py:111: DeprecationWarning ______________________________________ TestSetupRequires.test_setup_requires_overrides_version_conflict[use_setup_cfg3] ______________________________________ v = '1.17.1-unknown' def parse_version(v): try: > return packaging.version.Version(v) pkg_resources/__init__.py:121: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'Version' object has no attribute '_version'") raised in repr()] Version object at 0x7ffb53587ac0>, version = '1.17.1-unknown' def __init__(self, version: str) -> None: # Validate the version and parse it into pieces match = self._regex.search(version) if not match: > raise InvalidVersion(f"Invalid version: '{version}'") E pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: '1.17.1-unknown' pkg_resources/_vendor/packaging/version.py:266: InvalidVersion During handling of the above exception, another exception occurred: @contextlib.contextmanager def save_modules(): """ Context in which imported modules are saved. Translates exceptions internal to the context into the equivalent exception outside the context. """ saved = sys.modules.copy() with ExceptionSaver() as saved_exc: > yield saved setuptools/sandbox.py:156: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setup_dir = '/tmp/tmpv5_l0twi/test_pkg' @contextlib.contextmanager def setup_context(setup_dir): temp_dir = os.path.join(setup_dir, 'temp') with save_pkg_resources_state(): with save_modules(): with save_path(): hide_setuptools() with save_argv(): with override_temp(temp_dir): with pushd(setup_dir): # ensure setuptools commands are available __import__('setuptools') > yield setuptools/sandbox.py:198: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setup_script = '/tmp/tmpv5_l0twi/test_pkg/setup.py', args = ['--name'] def run_setup(setup_script, args): """Run a distutils setup script, sandboxed in its directory""" setup_dir = os.path.abspath(os.path.dirname(setup_script)) with setup_context(setup_dir): try: sys.argv[:] = [setup_script] + list(args) sys.path.insert(0, setup_dir) # reset to include setup dir, w/clean callback list working_set.__init__() working_set.callbacks.append(lambda dist: dist.activate()) with DirectorySandbox(setup_dir): ns = dict(__file__=setup_script, __name__='__main__') > _execfile(setup_script, ns) setuptools/sandbox.py:259: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ filename = '/tmp/tmpv5_l0twi/test_pkg/setup.py' globals = {'__builtins__': {'ArithmeticError': , 'AssertionError': , 'Attribute...__', 'setuptools': } locals = {'__builtins__': {'ArithmeticError': , 'AssertionError': , 'Attribute...__', 'setuptools': } def _execfile(filename, globals, locals=None): """ Python 3 implementation of execfile. """ mode = 'rb' with open(filename, mode) as stream: script = stream.read() if locals is None: locals = globals code = compile(script, filename, 'exec') > exec(code, globals, locals) setuptools/sandbox.py:46: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > ??? /tmp/tmpv5_l0twi/test_pkg/setup.py:2: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ attrs = {'name': 'test_pkg', 'version': '0.0'} def setup(**attrs): # Make sure we have any requirements needed to interpret 'attrs'. logging.configure() > _install_setup_requires(attrs) setuptools/__init__.py:86: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ attrs = {'name': 'test_pkg', 'version': '0.0'} def _install_setup_requires(attrs): # Note: do not use `setuptools.Distribution` directly, as # our PEP 517 backend patch `distutils.core.Distribution`. class MinimalDistribution(distutils.core.Distribution): """ A minimal version of a distribution for supporting the fetch_build_eggs interface. """ def __init__(self, attrs): _incl = 'dependency_links', 'setup_requires' filtered = {k: attrs[k] for k in set(_incl) & set(attrs)} super().__init__(filtered) # Prevent accidentally triggering discovery with incomplete set of attrs self.set_defaults._disable() def _get_project_config_files(self, filenames=None): """Ignore ``pyproject.toml``, they are not related to setup_requires""" try: cfg, toml = super()._split_standard_project_metadata(filenames) return cfg, () except Exception: return filenames, () def finalize_options(self): """ Disable finalize_options to avoid building the working set. Ref #2158. """ dist = MinimalDistribution(attrs) # Honor setup.cfg's options. dist.parse_config_files(ignore_option_errors=True) if dist.setup_requires: > dist.fetch_build_eggs(dist.setup_requires) setuptools/__init__.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .MinimalDistribution object at 0x7ffb538e46a0>, requires = ['foobar==0.1'] def fetch_build_eggs(self, requires): """Resolve pre-setup requirements""" > resolved_dists = pkg_resources.working_set.resolve( _reqs.parse(requires), installer=self.fetch_build_egg, replace_conflicting=True, ) setuptools/dist.py:876: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , requirements = [], env = None installer = .MinimalDistribution object at 0x7ffb538e46a0>> replace_conflicting = True, extras = None def resolve(self, requirements, env=None, installer=None, # noqa: C901 replace_conflicting=False, extras=None): """List all distributions needed to (recursively) meet `requirements` `requirements` must be a sequence of ``Requirement`` objects. `env`, if supplied, should be an ``Environment`` instance. If not supplied, it defaults to all distributions available within any entry or distribution in the working set. `installer`, if supplied, will be invoked with each requirement that cannot be met by an already-installed distribution; it should return a ``Distribution`` or ``None``. Unless `replace_conflicting=True`, raises a VersionConflict exception if any requirements are found on the path that have the correct name but the wrong version. Otherwise, if an `installer` is supplied it will be invoked to obtain the correct version of the requirement and activate it. `extras` is a list of the extras to be used with these requirements. This is important because extra requirements may look like `my_req; extra = "my_extra"`, which would otherwise be interpreted as a purely optional requirement. Instead, we want to be able to assert that these requirements are truly required. """ # set up the stack requirements = list(requirements)[::-1] # set of processed requirements processed = {} # key -> dist best = {} to_activate = [] req_extras = _ReqExtras() # Mapping of requirement to set of distributions that required it; # useful for reporting info about conflicts. required_by = collections.defaultdict(set) while requirements: # process dependencies breadth-first req = requirements.pop(0) if req in processed: # Ignore cyclic or redundant dependencies continue if not req_extras.markers_pass(req, extras): continue dist = best.get(req.key) if dist is None: # Find the best distribution and add it to the map dist = self.by_key.get(req.key) if dist is None or (dist not in req and replace_conflicting): ws = self if env is None: if dist is None: > env = Environment(self.entries) pkg_resources/__init__.py:782: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = search_path = ['does-not-matter', '/home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4', '/usr/bin', '/home/tkloczko/rpmbuild/BUILDROOT/...uild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages', '/usr/lib64/python38.zip', ...] platform = 'linux-x86_64', python = '3.8' def __init__( self, search_path=None, platform=get_supported_platform(), python=PY_MAJOR): """Snapshot distributions available on a search path Any distributions found on `search_path` are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. `platform` is an optional string specifying the name of the platform that platform-specific distributions must be compatible with. If unspecified, it defaults to the current platform. `python` is an optional string naming the desired version of Python (e.g. ``'3.6'``); it defaults to the current version. You may explicitly set `platform` (and/or `python`) to ``None`` if you wish to map *all* distributions, not just those compatible with the running platform or Python version. """ self._distmap = {} self.platform = platform self.python = python > self.scan(search_path) pkg_resources/__init__.py:994: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = search_path = ['does-not-matter', '/home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4', '/usr/bin', '/home/tkloczko/rpmbuild/BUILDROOT/...uild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages', '/usr/lib64/python38.zip', ...] def scan(self, search_path=None): """Scan `search_path` for distributions usable in this environment Any distributions found are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. Only distributions conforming to the platform/python version defined at initialization are added. """ if search_path is None: search_path = sys.path for item in search_path: for dist in find_distributions(item): > self.add(dist) pkg_resources/__init__.py:1027: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , dist = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) def add(self, dist): """Add `dist` if we ``can_add()`` it and it has not already been added """ if self.can_add(dist) and dist.has_version(): dists = self._distmap.setdefault(dist.key, []) if dist not in dists: dists.append(dist) > dists.sort(key=operator.attrgetter('hashcmp'), reverse=True) pkg_resources/__init__.py:1047: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) @property def hashcmp(self): return ( > self.parsed_version, self.precedence, self.key, self.location, self.py_version or '', self.platform or '', ) pkg_resources/__init__.py:2620: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) @property def parsed_version(self): if not hasattr(self, "_parsed_version"): > self._parsed_version = parse_version(self.version) pkg_resources/__init__.py:2667: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ v = '1.17.1-unknown' def parse_version(v): try: return packaging.version.Version(v) except packaging.version.InvalidVersion: warnings.warn( f"{v} is an invalid version and will not be supported in " "a future release", PkgResourcesDeprecationWarning, ) > return packaging.version.LegacyVersion(v) pkg_resources/__init__.py:128: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , version = '1.17.1-unknown' def __init__(self, version: str) -> None: self._version = str(version) self._key = _legacy_cmpkey(self._version) > warnings.warn( "Creating a LegacyVersion has been deprecated and will be " "removed in the next major release", DeprecationWarning, ) E DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release pkg_resources/_vendor/packaging/version.py:111: DeprecationWarning During handling of the above exception, another exception occurred: self = , use_setup_cfg = ('dependency_links', 'setup_requires') @pytest.mark.parametrize('use_setup_cfg', use_setup_cfg) def test_setup_requires_overrides_version_conflict(self, use_setup_cfg): """ Regression test for distribution issue 323: https://bitbucket.org/tarek/distribute/issues/323 Ensures that a distribution's setup_requires requirements can still be installed and used locally even if a conflicting version of that requirement is already on the path. """ fake_dist = PRDistribution('does-not-matter', project_name='foobar', version='0.0') working_set.add(fake_dist) with contexts.save_pkg_resources_state(): with contexts.tempdir() as temp_dir: test_pkg = create_setup_requires_package( temp_dir, use_setup_cfg=use_setup_cfg) test_setup_py = os.path.join(test_pkg, 'setup.py') with contexts.quiet() as (stdout, stderr): # Don't even need to install the package, just # running the setup.py at all is sufficient > run_setup(test_setup_py, [str('--name')]) setuptools/tests/test_easy_install.py:595: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setuptools/sandbox.py:262: in run_setup raise /usr/lib64/python3.8/contextlib.py:131: in __exit__ self.gen.throw(type, value, traceback) setuptools/sandbox.py:198: in setup_context yield /usr/lib64/python3.8/contextlib.py:131: in __exit__ self.gen.throw(type, value, traceback) setuptools/sandbox.py:169: in save_modules saved_exc.resume() setuptools/sandbox.py:143: in resume raise exc.with_traceback(self._tb) setuptools/sandbox.py:156: in save_modules yield saved setuptools/sandbox.py:198: in setup_context yield setuptools/sandbox.py:259: in run_setup _execfile(setup_script, ns) setuptools/sandbox.py:46: in _execfile exec(code, globals, locals) /tmp/tmpv5_l0twi/test_pkg/setup.py:2: in ??? setuptools/__init__.py:86: in setup _install_setup_requires(attrs) setuptools/__init__.py:80: in _install_setup_requires dist.fetch_build_eggs(dist.setup_requires) setuptools/dist.py:876: in fetch_build_eggs resolved_dists = pkg_resources.working_set.resolve( pkg_resources/__init__.py:782: in resolve env = Environment(self.entries) pkg_resources/__init__.py:994: in __init__ self.scan(search_path) pkg_resources/__init__.py:1027: in scan self.add(dist) pkg_resources/__init__.py:1047: in add dists.sort(key=operator.attrgetter('hashcmp'), reverse=True) pkg_resources/__init__.py:2620: in hashcmp self.parsed_version, pkg_resources/__init__.py:2667: in parsed_version self._parsed_version = parse_version(self.version) pkg_resources/__init__.py:128: in parse_version return packaging.version.LegacyVersion(v) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , version = '1.17.1-unknown' def __init__(self, version: str) -> None: self._version = str(version) self._key = _legacy_cmpkey(self._version) > warnings.warn( "Creating a LegacyVersion has been deprecated and will be " "removed in the next major release", DeprecationWarning, ) E DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release pkg_resources/_vendor/packaging/version.py:111: DeprecationWarning ____________________________________________ TestSetupRequires.test_setup_requires_override_nspkg[use_setup_cfg0] ____________________________________________ v = '1.17.1-unknown' def parse_version(v): try: > return packaging.version.Version(v) pkg_resources/__init__.py:121: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'Version' object has no attribute '_version'") raised in repr()] Version object at 0x7ffb53aff610>, version = '1.17.1-unknown' def __init__(self, version: str) -> None: # Validate the version and parse it into pieces match = self._regex.search(version) if not match: > raise InvalidVersion(f"Invalid version: '{version}'") E pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: '1.17.1-unknown' pkg_resources/_vendor/packaging/version.py:266: InvalidVersion During handling of the above exception, another exception occurred: @contextlib.contextmanager def save_modules(): """ Context in which imported modules are saved. Translates exceptions internal to the context into the equivalent exception outside the context. """ saved = sys.modules.copy() with ExceptionSaver() as saved_exc: > yield saved setuptools/sandbox.py:156: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setup_dir = '/tmp/tmpspg0zoiv/test_pkg' @contextlib.contextmanager def setup_context(setup_dir): temp_dir = os.path.join(setup_dir, 'temp') with save_pkg_resources_state(): with save_modules(): with save_path(): hide_setuptools() with save_argv(): with override_temp(temp_dir): with pushd(setup_dir): # ensure setuptools commands are available __import__('setuptools') > yield setuptools/sandbox.py:198: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setup_script = '/tmp/tmpspg0zoiv/test_pkg/setup.py', args = ['--name'] def run_setup(setup_script, args): """Run a distutils setup script, sandboxed in its directory""" setup_dir = os.path.abspath(os.path.dirname(setup_script)) with setup_context(setup_dir): try: sys.argv[:] = [setup_script] + list(args) sys.path.insert(0, setup_dir) # reset to include setup dir, w/clean callback list working_set.__init__() working_set.callbacks.append(lambda dist: dist.activate()) with DirectorySandbox(setup_dir): ns = dict(__file__=setup_script, __name__='__main__') > _execfile(setup_script, ns) setuptools/sandbox.py:259: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ filename = '/tmp/tmpspg0zoiv/test_pkg/setup.py' globals = {'__builtins__': {'ArithmeticError': , 'AssertionError': , 'Attribute..._pkg/setup.py', '__name__': '__main__', 'foo': , ...} locals = {'__builtins__': {'ArithmeticError': , 'AssertionError': , 'Attribute..._pkg/setup.py', '__name__': '__main__', 'foo': , ...} def _execfile(filename, globals, locals=None): """ Python 3 implementation of execfile. """ mode = 'rb' with open(filename, mode) as stream: script = stream.read() if locals is None: locals = globals code = compile(script, filename, 'exec') > exec(code, globals, locals) setuptools/sandbox.py:46: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > ??? /tmp/tmpspg0zoiv/test_pkg/setup.py:4: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ attrs = {'dependency_links': ['/tmp/tmpspg0zoiv'], 'name': 'test_pkg', 'setup_requires': ['foo.bar==0.2'], 'version': '0.0'} def setup(**attrs): # Make sure we have any requirements needed to interpret 'attrs'. logging.configure() > _install_setup_requires(attrs) setuptools/__init__.py:86: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ attrs = {'dependency_links': ['/tmp/tmpspg0zoiv'], 'name': 'test_pkg', 'setup_requires': ['foo.bar==0.2'], 'version': '0.0'} def _install_setup_requires(attrs): # Note: do not use `setuptools.Distribution` directly, as # our PEP 517 backend patch `distutils.core.Distribution`. class MinimalDistribution(distutils.core.Distribution): """ A minimal version of a distribution for supporting the fetch_build_eggs interface. """ def __init__(self, attrs): _incl = 'dependency_links', 'setup_requires' filtered = {k: attrs[k] for k in set(_incl) & set(attrs)} super().__init__(filtered) # Prevent accidentally triggering discovery with incomplete set of attrs self.set_defaults._disable() def _get_project_config_files(self, filenames=None): """Ignore ``pyproject.toml``, they are not related to setup_requires""" try: cfg, toml = super()._split_standard_project_metadata(filenames) return cfg, () except Exception: return filenames, () def finalize_options(self): """ Disable finalize_options to avoid building the working set. Ref #2158. """ dist = MinimalDistribution(attrs) # Honor setup.cfg's options. dist.parse_config_files(ignore_option_errors=True) if dist.setup_requires: > dist.fetch_build_eggs(dist.setup_requires) setuptools/__init__.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .MinimalDistribution object at 0x7ffb53438910>, requires = ['foo.bar==0.2'] def fetch_build_eggs(self, requires): """Resolve pre-setup requirements""" > resolved_dists = pkg_resources.working_set.resolve( _reqs.parse(requires), installer=self.fetch_build_egg, replace_conflicting=True, ) setuptools/dist.py:876: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , requirements = [], env = None installer = .MinimalDistribution object at 0x7ffb53438910>> replace_conflicting = True, extras = None def resolve(self, requirements, env=None, installer=None, # noqa: C901 replace_conflicting=False, extras=None): """List all distributions needed to (recursively) meet `requirements` `requirements` must be a sequence of ``Requirement`` objects. `env`, if supplied, should be an ``Environment`` instance. If not supplied, it defaults to all distributions available within any entry or distribution in the working set. `installer`, if supplied, will be invoked with each requirement that cannot be met by an already-installed distribution; it should return a ``Distribution`` or ``None``. Unless `replace_conflicting=True`, raises a VersionConflict exception if any requirements are found on the path that have the correct name but the wrong version. Otherwise, if an `installer` is supplied it will be invoked to obtain the correct version of the requirement and activate it. `extras` is a list of the extras to be used with these requirements. This is important because extra requirements may look like `my_req; extra = "my_extra"`, which would otherwise be interpreted as a purely optional requirement. Instead, we want to be able to assert that these requirements are truly required. """ # set up the stack requirements = list(requirements)[::-1] # set of processed requirements processed = {} # key -> dist best = {} to_activate = [] req_extras = _ReqExtras() # Mapping of requirement to set of distributions that required it; # useful for reporting info about conflicts. required_by = collections.defaultdict(set) while requirements: # process dependencies breadth-first req = requirements.pop(0) if req in processed: # Ignore cyclic or redundant dependencies continue if not req_extras.markers_pass(req, extras): continue dist = best.get(req.key) if dist is None: # Find the best distribution and add it to the map dist = self.by_key.get(req.key) if dist is None or (dist not in req and replace_conflicting): ws = self if env is None: if dist is None: > env = Environment(self.entries) pkg_resources/__init__.py:782: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = search_path = ['does-not-matter', '/tmp/tmpspg0zoiv/foo.bar-0.1', '/home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4', '/usr/bin', '/h...ages', '/home/tkloczko/rpmbuild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages', ...] platform = 'linux-x86_64', python = '3.8' def __init__( self, search_path=None, platform=get_supported_platform(), python=PY_MAJOR): """Snapshot distributions available on a search path Any distributions found on `search_path` are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. `platform` is an optional string specifying the name of the platform that platform-specific distributions must be compatible with. If unspecified, it defaults to the current platform. `python` is an optional string naming the desired version of Python (e.g. ``'3.6'``); it defaults to the current version. You may explicitly set `platform` (and/or `python`) to ``None`` if you wish to map *all* distributions, not just those compatible with the running platform or Python version. """ self._distmap = {} self.platform = platform self.python = python > self.scan(search_path) pkg_resources/__init__.py:994: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = search_path = ['does-not-matter', '/tmp/tmpspg0zoiv/foo.bar-0.1', '/home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4', '/usr/bin', '/h...ages', '/home/tkloczko/rpmbuild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages', ...] def scan(self, search_path=None): """Scan `search_path` for distributions usable in this environment Any distributions found are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. Only distributions conforming to the platform/python version defined at initialization are added. """ if search_path is None: search_path = sys.path for item in search_path: for dist in find_distributions(item): > self.add(dist) pkg_resources/__init__.py:1027: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , dist = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) def add(self, dist): """Add `dist` if we ``can_add()`` it and it has not already been added """ if self.can_add(dist) and dist.has_version(): dists = self._distmap.setdefault(dist.key, []) if dist not in dists: dists.append(dist) > dists.sort(key=operator.attrgetter('hashcmp'), reverse=True) pkg_resources/__init__.py:1047: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) @property def hashcmp(self): return ( > self.parsed_version, self.precedence, self.key, self.location, self.py_version or '', self.platform or '', ) pkg_resources/__init__.py:2620: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) @property def parsed_version(self): if not hasattr(self, "_parsed_version"): > self._parsed_version = parse_version(self.version) pkg_resources/__init__.py:2667: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ v = '1.17.1-unknown' def parse_version(v): try: return packaging.version.Version(v) except packaging.version.InvalidVersion: warnings.warn( f"{v} is an invalid version and will not be supported in " "a future release", PkgResourcesDeprecationWarning, ) > return packaging.version.LegacyVersion(v) pkg_resources/__init__.py:128: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , version = '1.17.1-unknown' def __init__(self, version: str) -> None: self._version = str(version) self._key = _legacy_cmpkey(self._version) > warnings.warn( "Creating a LegacyVersion has been deprecated and will be " "removed in the next major release", DeprecationWarning, ) E DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release pkg_resources/_vendor/packaging/version.py:111: DeprecationWarning During handling of the above exception, another exception occurred: self = , use_setup_cfg = () @pytest.mark.parametrize('use_setup_cfg', use_setup_cfg) def test_setup_requires_override_nspkg(self, use_setup_cfg): """ Like ``test_setup_requires_overrides_version_conflict`` but where the ``setup_requires`` package is part of a namespace package that has *already* been imported. """ with contexts.save_pkg_resources_state(): with contexts.tempdir() as temp_dir: foobar_1_archive = os.path.join(temp_dir, 'foo.bar-0.1.tar.gz') make_nspkg_sdist(foobar_1_archive, 'foo.bar', '0.1') # Now actually go ahead an extract to the temp dir and add the # extracted path to sys.path so foo.bar v0.1 is importable foobar_1_dir = os.path.join(temp_dir, 'foo.bar-0.1') os.mkdir(foobar_1_dir) with tarfile.open(foobar_1_archive) as tf: tf.extractall(foobar_1_dir) sys.path.insert(1, foobar_1_dir) dist = PRDistribution(foobar_1_dir, project_name='foo.bar', version='0.1') working_set.add(dist) template = DALS("""\ import foo # Even with foo imported first the # setup_requires package should override import setuptools setuptools.setup(**%r) if not (hasattr(foo, '__path__') and len(foo.__path__) == 2): print('FAIL') if 'foo.bar-0.2' not in foo.__path__[0]: print('FAIL') """) test_pkg = create_setup_requires_package( temp_dir, 'foo.bar', '0.2', make_nspkg_sdist, template, use_setup_cfg=use_setup_cfg) test_setup_py = os.path.join(test_pkg, 'setup.py') with contexts.quiet() as (stdout, stderr): try: # Don't even need to install the package, just # running the setup.py at all is sufficient > run_setup(test_setup_py, [str('--name')]) setuptools/tests/test_easy_install.py:649: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setuptools/sandbox.py:262: in run_setup raise /usr/lib64/python3.8/contextlib.py:131: in __exit__ self.gen.throw(type, value, traceback) setuptools/sandbox.py:198: in setup_context yield /usr/lib64/python3.8/contextlib.py:131: in __exit__ self.gen.throw(type, value, traceback) setuptools/sandbox.py:169: in save_modules saved_exc.resume() setuptools/sandbox.py:143: in resume raise exc.with_traceback(self._tb) setuptools/sandbox.py:156: in save_modules yield saved setuptools/sandbox.py:198: in setup_context yield setuptools/sandbox.py:259: in run_setup _execfile(setup_script, ns) setuptools/sandbox.py:46: in _execfile exec(code, globals, locals) /tmp/tmpspg0zoiv/test_pkg/setup.py:4: in ??? setuptools/__init__.py:86: in setup _install_setup_requires(attrs) setuptools/__init__.py:80: in _install_setup_requires dist.fetch_build_eggs(dist.setup_requires) setuptools/dist.py:876: in fetch_build_eggs resolved_dists = pkg_resources.working_set.resolve( pkg_resources/__init__.py:782: in resolve env = Environment(self.entries) pkg_resources/__init__.py:994: in __init__ self.scan(search_path) pkg_resources/__init__.py:1027: in scan self.add(dist) pkg_resources/__init__.py:1047: in add dists.sort(key=operator.attrgetter('hashcmp'), reverse=True) pkg_resources/__init__.py:2620: in hashcmp self.parsed_version, pkg_resources/__init__.py:2667: in parsed_version self._parsed_version = parse_version(self.version) pkg_resources/__init__.py:128: in parse_version return packaging.version.LegacyVersion(v) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , version = '1.17.1-unknown' def __init__(self, version: str) -> None: self._version = str(version) self._key = _legacy_cmpkey(self._version) > warnings.warn( "Creating a LegacyVersion has been deprecated and will be " "removed in the next major release", DeprecationWarning, ) E DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release pkg_resources/_vendor/packaging/version.py:111: DeprecationWarning ____________________________________________ TestSetupRequires.test_setup_requires_override_nspkg[use_setup_cfg1] ____________________________________________ v = '1.17.1-unknown' def parse_version(v): try: > return packaging.version.Version(v) pkg_resources/__init__.py:121: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'Version' object has no attribute '_version'") raised in repr()] Version object at 0x7ffb53035ee0>, version = '1.17.1-unknown' def __init__(self, version: str) -> None: # Validate the version and parse it into pieces match = self._regex.search(version) if not match: > raise InvalidVersion(f"Invalid version: '{version}'") E pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: '1.17.1-unknown' pkg_resources/_vendor/packaging/version.py:266: InvalidVersion During handling of the above exception, another exception occurred: @contextlib.contextmanager def save_modules(): """ Context in which imported modules are saved. Translates exceptions internal to the context into the equivalent exception outside the context. """ saved = sys.modules.copy() with ExceptionSaver() as saved_exc: > yield saved setuptools/sandbox.py:156: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setup_dir = '/tmp/tmp_yh0pjqy/test_pkg' @contextlib.contextmanager def setup_context(setup_dir): temp_dir = os.path.join(setup_dir, 'temp') with save_pkg_resources_state(): with save_modules(): with save_path(): hide_setuptools() with save_argv(): with override_temp(temp_dir): with pushd(setup_dir): # ensure setuptools commands are available __import__('setuptools') > yield setuptools/sandbox.py:198: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setup_script = '/tmp/tmp_yh0pjqy/test_pkg/setup.py', args = ['--name'] def run_setup(setup_script, args): """Run a distutils setup script, sandboxed in its directory""" setup_dir = os.path.abspath(os.path.dirname(setup_script)) with setup_context(setup_dir): try: sys.argv[:] = [setup_script] + list(args) sys.path.insert(0, setup_dir) # reset to include setup dir, w/clean callback list working_set.__init__() working_set.callbacks.append(lambda dist: dist.activate()) with DirectorySandbox(setup_dir): ns = dict(__file__=setup_script, __name__='__main__') > _execfile(setup_script, ns) setuptools/sandbox.py:259: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ filename = '/tmp/tmp_yh0pjqy/test_pkg/setup.py' globals = {'__builtins__': {'ArithmeticError': , 'AssertionError': , 'Attribute..._pkg/setup.py', '__name__': '__main__', 'foo': , ...} locals = {'__builtins__': {'ArithmeticError': , 'AssertionError': , 'Attribute..._pkg/setup.py', '__name__': '__main__', 'foo': , ...} def _execfile(filename, globals, locals=None): """ Python 3 implementation of execfile. """ mode = 'rb' with open(filename, mode) as stream: script = stream.read() if locals is None: locals = globals code = compile(script, filename, 'exec') > exec(code, globals, locals) setuptools/sandbox.py:46: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > ??? /tmp/tmp_yh0pjqy/test_pkg/setup.py:4: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ attrs = {'name': 'test_pkg', 'setup_requires': ['foo.bar==0.2'], 'version': '0.0'} def setup(**attrs): # Make sure we have any requirements needed to interpret 'attrs'. logging.configure() > _install_setup_requires(attrs) setuptools/__init__.py:86: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ attrs = {'name': 'test_pkg', 'setup_requires': ['foo.bar==0.2'], 'version': '0.0'} def _install_setup_requires(attrs): # Note: do not use `setuptools.Distribution` directly, as # our PEP 517 backend patch `distutils.core.Distribution`. class MinimalDistribution(distutils.core.Distribution): """ A minimal version of a distribution for supporting the fetch_build_eggs interface. """ def __init__(self, attrs): _incl = 'dependency_links', 'setup_requires' filtered = {k: attrs[k] for k in set(_incl) & set(attrs)} super().__init__(filtered) # Prevent accidentally triggering discovery with incomplete set of attrs self.set_defaults._disable() def _get_project_config_files(self, filenames=None): """Ignore ``pyproject.toml``, they are not related to setup_requires""" try: cfg, toml = super()._split_standard_project_metadata(filenames) return cfg, () except Exception: return filenames, () def finalize_options(self): """ Disable finalize_options to avoid building the working set. Ref #2158. """ dist = MinimalDistribution(attrs) # Honor setup.cfg's options. dist.parse_config_files(ignore_option_errors=True) if dist.setup_requires: > dist.fetch_build_eggs(dist.setup_requires) setuptools/__init__.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .MinimalDistribution object at 0x7ffb529b10d0>, requires = ['foo.bar==0.2'] def fetch_build_eggs(self, requires): """Resolve pre-setup requirements""" > resolved_dists = pkg_resources.working_set.resolve( _reqs.parse(requires), installer=self.fetch_build_egg, replace_conflicting=True, ) setuptools/dist.py:876: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , requirements = [], env = None installer = .MinimalDistribution object at 0x7ffb529b10d0>> replace_conflicting = True, extras = None def resolve(self, requirements, env=None, installer=None, # noqa: C901 replace_conflicting=False, extras=None): """List all distributions needed to (recursively) meet `requirements` `requirements` must be a sequence of ``Requirement`` objects. `env`, if supplied, should be an ``Environment`` instance. If not supplied, it defaults to all distributions available within any entry or distribution in the working set. `installer`, if supplied, will be invoked with each requirement that cannot be met by an already-installed distribution; it should return a ``Distribution`` or ``None``. Unless `replace_conflicting=True`, raises a VersionConflict exception if any requirements are found on the path that have the correct name but the wrong version. Otherwise, if an `installer` is supplied it will be invoked to obtain the correct version of the requirement and activate it. `extras` is a list of the extras to be used with these requirements. This is important because extra requirements may look like `my_req; extra = "my_extra"`, which would otherwise be interpreted as a purely optional requirement. Instead, we want to be able to assert that these requirements are truly required. """ # set up the stack requirements = list(requirements)[::-1] # set of processed requirements processed = {} # key -> dist best = {} to_activate = [] req_extras = _ReqExtras() # Mapping of requirement to set of distributions that required it; # useful for reporting info about conflicts. required_by = collections.defaultdict(set) while requirements: # process dependencies breadth-first req = requirements.pop(0) if req in processed: # Ignore cyclic or redundant dependencies continue if not req_extras.markers_pass(req, extras): continue dist = best.get(req.key) if dist is None: # Find the best distribution and add it to the map dist = self.by_key.get(req.key) if dist is None or (dist not in req and replace_conflicting): ws = self if env is None: if dist is None: > env = Environment(self.entries) pkg_resources/__init__.py:782: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = search_path = ['does-not-matter', '/tmp/tmp_yh0pjqy/foo.bar-0.1', '/home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4', '/usr/bin', '/h...ages', '/home/tkloczko/rpmbuild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages', ...] platform = 'linux-x86_64', python = '3.8' def __init__( self, search_path=None, platform=get_supported_platform(), python=PY_MAJOR): """Snapshot distributions available on a search path Any distributions found on `search_path` are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. `platform` is an optional string specifying the name of the platform that platform-specific distributions must be compatible with. If unspecified, it defaults to the current platform. `python` is an optional string naming the desired version of Python (e.g. ``'3.6'``); it defaults to the current version. You may explicitly set `platform` (and/or `python`) to ``None`` if you wish to map *all* distributions, not just those compatible with the running platform or Python version. """ self._distmap = {} self.platform = platform self.python = python > self.scan(search_path) pkg_resources/__init__.py:994: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = search_path = ['does-not-matter', '/tmp/tmp_yh0pjqy/foo.bar-0.1', '/home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4', '/usr/bin', '/h...ages', '/home/tkloczko/rpmbuild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages', ...] def scan(self, search_path=None): """Scan `search_path` for distributions usable in this environment Any distributions found are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. Only distributions conforming to the platform/python version defined at initialization are added. """ if search_path is None: search_path = sys.path for item in search_path: for dist in find_distributions(item): > self.add(dist) pkg_resources/__init__.py:1027: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , dist = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) def add(self, dist): """Add `dist` if we ``can_add()`` it and it has not already been added """ if self.can_add(dist) and dist.has_version(): dists = self._distmap.setdefault(dist.key, []) if dist not in dists: dists.append(dist) > dists.sort(key=operator.attrgetter('hashcmp'), reverse=True) pkg_resources/__init__.py:1047: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) @property def hashcmp(self): return ( > self.parsed_version, self.precedence, self.key, self.location, self.py_version or '', self.platform or '', ) pkg_resources/__init__.py:2620: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) @property def parsed_version(self): if not hasattr(self, "_parsed_version"): > self._parsed_version = parse_version(self.version) pkg_resources/__init__.py:2667: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ v = '1.17.1-unknown' def parse_version(v): try: return packaging.version.Version(v) except packaging.version.InvalidVersion: warnings.warn( f"{v} is an invalid version and will not be supported in " "a future release", PkgResourcesDeprecationWarning, ) > return packaging.version.LegacyVersion(v) pkg_resources/__init__.py:128: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , version = '1.17.1-unknown' def __init__(self, version: str) -> None: self._version = str(version) self._key = _legacy_cmpkey(self._version) > warnings.warn( "Creating a LegacyVersion has been deprecated and will be " "removed in the next major release", DeprecationWarning, ) E DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release pkg_resources/_vendor/packaging/version.py:111: DeprecationWarning During handling of the above exception, another exception occurred: self = , use_setup_cfg = ('dependency_links',) @pytest.mark.parametrize('use_setup_cfg', use_setup_cfg) def test_setup_requires_override_nspkg(self, use_setup_cfg): """ Like ``test_setup_requires_overrides_version_conflict`` but where the ``setup_requires`` package is part of a namespace package that has *already* been imported. """ with contexts.save_pkg_resources_state(): with contexts.tempdir() as temp_dir: foobar_1_archive = os.path.join(temp_dir, 'foo.bar-0.1.tar.gz') make_nspkg_sdist(foobar_1_archive, 'foo.bar', '0.1') # Now actually go ahead an extract to the temp dir and add the # extracted path to sys.path so foo.bar v0.1 is importable foobar_1_dir = os.path.join(temp_dir, 'foo.bar-0.1') os.mkdir(foobar_1_dir) with tarfile.open(foobar_1_archive) as tf: tf.extractall(foobar_1_dir) sys.path.insert(1, foobar_1_dir) dist = PRDistribution(foobar_1_dir, project_name='foo.bar', version='0.1') working_set.add(dist) template = DALS("""\ import foo # Even with foo imported first the # setup_requires package should override import setuptools setuptools.setup(**%r) if not (hasattr(foo, '__path__') and len(foo.__path__) == 2): print('FAIL') if 'foo.bar-0.2' not in foo.__path__[0]: print('FAIL') """) test_pkg = create_setup_requires_package( temp_dir, 'foo.bar', '0.2', make_nspkg_sdist, template, use_setup_cfg=use_setup_cfg) test_setup_py = os.path.join(test_pkg, 'setup.py') with contexts.quiet() as (stdout, stderr): try: # Don't even need to install the package, just # running the setup.py at all is sufficient > run_setup(test_setup_py, [str('--name')]) setuptools/tests/test_easy_install.py:649: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setuptools/sandbox.py:262: in run_setup raise /usr/lib64/python3.8/contextlib.py:131: in __exit__ self.gen.throw(type, value, traceback) setuptools/sandbox.py:198: in setup_context yield /usr/lib64/python3.8/contextlib.py:131: in __exit__ self.gen.throw(type, value, traceback) setuptools/sandbox.py:169: in save_modules saved_exc.resume() setuptools/sandbox.py:143: in resume raise exc.with_traceback(self._tb) setuptools/sandbox.py:156: in save_modules yield saved setuptools/sandbox.py:198: in setup_context yield setuptools/sandbox.py:259: in run_setup _execfile(setup_script, ns) setuptools/sandbox.py:46: in _execfile exec(code, globals, locals) /tmp/tmp_yh0pjqy/test_pkg/setup.py:4: in ??? setuptools/__init__.py:86: in setup _install_setup_requires(attrs) setuptools/__init__.py:80: in _install_setup_requires dist.fetch_build_eggs(dist.setup_requires) setuptools/dist.py:876: in fetch_build_eggs resolved_dists = pkg_resources.working_set.resolve( pkg_resources/__init__.py:782: in resolve env = Environment(self.entries) pkg_resources/__init__.py:994: in __init__ self.scan(search_path) pkg_resources/__init__.py:1027: in scan self.add(dist) pkg_resources/__init__.py:1047: in add dists.sort(key=operator.attrgetter('hashcmp'), reverse=True) pkg_resources/__init__.py:2620: in hashcmp self.parsed_version, pkg_resources/__init__.py:2667: in parsed_version self._parsed_version = parse_version(self.version) pkg_resources/__init__.py:128: in parse_version return packaging.version.LegacyVersion(v) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , version = '1.17.1-unknown' def __init__(self, version: str) -> None: self._version = str(version) self._key = _legacy_cmpkey(self._version) > warnings.warn( "Creating a LegacyVersion has been deprecated and will be " "removed in the next major release", DeprecationWarning, ) E DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release pkg_resources/_vendor/packaging/version.py:111: DeprecationWarning ____________________________________________ TestSetupRequires.test_setup_requires_override_nspkg[use_setup_cfg2] ____________________________________________ v = '1.17.1-unknown' def parse_version(v): try: > return packaging.version.Version(v) pkg_resources/__init__.py:121: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'Version' object has no attribute '_version'") raised in repr()] Version object at 0x7ffb522a5490>, version = '1.17.1-unknown' def __init__(self, version: str) -> None: # Validate the version and parse it into pieces match = self._regex.search(version) if not match: > raise InvalidVersion(f"Invalid version: '{version}'") E pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: '1.17.1-unknown' pkg_resources/_vendor/packaging/version.py:266: InvalidVersion During handling of the above exception, another exception occurred: @contextlib.contextmanager def save_modules(): """ Context in which imported modules are saved. Translates exceptions internal to the context into the equivalent exception outside the context. """ saved = sys.modules.copy() with ExceptionSaver() as saved_exc: > yield saved setuptools/sandbox.py:156: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setup_dir = '/tmp/tmptvq19dg1/test_pkg' @contextlib.contextmanager def setup_context(setup_dir): temp_dir = os.path.join(setup_dir, 'temp') with save_pkg_resources_state(): with save_modules(): with save_path(): hide_setuptools() with save_argv(): with override_temp(temp_dir): with pushd(setup_dir): # ensure setuptools commands are available __import__('setuptools') > yield setuptools/sandbox.py:198: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setup_script = '/tmp/tmptvq19dg1/test_pkg/setup.py', args = ['--name'] def run_setup(setup_script, args): """Run a distutils setup script, sandboxed in its directory""" setup_dir = os.path.abspath(os.path.dirname(setup_script)) with setup_context(setup_dir): try: sys.argv[:] = [setup_script] + list(args) sys.path.insert(0, setup_dir) # reset to include setup dir, w/clean callback list working_set.__init__() working_set.callbacks.append(lambda dist: dist.activate()) with DirectorySandbox(setup_dir): ns = dict(__file__=setup_script, __name__='__main__') > _execfile(setup_script, ns) setuptools/sandbox.py:259: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ filename = '/tmp/tmptvq19dg1/test_pkg/setup.py' globals = {'__builtins__': {'ArithmeticError': , 'AssertionError': , 'Attribute..._pkg/setup.py', '__name__': '__main__', 'foo': , ...} locals = {'__builtins__': {'ArithmeticError': , 'AssertionError': , 'Attribute..._pkg/setup.py', '__name__': '__main__', 'foo': , ...} def _execfile(filename, globals, locals=None): """ Python 3 implementation of execfile. """ mode = 'rb' with open(filename, mode) as stream: script = stream.read() if locals is None: locals = globals code = compile(script, filename, 'exec') > exec(code, globals, locals) setuptools/sandbox.py:46: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > ??? /tmp/tmptvq19dg1/test_pkg/setup.py:4: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ attrs = {'dependency_links': ['/tmp/tmptvq19dg1'], 'name': 'test_pkg', 'version': '0.0'} def setup(**attrs): # Make sure we have any requirements needed to interpret 'attrs'. logging.configure() > _install_setup_requires(attrs) setuptools/__init__.py:86: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ attrs = {'dependency_links': ['/tmp/tmptvq19dg1'], 'name': 'test_pkg', 'version': '0.0'} def _install_setup_requires(attrs): # Note: do not use `setuptools.Distribution` directly, as # our PEP 517 backend patch `distutils.core.Distribution`. class MinimalDistribution(distutils.core.Distribution): """ A minimal version of a distribution for supporting the fetch_build_eggs interface. """ def __init__(self, attrs): _incl = 'dependency_links', 'setup_requires' filtered = {k: attrs[k] for k in set(_incl) & set(attrs)} super().__init__(filtered) # Prevent accidentally triggering discovery with incomplete set of attrs self.set_defaults._disable() def _get_project_config_files(self, filenames=None): """Ignore ``pyproject.toml``, they are not related to setup_requires""" try: cfg, toml = super()._split_standard_project_metadata(filenames) return cfg, () except Exception: return filenames, () def finalize_options(self): """ Disable finalize_options to avoid building the working set. Ref #2158. """ dist = MinimalDistribution(attrs) # Honor setup.cfg's options. dist.parse_config_files(ignore_option_errors=True) if dist.setup_requires: > dist.fetch_build_eggs(dist.setup_requires) setuptools/__init__.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .MinimalDistribution object at 0x7ffb5253d280>, requires = ['foo.bar==0.2'] def fetch_build_eggs(self, requires): """Resolve pre-setup requirements""" > resolved_dists = pkg_resources.working_set.resolve( _reqs.parse(requires), installer=self.fetch_build_egg, replace_conflicting=True, ) setuptools/dist.py:876: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , requirements = [], env = None installer = .MinimalDistribution object at 0x7ffb5253d280>> replace_conflicting = True, extras = None def resolve(self, requirements, env=None, installer=None, # noqa: C901 replace_conflicting=False, extras=None): """List all distributions needed to (recursively) meet `requirements` `requirements` must be a sequence of ``Requirement`` objects. `env`, if supplied, should be an ``Environment`` instance. If not supplied, it defaults to all distributions available within any entry or distribution in the working set. `installer`, if supplied, will be invoked with each requirement that cannot be met by an already-installed distribution; it should return a ``Distribution`` or ``None``. Unless `replace_conflicting=True`, raises a VersionConflict exception if any requirements are found on the path that have the correct name but the wrong version. Otherwise, if an `installer` is supplied it will be invoked to obtain the correct version of the requirement and activate it. `extras` is a list of the extras to be used with these requirements. This is important because extra requirements may look like `my_req; extra = "my_extra"`, which would otherwise be interpreted as a purely optional requirement. Instead, we want to be able to assert that these requirements are truly required. """ # set up the stack requirements = list(requirements)[::-1] # set of processed requirements processed = {} # key -> dist best = {} to_activate = [] req_extras = _ReqExtras() # Mapping of requirement to set of distributions that required it; # useful for reporting info about conflicts. required_by = collections.defaultdict(set) while requirements: # process dependencies breadth-first req = requirements.pop(0) if req in processed: # Ignore cyclic or redundant dependencies continue if not req_extras.markers_pass(req, extras): continue dist = best.get(req.key) if dist is None: # Find the best distribution and add it to the map dist = self.by_key.get(req.key) if dist is None or (dist not in req and replace_conflicting): ws = self if env is None: if dist is None: > env = Environment(self.entries) pkg_resources/__init__.py:782: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = search_path = ['does-not-matter', '/tmp/tmptvq19dg1/foo.bar-0.1', '/home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4', '/usr/bin', '/h...ages', '/home/tkloczko/rpmbuild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages', ...] platform = 'linux-x86_64', python = '3.8' def __init__( self, search_path=None, platform=get_supported_platform(), python=PY_MAJOR): """Snapshot distributions available on a search path Any distributions found on `search_path` are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. `platform` is an optional string specifying the name of the platform that platform-specific distributions must be compatible with. If unspecified, it defaults to the current platform. `python` is an optional string naming the desired version of Python (e.g. ``'3.6'``); it defaults to the current version. You may explicitly set `platform` (and/or `python`) to ``None`` if you wish to map *all* distributions, not just those compatible with the running platform or Python version. """ self._distmap = {} self.platform = platform self.python = python > self.scan(search_path) pkg_resources/__init__.py:994: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = search_path = ['does-not-matter', '/tmp/tmptvq19dg1/foo.bar-0.1', '/home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4', '/usr/bin', '/h...ages', '/home/tkloczko/rpmbuild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages', ...] def scan(self, search_path=None): """Scan `search_path` for distributions usable in this environment Any distributions found are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. Only distributions conforming to the platform/python version defined at initialization are added. """ if search_path is None: search_path = sys.path for item in search_path: for dist in find_distributions(item): > self.add(dist) pkg_resources/__init__.py:1027: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , dist = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) def add(self, dist): """Add `dist` if we ``can_add()`` it and it has not already been added """ if self.can_add(dist) and dist.has_version(): dists = self._distmap.setdefault(dist.key, []) if dist not in dists: dists.append(dist) > dists.sort(key=operator.attrgetter('hashcmp'), reverse=True) pkg_resources/__init__.py:1047: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) @property def hashcmp(self): return ( > self.parsed_version, self.precedence, self.key, self.location, self.py_version or '', self.platform or '', ) pkg_resources/__init__.py:2620: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) @property def parsed_version(self): if not hasattr(self, "_parsed_version"): > self._parsed_version = parse_version(self.version) pkg_resources/__init__.py:2667: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ v = '1.17.1-unknown' def parse_version(v): try: return packaging.version.Version(v) except packaging.version.InvalidVersion: warnings.warn( f"{v} is an invalid version and will not be supported in " "a future release", PkgResourcesDeprecationWarning, ) > return packaging.version.LegacyVersion(v) pkg_resources/__init__.py:128: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , version = '1.17.1-unknown' def __init__(self, version: str) -> None: self._version = str(version) self._key = _legacy_cmpkey(self._version) > warnings.warn( "Creating a LegacyVersion has been deprecated and will be " "removed in the next major release", DeprecationWarning, ) E DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release pkg_resources/_vendor/packaging/version.py:111: DeprecationWarning During handling of the above exception, another exception occurred: self = , use_setup_cfg = ('setup_requires',) @pytest.mark.parametrize('use_setup_cfg', use_setup_cfg) def test_setup_requires_override_nspkg(self, use_setup_cfg): """ Like ``test_setup_requires_overrides_version_conflict`` but where the ``setup_requires`` package is part of a namespace package that has *already* been imported. """ with contexts.save_pkg_resources_state(): with contexts.tempdir() as temp_dir: foobar_1_archive = os.path.join(temp_dir, 'foo.bar-0.1.tar.gz') make_nspkg_sdist(foobar_1_archive, 'foo.bar', '0.1') # Now actually go ahead an extract to the temp dir and add the # extracted path to sys.path so foo.bar v0.1 is importable foobar_1_dir = os.path.join(temp_dir, 'foo.bar-0.1') os.mkdir(foobar_1_dir) with tarfile.open(foobar_1_archive) as tf: tf.extractall(foobar_1_dir) sys.path.insert(1, foobar_1_dir) dist = PRDistribution(foobar_1_dir, project_name='foo.bar', version='0.1') working_set.add(dist) template = DALS("""\ import foo # Even with foo imported first the # setup_requires package should override import setuptools setuptools.setup(**%r) if not (hasattr(foo, '__path__') and len(foo.__path__) == 2): print('FAIL') if 'foo.bar-0.2' not in foo.__path__[0]: print('FAIL') """) test_pkg = create_setup_requires_package( temp_dir, 'foo.bar', '0.2', make_nspkg_sdist, template, use_setup_cfg=use_setup_cfg) test_setup_py = os.path.join(test_pkg, 'setup.py') with contexts.quiet() as (stdout, stderr): try: # Don't even need to install the package, just # running the setup.py at all is sufficient > run_setup(test_setup_py, [str('--name')]) setuptools/tests/test_easy_install.py:649: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setuptools/sandbox.py:262: in run_setup raise /usr/lib64/python3.8/contextlib.py:131: in __exit__ self.gen.throw(type, value, traceback) setuptools/sandbox.py:198: in setup_context yield /usr/lib64/python3.8/contextlib.py:131: in __exit__ self.gen.throw(type, value, traceback) setuptools/sandbox.py:169: in save_modules saved_exc.resume() setuptools/sandbox.py:143: in resume raise exc.with_traceback(self._tb) setuptools/sandbox.py:156: in save_modules yield saved setuptools/sandbox.py:198: in setup_context yield setuptools/sandbox.py:259: in run_setup _execfile(setup_script, ns) setuptools/sandbox.py:46: in _execfile exec(code, globals, locals) /tmp/tmptvq19dg1/test_pkg/setup.py:4: in ??? setuptools/__init__.py:86: in setup _install_setup_requires(attrs) setuptools/__init__.py:80: in _install_setup_requires dist.fetch_build_eggs(dist.setup_requires) setuptools/dist.py:876: in fetch_build_eggs resolved_dists = pkg_resources.working_set.resolve( pkg_resources/__init__.py:782: in resolve env = Environment(self.entries) pkg_resources/__init__.py:994: in __init__ self.scan(search_path) pkg_resources/__init__.py:1027: in scan self.add(dist) pkg_resources/__init__.py:1047: in add dists.sort(key=operator.attrgetter('hashcmp'), reverse=True) pkg_resources/__init__.py:2620: in hashcmp self.parsed_version, pkg_resources/__init__.py:2667: in parsed_version self._parsed_version = parse_version(self.version) pkg_resources/__init__.py:128: in parse_version return packaging.version.LegacyVersion(v) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , version = '1.17.1-unknown' def __init__(self, version: str) -> None: self._version = str(version) self._key = _legacy_cmpkey(self._version) > warnings.warn( "Creating a LegacyVersion has been deprecated and will be " "removed in the next major release", DeprecationWarning, ) E DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release pkg_resources/_vendor/packaging/version.py:111: DeprecationWarning ____________________________________________ TestSetupRequires.test_setup_requires_override_nspkg[use_setup_cfg3] ____________________________________________ v = '1.17.1-unknown' def parse_version(v): try: > return packaging.version.Version(v) pkg_resources/__init__.py:121: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'Version' object has no attribute '_version'") raised in repr()] Version object at 0x7ffb51c5ca30>, version = '1.17.1-unknown' def __init__(self, version: str) -> None: # Validate the version and parse it into pieces match = self._regex.search(version) if not match: > raise InvalidVersion(f"Invalid version: '{version}'") E pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: '1.17.1-unknown' pkg_resources/_vendor/packaging/version.py:266: InvalidVersion During handling of the above exception, another exception occurred: @contextlib.contextmanager def save_modules(): """ Context in which imported modules are saved. Translates exceptions internal to the context into the equivalent exception outside the context. """ saved = sys.modules.copy() with ExceptionSaver() as saved_exc: > yield saved setuptools/sandbox.py:156: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setup_dir = '/tmp/tmp59_7ercp/test_pkg' @contextlib.contextmanager def setup_context(setup_dir): temp_dir = os.path.join(setup_dir, 'temp') with save_pkg_resources_state(): with save_modules(): with save_path(): hide_setuptools() with save_argv(): with override_temp(temp_dir): with pushd(setup_dir): # ensure setuptools commands are available __import__('setuptools') > yield setuptools/sandbox.py:198: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setup_script = '/tmp/tmp59_7ercp/test_pkg/setup.py', args = ['--name'] def run_setup(setup_script, args): """Run a distutils setup script, sandboxed in its directory""" setup_dir = os.path.abspath(os.path.dirname(setup_script)) with setup_context(setup_dir): try: sys.argv[:] = [setup_script] + list(args) sys.path.insert(0, setup_dir) # reset to include setup dir, w/clean callback list working_set.__init__() working_set.callbacks.append(lambda dist: dist.activate()) with DirectorySandbox(setup_dir): ns = dict(__file__=setup_script, __name__='__main__') > _execfile(setup_script, ns) setuptools/sandbox.py:259: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ filename = '/tmp/tmp59_7ercp/test_pkg/setup.py' globals = {'__builtins__': {'ArithmeticError': , 'AssertionError': , 'Attribute..._pkg/setup.py', '__name__': '__main__', 'foo': , ...} locals = {'__builtins__': {'ArithmeticError': , 'AssertionError': , 'Attribute..._pkg/setup.py', '__name__': '__main__', 'foo': , ...} def _execfile(filename, globals, locals=None): """ Python 3 implementation of execfile. """ mode = 'rb' with open(filename, mode) as stream: script = stream.read() if locals is None: locals = globals code = compile(script, filename, 'exec') > exec(code, globals, locals) setuptools/sandbox.py:46: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > ??? /tmp/tmp59_7ercp/test_pkg/setup.py:4: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ attrs = {'name': 'test_pkg', 'version': '0.0'} def setup(**attrs): # Make sure we have any requirements needed to interpret 'attrs'. logging.configure() > _install_setup_requires(attrs) setuptools/__init__.py:86: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ attrs = {'name': 'test_pkg', 'version': '0.0'} def _install_setup_requires(attrs): # Note: do not use `setuptools.Distribution` directly, as # our PEP 517 backend patch `distutils.core.Distribution`. class MinimalDistribution(distutils.core.Distribution): """ A minimal version of a distribution for supporting the fetch_build_eggs interface. """ def __init__(self, attrs): _incl = 'dependency_links', 'setup_requires' filtered = {k: attrs[k] for k in set(_incl) & set(attrs)} super().__init__(filtered) # Prevent accidentally triggering discovery with incomplete set of attrs self.set_defaults._disable() def _get_project_config_files(self, filenames=None): """Ignore ``pyproject.toml``, they are not related to setup_requires""" try: cfg, toml = super()._split_standard_project_metadata(filenames) return cfg, () except Exception: return filenames, () def finalize_options(self): """ Disable finalize_options to avoid building the working set. Ref #2158. """ dist = MinimalDistribution(attrs) # Honor setup.cfg's options. dist.parse_config_files(ignore_option_errors=True) if dist.setup_requires: > dist.fetch_build_eggs(dist.setup_requires) setuptools/__init__.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .MinimalDistribution object at 0x7ffb5229c7f0>, requires = ['foo.bar==0.2'] def fetch_build_eggs(self, requires): """Resolve pre-setup requirements""" > resolved_dists = pkg_resources.working_set.resolve( _reqs.parse(requires), installer=self.fetch_build_egg, replace_conflicting=True, ) setuptools/dist.py:876: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , requirements = [], env = None installer = .MinimalDistribution object at 0x7ffb5229c7f0>> replace_conflicting = True, extras = None def resolve(self, requirements, env=None, installer=None, # noqa: C901 replace_conflicting=False, extras=None): """List all distributions needed to (recursively) meet `requirements` `requirements` must be a sequence of ``Requirement`` objects. `env`, if supplied, should be an ``Environment`` instance. If not supplied, it defaults to all distributions available within any entry or distribution in the working set. `installer`, if supplied, will be invoked with each requirement that cannot be met by an already-installed distribution; it should return a ``Distribution`` or ``None``. Unless `replace_conflicting=True`, raises a VersionConflict exception if any requirements are found on the path that have the correct name but the wrong version. Otherwise, if an `installer` is supplied it will be invoked to obtain the correct version of the requirement and activate it. `extras` is a list of the extras to be used with these requirements. This is important because extra requirements may look like `my_req; extra = "my_extra"`, which would otherwise be interpreted as a purely optional requirement. Instead, we want to be able to assert that these requirements are truly required. """ # set up the stack requirements = list(requirements)[::-1] # set of processed requirements processed = {} # key -> dist best = {} to_activate = [] req_extras = _ReqExtras() # Mapping of requirement to set of distributions that required it; # useful for reporting info about conflicts. required_by = collections.defaultdict(set) while requirements: # process dependencies breadth-first req = requirements.pop(0) if req in processed: # Ignore cyclic or redundant dependencies continue if not req_extras.markers_pass(req, extras): continue dist = best.get(req.key) if dist is None: # Find the best distribution and add it to the map dist = self.by_key.get(req.key) if dist is None or (dist not in req and replace_conflicting): ws = self if env is None: if dist is None: > env = Environment(self.entries) pkg_resources/__init__.py:782: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = search_path = ['does-not-matter', '/tmp/tmp59_7ercp/foo.bar-0.1', '/home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4', '/usr/bin', '/h...ages', '/home/tkloczko/rpmbuild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages', ...] platform = 'linux-x86_64', python = '3.8' def __init__( self, search_path=None, platform=get_supported_platform(), python=PY_MAJOR): """Snapshot distributions available on a search path Any distributions found on `search_path` are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. `platform` is an optional string specifying the name of the platform that platform-specific distributions must be compatible with. If unspecified, it defaults to the current platform. `python` is an optional string naming the desired version of Python (e.g. ``'3.6'``); it defaults to the current version. You may explicitly set `platform` (and/or `python`) to ``None`` if you wish to map *all* distributions, not just those compatible with the running platform or Python version. """ self._distmap = {} self.platform = platform self.python = python > self.scan(search_path) pkg_resources/__init__.py:994: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = search_path = ['does-not-matter', '/tmp/tmp59_7ercp/foo.bar-0.1', '/home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4', '/usr/bin', '/h...ages', '/home/tkloczko/rpmbuild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages', ...] def scan(self, search_path=None): """Scan `search_path` for distributions usable in this environment Any distributions found are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. Only distributions conforming to the platform/python version defined at initialization are added. """ if search_path is None: search_path = sys.path for item in search_path: for dist in find_distributions(item): > self.add(dist) pkg_resources/__init__.py:1027: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , dist = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) def add(self, dist): """Add `dist` if we ``can_add()`` it and it has not already been added """ if self.can_add(dist) and dist.has_version(): dists = self._distmap.setdefault(dist.key, []) if dist not in dists: dists.append(dist) > dists.sort(key=operator.attrgetter('hashcmp'), reverse=True) pkg_resources/__init__.py:1047: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) @property def hashcmp(self): return ( > self.parsed_version, self.precedence, self.key, self.location, self.py_version or '', self.platform or '', ) pkg_resources/__init__.py:2620: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) @property def parsed_version(self): if not hasattr(self, "_parsed_version"): > self._parsed_version = parse_version(self.version) pkg_resources/__init__.py:2667: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ v = '1.17.1-unknown' def parse_version(v): try: return packaging.version.Version(v) except packaging.version.InvalidVersion: warnings.warn( f"{v} is an invalid version and will not be supported in " "a future release", PkgResourcesDeprecationWarning, ) > return packaging.version.LegacyVersion(v) pkg_resources/__init__.py:128: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , version = '1.17.1-unknown' def __init__(self, version: str) -> None: self._version = str(version) self._key = _legacy_cmpkey(self._version) > warnings.warn( "Creating a LegacyVersion has been deprecated and will be " "removed in the next major release", DeprecationWarning, ) E DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release pkg_resources/_vendor/packaging/version.py:111: DeprecationWarning During handling of the above exception, another exception occurred: self = , use_setup_cfg = ('dependency_links', 'setup_requires') @pytest.mark.parametrize('use_setup_cfg', use_setup_cfg) def test_setup_requires_override_nspkg(self, use_setup_cfg): """ Like ``test_setup_requires_overrides_version_conflict`` but where the ``setup_requires`` package is part of a namespace package that has *already* been imported. """ with contexts.save_pkg_resources_state(): with contexts.tempdir() as temp_dir: foobar_1_archive = os.path.join(temp_dir, 'foo.bar-0.1.tar.gz') make_nspkg_sdist(foobar_1_archive, 'foo.bar', '0.1') # Now actually go ahead an extract to the temp dir and add the # extracted path to sys.path so foo.bar v0.1 is importable foobar_1_dir = os.path.join(temp_dir, 'foo.bar-0.1') os.mkdir(foobar_1_dir) with tarfile.open(foobar_1_archive) as tf: tf.extractall(foobar_1_dir) sys.path.insert(1, foobar_1_dir) dist = PRDistribution(foobar_1_dir, project_name='foo.bar', version='0.1') working_set.add(dist) template = DALS("""\ import foo # Even with foo imported first the # setup_requires package should override import setuptools setuptools.setup(**%r) if not (hasattr(foo, '__path__') and len(foo.__path__) == 2): print('FAIL') if 'foo.bar-0.2' not in foo.__path__[0]: print('FAIL') """) test_pkg = create_setup_requires_package( temp_dir, 'foo.bar', '0.2', make_nspkg_sdist, template, use_setup_cfg=use_setup_cfg) test_setup_py = os.path.join(test_pkg, 'setup.py') with contexts.quiet() as (stdout, stderr): try: # Don't even need to install the package, just # running the setup.py at all is sufficient > run_setup(test_setup_py, [str('--name')]) setuptools/tests/test_easy_install.py:649: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setuptools/sandbox.py:262: in run_setup raise /usr/lib64/python3.8/contextlib.py:131: in __exit__ self.gen.throw(type, value, traceback) setuptools/sandbox.py:198: in setup_context yield /usr/lib64/python3.8/contextlib.py:131: in __exit__ self.gen.throw(type, value, traceback) setuptools/sandbox.py:169: in save_modules saved_exc.resume() setuptools/sandbox.py:143: in resume raise exc.with_traceback(self._tb) setuptools/sandbox.py:156: in save_modules yield saved setuptools/sandbox.py:198: in setup_context yield setuptools/sandbox.py:259: in run_setup _execfile(setup_script, ns) setuptools/sandbox.py:46: in _execfile exec(code, globals, locals) /tmp/tmp59_7ercp/test_pkg/setup.py:4: in ??? setuptools/__init__.py:86: in setup _install_setup_requires(attrs) setuptools/__init__.py:80: in _install_setup_requires dist.fetch_build_eggs(dist.setup_requires) setuptools/dist.py:876: in fetch_build_eggs resolved_dists = pkg_resources.working_set.resolve( pkg_resources/__init__.py:782: in resolve env = Environment(self.entries) pkg_resources/__init__.py:994: in __init__ self.scan(search_path) pkg_resources/__init__.py:1027: in scan self.add(dist) pkg_resources/__init__.py:1047: in add dists.sort(key=operator.attrgetter('hashcmp'), reverse=True) pkg_resources/__init__.py:2620: in hashcmp self.parsed_version, pkg_resources/__init__.py:2667: in parsed_version self._parsed_version = parse_version(self.version) pkg_resources/__init__.py:128: in parse_version return packaging.version.LegacyVersion(v) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , version = '1.17.1-unknown' def __init__(self, version: str) -> None: self._version = str(version) self._key = _legacy_cmpkey(self._version) > warnings.warn( "Creating a LegacyVersion has been deprecated and will be " "removed in the next major release", DeprecationWarning, ) E DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release pkg_resources/_vendor/packaging/version.py:111: DeprecationWarning __________________________________________ TestSetupRequires.test_setup_requires_with_attr_version[use_setup_cfg0] ___________________________________________ v = '1.17.1-unknown' def parse_version(v): try: > return packaging.version.Version(v) pkg_resources/__init__.py:121: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'Version' object has no attribute '_version'") raised in repr()] Version object at 0x7ffb516745b0>, version = '1.17.1-unknown' def __init__(self, version: str) -> None: # Validate the version and parse it into pieces match = self._regex.search(version) if not match: > raise InvalidVersion(f"Invalid version: '{version}'") E pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: '1.17.1-unknown' pkg_resources/_vendor/packaging/version.py:266: InvalidVersion During handling of the above exception, another exception occurred: @contextlib.contextmanager def save_modules(): """ Context in which imported modules are saved. Translates exceptions internal to the context into the equivalent exception outside the context. """ saved = sys.modules.copy() with ExceptionSaver() as saved_exc: > yield saved setuptools/sandbox.py:156: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setup_dir = '/tmp/tmpwy6wekg2/test_pkg' @contextlib.contextmanager def setup_context(setup_dir): temp_dir = os.path.join(setup_dir, 'temp') with save_pkg_resources_state(): with save_modules(): with save_path(): hide_setuptools() with save_argv(): with override_temp(temp_dir): with pushd(setup_dir): # ensure setuptools commands are available __import__('setuptools') > yield setuptools/sandbox.py:198: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setup_script = '/tmp/tmpwy6wekg2/test_pkg/setup.py', args = ['--version'] def run_setup(setup_script, args): """Run a distutils setup script, sandboxed in its directory""" setup_dir = os.path.abspath(os.path.dirname(setup_script)) with setup_context(setup_dir): try: sys.argv[:] = [setup_script] + list(args) sys.path.insert(0, setup_dir) # reset to include setup dir, w/clean callback list working_set.__init__() working_set.callbacks.append(lambda dist: dist.activate()) with DirectorySandbox(setup_dir): ns = dict(__file__=setup_script, __name__='__main__') > _execfile(setup_script, ns) setuptools/sandbox.py:259: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ filename = '/tmp/tmpwy6wekg2/test_pkg/setup.py' globals = {'__builtins__': {'ArithmeticError': , 'AssertionError': , 'Attribute...__', 'setuptools': } locals = {'__builtins__': {'ArithmeticError': , 'AssertionError': , 'Attribute...__', 'setuptools': } def _execfile(filename, globals, locals=None): """ Python 3 implementation of execfile. """ mode = 'rb' with open(filename, mode) as stream: script = stream.read() if locals is None: locals = globals code = compile(script, filename, 'exec') > exec(code, globals, locals) setuptools/sandbox.py:46: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > ??? /tmp/tmpwy6wekg2/test_pkg/setup.py:2: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ attrs = {'dependency_links': ['/tmp/tmpwy6wekg2'], 'name': 'test_pkg', 'setup_requires': ['foobar==0.1']} def setup(**attrs): # Make sure we have any requirements needed to interpret 'attrs'. logging.configure() > _install_setup_requires(attrs) setuptools/__init__.py:86: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ attrs = {'dependency_links': ['/tmp/tmpwy6wekg2'], 'name': 'test_pkg', 'setup_requires': ['foobar==0.1']} def _install_setup_requires(attrs): # Note: do not use `setuptools.Distribution` directly, as # our PEP 517 backend patch `distutils.core.Distribution`. class MinimalDistribution(distutils.core.Distribution): """ A minimal version of a distribution for supporting the fetch_build_eggs interface. """ def __init__(self, attrs): _incl = 'dependency_links', 'setup_requires' filtered = {k: attrs[k] for k in set(_incl) & set(attrs)} super().__init__(filtered) # Prevent accidentally triggering discovery with incomplete set of attrs self.set_defaults._disable() def _get_project_config_files(self, filenames=None): """Ignore ``pyproject.toml``, they are not related to setup_requires""" try: cfg, toml = super()._split_standard_project_metadata(filenames) return cfg, () except Exception: return filenames, () def finalize_options(self): """ Disable finalize_options to avoid building the working set. Ref #2158. """ dist = MinimalDistribution(attrs) # Honor setup.cfg's options. dist.parse_config_files(ignore_option_errors=True) if dist.setup_requires: > dist.fetch_build_eggs(dist.setup_requires) setuptools/__init__.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .MinimalDistribution object at 0x7ffb51662b50>, requires = ['foobar==0.1'] def fetch_build_eggs(self, requires): """Resolve pre-setup requirements""" > resolved_dists = pkg_resources.working_set.resolve( _reqs.parse(requires), installer=self.fetch_build_egg, replace_conflicting=True, ) setuptools/dist.py:876: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , requirements = [], env = None installer = .MinimalDistribution object at 0x7ffb51662b50>> replace_conflicting = True, extras = None def resolve(self, requirements, env=None, installer=None, # noqa: C901 replace_conflicting=False, extras=None): """List all distributions needed to (recursively) meet `requirements` `requirements` must be a sequence of ``Requirement`` objects. `env`, if supplied, should be an ``Environment`` instance. If not supplied, it defaults to all distributions available within any entry or distribution in the working set. `installer`, if supplied, will be invoked with each requirement that cannot be met by an already-installed distribution; it should return a ``Distribution`` or ``None``. Unless `replace_conflicting=True`, raises a VersionConflict exception if any requirements are found on the path that have the correct name but the wrong version. Otherwise, if an `installer` is supplied it will be invoked to obtain the correct version of the requirement and activate it. `extras` is a list of the extras to be used with these requirements. This is important because extra requirements may look like `my_req; extra = "my_extra"`, which would otherwise be interpreted as a purely optional requirement. Instead, we want to be able to assert that these requirements are truly required. """ # set up the stack requirements = list(requirements)[::-1] # set of processed requirements processed = {} # key -> dist best = {} to_activate = [] req_extras = _ReqExtras() # Mapping of requirement to set of distributions that required it; # useful for reporting info about conflicts. required_by = collections.defaultdict(set) while requirements: # process dependencies breadth-first req = requirements.pop(0) if req in processed: # Ignore cyclic or redundant dependencies continue if not req_extras.markers_pass(req, extras): continue dist = best.get(req.key) if dist is None: # Find the best distribution and add it to the map dist = self.by_key.get(req.key) if dist is None or (dist not in req and replace_conflicting): ws = self if env is None: if dist is None: > env = Environment(self.entries) pkg_resources/__init__.py:782: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = search_path = ['does-not-matter', '/home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4', '/usr/bin', '/home/tkloczko/rpmbuild/BUILDROOT/...uild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages', '/usr/lib64/python38.zip', ...] platform = 'linux-x86_64', python = '3.8' def __init__( self, search_path=None, platform=get_supported_platform(), python=PY_MAJOR): """Snapshot distributions available on a search path Any distributions found on `search_path` are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. `platform` is an optional string specifying the name of the platform that platform-specific distributions must be compatible with. If unspecified, it defaults to the current platform. `python` is an optional string naming the desired version of Python (e.g. ``'3.6'``); it defaults to the current version. You may explicitly set `platform` (and/or `python`) to ``None`` if you wish to map *all* distributions, not just those compatible with the running platform or Python version. """ self._distmap = {} self.platform = platform self.python = python > self.scan(search_path) pkg_resources/__init__.py:994: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = search_path = ['does-not-matter', '/home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4', '/usr/bin', '/home/tkloczko/rpmbuild/BUILDROOT/...uild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages', '/usr/lib64/python38.zip', ...] def scan(self, search_path=None): """Scan `search_path` for distributions usable in this environment Any distributions found are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. Only distributions conforming to the platform/python version defined at initialization are added. """ if search_path is None: search_path = sys.path for item in search_path: for dist in find_distributions(item): > self.add(dist) pkg_resources/__init__.py:1027: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , dist = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) def add(self, dist): """Add `dist` if we ``can_add()`` it and it has not already been added """ if self.can_add(dist) and dist.has_version(): dists = self._distmap.setdefault(dist.key, []) if dist not in dists: dists.append(dist) > dists.sort(key=operator.attrgetter('hashcmp'), reverse=True) pkg_resources/__init__.py:1047: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) @property def hashcmp(self): return ( > self.parsed_version, self.precedence, self.key, self.location, self.py_version or '', self.platform or '', ) pkg_resources/__init__.py:2620: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) @property def parsed_version(self): if not hasattr(self, "_parsed_version"): > self._parsed_version = parse_version(self.version) pkg_resources/__init__.py:2667: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ v = '1.17.1-unknown' def parse_version(v): try: return packaging.version.Version(v) except packaging.version.InvalidVersion: warnings.warn( f"{v} is an invalid version and will not be supported in " "a future release", PkgResourcesDeprecationWarning, ) > return packaging.version.LegacyVersion(v) pkg_resources/__init__.py:128: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , version = '1.17.1-unknown' def __init__(self, version: str) -> None: self._version = str(version) self._key = _legacy_cmpkey(self._version) > warnings.warn( "Creating a LegacyVersion has been deprecated and will be " "removed in the next major release", DeprecationWarning, ) E DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release pkg_resources/_vendor/packaging/version.py:111: DeprecationWarning During handling of the above exception, another exception occurred: self = , use_setup_cfg = () @pytest.mark.parametrize('use_setup_cfg', use_setup_cfg) def test_setup_requires_with_attr_version(self, use_setup_cfg): def make_dependency_sdist(dist_path, distname, version): files = [( 'setup.py', DALS(""" import setuptools setuptools.setup( name={name!r}, version={version!r}, py_modules=[{name!r}], ) """.format(name=distname, version=version)), ), ( distname + '.py', DALS(""" version = 42 """), )] make_sdist(dist_path, files) with contexts.save_pkg_resources_state(): with contexts.tempdir() as temp_dir: test_pkg = create_setup_requires_package( temp_dir, setup_attrs=dict(version='attr: foobar.version'), make_package=make_dependency_sdist, use_setup_cfg=use_setup_cfg + ('version',), ) test_setup_py = os.path.join(test_pkg, 'setup.py') with contexts.quiet() as (stdout, stderr): > run_setup(test_setup_py, [str('--version')]) setuptools/tests/test_easy_install.py:689: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setuptools/sandbox.py:262: in run_setup raise /usr/lib64/python3.8/contextlib.py:131: in __exit__ self.gen.throw(type, value, traceback) setuptools/sandbox.py:198: in setup_context yield /usr/lib64/python3.8/contextlib.py:131: in __exit__ self.gen.throw(type, value, traceback) setuptools/sandbox.py:169: in save_modules saved_exc.resume() setuptools/sandbox.py:143: in resume raise exc.with_traceback(self._tb) setuptools/sandbox.py:156: in save_modules yield saved setuptools/sandbox.py:198: in setup_context yield setuptools/sandbox.py:259: in run_setup _execfile(setup_script, ns) setuptools/sandbox.py:46: in _execfile exec(code, globals, locals) /tmp/tmpwy6wekg2/test_pkg/setup.py:2: in ??? setuptools/__init__.py:86: in setup _install_setup_requires(attrs) setuptools/__init__.py:80: in _install_setup_requires dist.fetch_build_eggs(dist.setup_requires) setuptools/dist.py:876: in fetch_build_eggs resolved_dists = pkg_resources.working_set.resolve( pkg_resources/__init__.py:782: in resolve env = Environment(self.entries) pkg_resources/__init__.py:994: in __init__ self.scan(search_path) pkg_resources/__init__.py:1027: in scan self.add(dist) pkg_resources/__init__.py:1047: in add dists.sort(key=operator.attrgetter('hashcmp'), reverse=True) pkg_resources/__init__.py:2620: in hashcmp self.parsed_version, pkg_resources/__init__.py:2667: in parsed_version self._parsed_version = parse_version(self.version) pkg_resources/__init__.py:128: in parse_version return packaging.version.LegacyVersion(v) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , version = '1.17.1-unknown' def __init__(self, version: str) -> None: self._version = str(version) self._key = _legacy_cmpkey(self._version) > warnings.warn( "Creating a LegacyVersion has been deprecated and will be " "removed in the next major release", DeprecationWarning, ) E DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release pkg_resources/_vendor/packaging/version.py:111: DeprecationWarning __________________________________________ TestSetupRequires.test_setup_requires_with_attr_version[use_setup_cfg1] ___________________________________________ v = '1.17.1-unknown' def parse_version(v): try: > return packaging.version.Version(v) pkg_resources/__init__.py:121: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'Version' object has no attribute '_version'") raised in repr()] Version object at 0x7ffb50f1c0d0>, version = '1.17.1-unknown' def __init__(self, version: str) -> None: # Validate the version and parse it into pieces match = self._regex.search(version) if not match: > raise InvalidVersion(f"Invalid version: '{version}'") E pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: '1.17.1-unknown' pkg_resources/_vendor/packaging/version.py:266: InvalidVersion During handling of the above exception, another exception occurred: @contextlib.contextmanager def save_modules(): """ Context in which imported modules are saved. Translates exceptions internal to the context into the equivalent exception outside the context. """ saved = sys.modules.copy() with ExceptionSaver() as saved_exc: > yield saved setuptools/sandbox.py:156: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setup_dir = '/tmp/tmpcic5s97s/test_pkg' @contextlib.contextmanager def setup_context(setup_dir): temp_dir = os.path.join(setup_dir, 'temp') with save_pkg_resources_state(): with save_modules(): with save_path(): hide_setuptools() with save_argv(): with override_temp(temp_dir): with pushd(setup_dir): # ensure setuptools commands are available __import__('setuptools') > yield setuptools/sandbox.py:198: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setup_script = '/tmp/tmpcic5s97s/test_pkg/setup.py', args = ['--version'] def run_setup(setup_script, args): """Run a distutils setup script, sandboxed in its directory""" setup_dir = os.path.abspath(os.path.dirname(setup_script)) with setup_context(setup_dir): try: sys.argv[:] = [setup_script] + list(args) sys.path.insert(0, setup_dir) # reset to include setup dir, w/clean callback list working_set.__init__() working_set.callbacks.append(lambda dist: dist.activate()) with DirectorySandbox(setup_dir): ns = dict(__file__=setup_script, __name__='__main__') > _execfile(setup_script, ns) setuptools/sandbox.py:259: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ filename = '/tmp/tmpcic5s97s/test_pkg/setup.py' globals = {'__builtins__': {'ArithmeticError': , 'AssertionError': , 'Attribute...__', 'setuptools': } locals = {'__builtins__': {'ArithmeticError': , 'AssertionError': , 'Attribute...__', 'setuptools': } def _execfile(filename, globals, locals=None): """ Python 3 implementation of execfile. """ mode = 'rb' with open(filename, mode) as stream: script = stream.read() if locals is None: locals = globals code = compile(script, filename, 'exec') > exec(code, globals, locals) setuptools/sandbox.py:46: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > ??? /tmp/tmpcic5s97s/test_pkg/setup.py:2: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ attrs = {'name': 'test_pkg', 'setup_requires': ['foobar==0.1']} def setup(**attrs): # Make sure we have any requirements needed to interpret 'attrs'. logging.configure() > _install_setup_requires(attrs) setuptools/__init__.py:86: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ attrs = {'name': 'test_pkg', 'setup_requires': ['foobar==0.1']} def _install_setup_requires(attrs): # Note: do not use `setuptools.Distribution` directly, as # our PEP 517 backend patch `distutils.core.Distribution`. class MinimalDistribution(distutils.core.Distribution): """ A minimal version of a distribution for supporting the fetch_build_eggs interface. """ def __init__(self, attrs): _incl = 'dependency_links', 'setup_requires' filtered = {k: attrs[k] for k in set(_incl) & set(attrs)} super().__init__(filtered) # Prevent accidentally triggering discovery with incomplete set of attrs self.set_defaults._disable() def _get_project_config_files(self, filenames=None): """Ignore ``pyproject.toml``, they are not related to setup_requires""" try: cfg, toml = super()._split_standard_project_metadata(filenames) return cfg, () except Exception: return filenames, () def finalize_options(self): """ Disable finalize_options to avoid building the working set. Ref #2158. """ dist = MinimalDistribution(attrs) # Honor setup.cfg's options. dist.parse_config_files(ignore_option_errors=True) if dist.setup_requires: > dist.fetch_build_eggs(dist.setup_requires) setuptools/__init__.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .MinimalDistribution object at 0x7ffb51c760a0>, requires = ['foobar==0.1'] def fetch_build_eggs(self, requires): """Resolve pre-setup requirements""" > resolved_dists = pkg_resources.working_set.resolve( _reqs.parse(requires), installer=self.fetch_build_egg, replace_conflicting=True, ) setuptools/dist.py:876: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , requirements = [], env = None installer = .MinimalDistribution object at 0x7ffb51c760a0>> replace_conflicting = True, extras = None def resolve(self, requirements, env=None, installer=None, # noqa: C901 replace_conflicting=False, extras=None): """List all distributions needed to (recursively) meet `requirements` `requirements` must be a sequence of ``Requirement`` objects. `env`, if supplied, should be an ``Environment`` instance. If not supplied, it defaults to all distributions available within any entry or distribution in the working set. `installer`, if supplied, will be invoked with each requirement that cannot be met by an already-installed distribution; it should return a ``Distribution`` or ``None``. Unless `replace_conflicting=True`, raises a VersionConflict exception if any requirements are found on the path that have the correct name but the wrong version. Otherwise, if an `installer` is supplied it will be invoked to obtain the correct version of the requirement and activate it. `extras` is a list of the extras to be used with these requirements. This is important because extra requirements may look like `my_req; extra = "my_extra"`, which would otherwise be interpreted as a purely optional requirement. Instead, we want to be able to assert that these requirements are truly required. """ # set up the stack requirements = list(requirements)[::-1] # set of processed requirements processed = {} # key -> dist best = {} to_activate = [] req_extras = _ReqExtras() # Mapping of requirement to set of distributions that required it; # useful for reporting info about conflicts. required_by = collections.defaultdict(set) while requirements: # process dependencies breadth-first req = requirements.pop(0) if req in processed: # Ignore cyclic or redundant dependencies continue if not req_extras.markers_pass(req, extras): continue dist = best.get(req.key) if dist is None: # Find the best distribution and add it to the map dist = self.by_key.get(req.key) if dist is None or (dist not in req and replace_conflicting): ws = self if env is None: if dist is None: > env = Environment(self.entries) pkg_resources/__init__.py:782: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = search_path = ['does-not-matter', '/home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4', '/usr/bin', '/home/tkloczko/rpmbuild/BUILDROOT/...uild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages', '/usr/lib64/python38.zip', ...] platform = 'linux-x86_64', python = '3.8' def __init__( self, search_path=None, platform=get_supported_platform(), python=PY_MAJOR): """Snapshot distributions available on a search path Any distributions found on `search_path` are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. `platform` is an optional string specifying the name of the platform that platform-specific distributions must be compatible with. If unspecified, it defaults to the current platform. `python` is an optional string naming the desired version of Python (e.g. ``'3.6'``); it defaults to the current version. You may explicitly set `platform` (and/or `python`) to ``None`` if you wish to map *all* distributions, not just those compatible with the running platform or Python version. """ self._distmap = {} self.platform = platform self.python = python > self.scan(search_path) pkg_resources/__init__.py:994: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = search_path = ['does-not-matter', '/home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4', '/usr/bin', '/home/tkloczko/rpmbuild/BUILDROOT/...uild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages', '/usr/lib64/python38.zip', ...] def scan(self, search_path=None): """Scan `search_path` for distributions usable in this environment Any distributions found are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. Only distributions conforming to the platform/python version defined at initialization are added. """ if search_path is None: search_path = sys.path for item in search_path: for dist in find_distributions(item): > self.add(dist) pkg_resources/__init__.py:1027: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , dist = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) def add(self, dist): """Add `dist` if we ``can_add()`` it and it has not already been added """ if self.can_add(dist) and dist.has_version(): dists = self._distmap.setdefault(dist.key, []) if dist not in dists: dists.append(dist) > dists.sort(key=operator.attrgetter('hashcmp'), reverse=True) pkg_resources/__init__.py:1047: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) @property def hashcmp(self): return ( > self.parsed_version, self.precedence, self.key, self.location, self.py_version or '', self.platform or '', ) pkg_resources/__init__.py:2620: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) @property def parsed_version(self): if not hasattr(self, "_parsed_version"): > self._parsed_version = parse_version(self.version) pkg_resources/__init__.py:2667: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ v = '1.17.1-unknown' def parse_version(v): try: return packaging.version.Version(v) except packaging.version.InvalidVersion: warnings.warn( f"{v} is an invalid version and will not be supported in " "a future release", PkgResourcesDeprecationWarning, ) > return packaging.version.LegacyVersion(v) pkg_resources/__init__.py:128: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , version = '1.17.1-unknown' def __init__(self, version: str) -> None: self._version = str(version) self._key = _legacy_cmpkey(self._version) > warnings.warn( "Creating a LegacyVersion has been deprecated and will be " "removed in the next major release", DeprecationWarning, ) E DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release pkg_resources/_vendor/packaging/version.py:111: DeprecationWarning During handling of the above exception, another exception occurred: self = , use_setup_cfg = ('dependency_links',) @pytest.mark.parametrize('use_setup_cfg', use_setup_cfg) def test_setup_requires_with_attr_version(self, use_setup_cfg): def make_dependency_sdist(dist_path, distname, version): files = [( 'setup.py', DALS(""" import setuptools setuptools.setup( name={name!r}, version={version!r}, py_modules=[{name!r}], ) """.format(name=distname, version=version)), ), ( distname + '.py', DALS(""" version = 42 """), )] make_sdist(dist_path, files) with contexts.save_pkg_resources_state(): with contexts.tempdir() as temp_dir: test_pkg = create_setup_requires_package( temp_dir, setup_attrs=dict(version='attr: foobar.version'), make_package=make_dependency_sdist, use_setup_cfg=use_setup_cfg + ('version',), ) test_setup_py = os.path.join(test_pkg, 'setup.py') with contexts.quiet() as (stdout, stderr): > run_setup(test_setup_py, [str('--version')]) setuptools/tests/test_easy_install.py:689: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setuptools/sandbox.py:262: in run_setup raise /usr/lib64/python3.8/contextlib.py:131: in __exit__ self.gen.throw(type, value, traceback) setuptools/sandbox.py:198: in setup_context yield /usr/lib64/python3.8/contextlib.py:131: in __exit__ self.gen.throw(type, value, traceback) setuptools/sandbox.py:169: in save_modules saved_exc.resume() setuptools/sandbox.py:143: in resume raise exc.with_traceback(self._tb) setuptools/sandbox.py:156: in save_modules yield saved setuptools/sandbox.py:198: in setup_context yield setuptools/sandbox.py:259: in run_setup _execfile(setup_script, ns) setuptools/sandbox.py:46: in _execfile exec(code, globals, locals) /tmp/tmpcic5s97s/test_pkg/setup.py:2: in ??? setuptools/__init__.py:86: in setup _install_setup_requires(attrs) setuptools/__init__.py:80: in _install_setup_requires dist.fetch_build_eggs(dist.setup_requires) setuptools/dist.py:876: in fetch_build_eggs resolved_dists = pkg_resources.working_set.resolve( pkg_resources/__init__.py:782: in resolve env = Environment(self.entries) pkg_resources/__init__.py:994: in __init__ self.scan(search_path) pkg_resources/__init__.py:1027: in scan self.add(dist) pkg_resources/__init__.py:1047: in add dists.sort(key=operator.attrgetter('hashcmp'), reverse=True) pkg_resources/__init__.py:2620: in hashcmp self.parsed_version, pkg_resources/__init__.py:2667: in parsed_version self._parsed_version = parse_version(self.version) pkg_resources/__init__.py:128: in parse_version return packaging.version.LegacyVersion(v) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , version = '1.17.1-unknown' def __init__(self, version: str) -> None: self._version = str(version) self._key = _legacy_cmpkey(self._version) > warnings.warn( "Creating a LegacyVersion has been deprecated and will be " "removed in the next major release", DeprecationWarning, ) E DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release pkg_resources/_vendor/packaging/version.py:111: DeprecationWarning __________________________________________ TestSetupRequires.test_setup_requires_with_attr_version[use_setup_cfg2] ___________________________________________ v = '1.17.1-unknown' def parse_version(v): try: > return packaging.version.Version(v) pkg_resources/__init__.py:121: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'Version' object has no attribute '_version'") raised in repr()] Version object at 0x7ffb5090d040>, version = '1.17.1-unknown' def __init__(self, version: str) -> None: # Validate the version and parse it into pieces match = self._regex.search(version) if not match: > raise InvalidVersion(f"Invalid version: '{version}'") E pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: '1.17.1-unknown' pkg_resources/_vendor/packaging/version.py:266: InvalidVersion During handling of the above exception, another exception occurred: @contextlib.contextmanager def save_modules(): """ Context in which imported modules are saved. Translates exceptions internal to the context into the equivalent exception outside the context. """ saved = sys.modules.copy() with ExceptionSaver() as saved_exc: > yield saved setuptools/sandbox.py:156: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setup_dir = '/tmp/tmp97o8v4gj/test_pkg' @contextlib.contextmanager def setup_context(setup_dir): temp_dir = os.path.join(setup_dir, 'temp') with save_pkg_resources_state(): with save_modules(): with save_path(): hide_setuptools() with save_argv(): with override_temp(temp_dir): with pushd(setup_dir): # ensure setuptools commands are available __import__('setuptools') > yield setuptools/sandbox.py:198: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setup_script = '/tmp/tmp97o8v4gj/test_pkg/setup.py', args = ['--version'] def run_setup(setup_script, args): """Run a distutils setup script, sandboxed in its directory""" setup_dir = os.path.abspath(os.path.dirname(setup_script)) with setup_context(setup_dir): try: sys.argv[:] = [setup_script] + list(args) sys.path.insert(0, setup_dir) # reset to include setup dir, w/clean callback list working_set.__init__() working_set.callbacks.append(lambda dist: dist.activate()) with DirectorySandbox(setup_dir): ns = dict(__file__=setup_script, __name__='__main__') > _execfile(setup_script, ns) setuptools/sandbox.py:259: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ filename = '/tmp/tmp97o8v4gj/test_pkg/setup.py' globals = {'__builtins__': {'ArithmeticError': , 'AssertionError': , 'Attribute...__', 'setuptools': } locals = {'__builtins__': {'ArithmeticError': , 'AssertionError': , 'Attribute...__', 'setuptools': } def _execfile(filename, globals, locals=None): """ Python 3 implementation of execfile. """ mode = 'rb' with open(filename, mode) as stream: script = stream.read() if locals is None: locals = globals code = compile(script, filename, 'exec') > exec(code, globals, locals) setuptools/sandbox.py:46: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > ??? /tmp/tmp97o8v4gj/test_pkg/setup.py:2: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ attrs = {'dependency_links': ['/tmp/tmp97o8v4gj'], 'name': 'test_pkg'} def setup(**attrs): # Make sure we have any requirements needed to interpret 'attrs'. logging.configure() > _install_setup_requires(attrs) setuptools/__init__.py:86: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ attrs = {'dependency_links': ['/tmp/tmp97o8v4gj'], 'name': 'test_pkg'} def _install_setup_requires(attrs): # Note: do not use `setuptools.Distribution` directly, as # our PEP 517 backend patch `distutils.core.Distribution`. class MinimalDistribution(distutils.core.Distribution): """ A minimal version of a distribution for supporting the fetch_build_eggs interface. """ def __init__(self, attrs): _incl = 'dependency_links', 'setup_requires' filtered = {k: attrs[k] for k in set(_incl) & set(attrs)} super().__init__(filtered) # Prevent accidentally triggering discovery with incomplete set of attrs self.set_defaults._disable() def _get_project_config_files(self, filenames=None): """Ignore ``pyproject.toml``, they are not related to setup_requires""" try: cfg, toml = super()._split_standard_project_metadata(filenames) return cfg, () except Exception: return filenames, () def finalize_options(self): """ Disable finalize_options to avoid building the working set. Ref #2158. """ dist = MinimalDistribution(attrs) # Honor setup.cfg's options. dist.parse_config_files(ignore_option_errors=True) if dist.setup_requires: > dist.fetch_build_eggs(dist.setup_requires) setuptools/__init__.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .MinimalDistribution object at 0x7ffb50b3cf10>, requires = ['foobar==0.1'] def fetch_build_eggs(self, requires): """Resolve pre-setup requirements""" > resolved_dists = pkg_resources.working_set.resolve( _reqs.parse(requires), installer=self.fetch_build_egg, replace_conflicting=True, ) setuptools/dist.py:876: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , requirements = [], env = None installer = .MinimalDistribution object at 0x7ffb50b3cf10>> replace_conflicting = True, extras = None def resolve(self, requirements, env=None, installer=None, # noqa: C901 replace_conflicting=False, extras=None): """List all distributions needed to (recursively) meet `requirements` `requirements` must be a sequence of ``Requirement`` objects. `env`, if supplied, should be an ``Environment`` instance. If not supplied, it defaults to all distributions available within any entry or distribution in the working set. `installer`, if supplied, will be invoked with each requirement that cannot be met by an already-installed distribution; it should return a ``Distribution`` or ``None``. Unless `replace_conflicting=True`, raises a VersionConflict exception if any requirements are found on the path that have the correct name but the wrong version. Otherwise, if an `installer` is supplied it will be invoked to obtain the correct version of the requirement and activate it. `extras` is a list of the extras to be used with these requirements. This is important because extra requirements may look like `my_req; extra = "my_extra"`, which would otherwise be interpreted as a purely optional requirement. Instead, we want to be able to assert that these requirements are truly required. """ # set up the stack requirements = list(requirements)[::-1] # set of processed requirements processed = {} # key -> dist best = {} to_activate = [] req_extras = _ReqExtras() # Mapping of requirement to set of distributions that required it; # useful for reporting info about conflicts. required_by = collections.defaultdict(set) while requirements: # process dependencies breadth-first req = requirements.pop(0) if req in processed: # Ignore cyclic or redundant dependencies continue if not req_extras.markers_pass(req, extras): continue dist = best.get(req.key) if dist is None: # Find the best distribution and add it to the map dist = self.by_key.get(req.key) if dist is None or (dist not in req and replace_conflicting): ws = self if env is None: if dist is None: > env = Environment(self.entries) pkg_resources/__init__.py:782: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = search_path = ['does-not-matter', '/home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4', '/usr/bin', '/home/tkloczko/rpmbuild/BUILDROOT/...uild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages', '/usr/lib64/python38.zip', ...] platform = 'linux-x86_64', python = '3.8' def __init__( self, search_path=None, platform=get_supported_platform(), python=PY_MAJOR): """Snapshot distributions available on a search path Any distributions found on `search_path` are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. `platform` is an optional string specifying the name of the platform that platform-specific distributions must be compatible with. If unspecified, it defaults to the current platform. `python` is an optional string naming the desired version of Python (e.g. ``'3.6'``); it defaults to the current version. You may explicitly set `platform` (and/or `python`) to ``None`` if you wish to map *all* distributions, not just those compatible with the running platform or Python version. """ self._distmap = {} self.platform = platform self.python = python > self.scan(search_path) pkg_resources/__init__.py:994: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = search_path = ['does-not-matter', '/home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4', '/usr/bin', '/home/tkloczko/rpmbuild/BUILDROOT/...uild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages', '/usr/lib64/python38.zip', ...] def scan(self, search_path=None): """Scan `search_path` for distributions usable in this environment Any distributions found are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. Only distributions conforming to the platform/python version defined at initialization are added. """ if search_path is None: search_path = sys.path for item in search_path: for dist in find_distributions(item): > self.add(dist) pkg_resources/__init__.py:1027: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , dist = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) def add(self, dist): """Add `dist` if we ``can_add()`` it and it has not already been added """ if self.can_add(dist) and dist.has_version(): dists = self._distmap.setdefault(dist.key, []) if dist not in dists: dists.append(dist) > dists.sort(key=operator.attrgetter('hashcmp'), reverse=True) pkg_resources/__init__.py:1047: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) @property def hashcmp(self): return ( > self.parsed_version, self.precedence, self.key, self.location, self.py_version or '', self.platform or '', ) pkg_resources/__init__.py:2620: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) @property def parsed_version(self): if not hasattr(self, "_parsed_version"): > self._parsed_version = parse_version(self.version) pkg_resources/__init__.py:2667: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ v = '1.17.1-unknown' def parse_version(v): try: return packaging.version.Version(v) except packaging.version.InvalidVersion: warnings.warn( f"{v} is an invalid version and will not be supported in " "a future release", PkgResourcesDeprecationWarning, ) > return packaging.version.LegacyVersion(v) pkg_resources/__init__.py:128: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , version = '1.17.1-unknown' def __init__(self, version: str) -> None: self._version = str(version) self._key = _legacy_cmpkey(self._version) > warnings.warn( "Creating a LegacyVersion has been deprecated and will be " "removed in the next major release", DeprecationWarning, ) E DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release pkg_resources/_vendor/packaging/version.py:111: DeprecationWarning During handling of the above exception, another exception occurred: self = , use_setup_cfg = ('setup_requires',) @pytest.mark.parametrize('use_setup_cfg', use_setup_cfg) def test_setup_requires_with_attr_version(self, use_setup_cfg): def make_dependency_sdist(dist_path, distname, version): files = [( 'setup.py', DALS(""" import setuptools setuptools.setup( name={name!r}, version={version!r}, py_modules=[{name!r}], ) """.format(name=distname, version=version)), ), ( distname + '.py', DALS(""" version = 42 """), )] make_sdist(dist_path, files) with contexts.save_pkg_resources_state(): with contexts.tempdir() as temp_dir: test_pkg = create_setup_requires_package( temp_dir, setup_attrs=dict(version='attr: foobar.version'), make_package=make_dependency_sdist, use_setup_cfg=use_setup_cfg + ('version',), ) test_setup_py = os.path.join(test_pkg, 'setup.py') with contexts.quiet() as (stdout, stderr): > run_setup(test_setup_py, [str('--version')]) setuptools/tests/test_easy_install.py:689: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setuptools/sandbox.py:262: in run_setup raise /usr/lib64/python3.8/contextlib.py:131: in __exit__ self.gen.throw(type, value, traceback) setuptools/sandbox.py:198: in setup_context yield /usr/lib64/python3.8/contextlib.py:131: in __exit__ self.gen.throw(type, value, traceback) setuptools/sandbox.py:169: in save_modules saved_exc.resume() setuptools/sandbox.py:143: in resume raise exc.with_traceback(self._tb) setuptools/sandbox.py:156: in save_modules yield saved setuptools/sandbox.py:198: in setup_context yield setuptools/sandbox.py:259: in run_setup _execfile(setup_script, ns) setuptools/sandbox.py:46: in _execfile exec(code, globals, locals) /tmp/tmp97o8v4gj/test_pkg/setup.py:2: in ??? setuptools/__init__.py:86: in setup _install_setup_requires(attrs) setuptools/__init__.py:80: in _install_setup_requires dist.fetch_build_eggs(dist.setup_requires) setuptools/dist.py:876: in fetch_build_eggs resolved_dists = pkg_resources.working_set.resolve( pkg_resources/__init__.py:782: in resolve env = Environment(self.entries) pkg_resources/__init__.py:994: in __init__ self.scan(search_path) pkg_resources/__init__.py:1027: in scan self.add(dist) pkg_resources/__init__.py:1047: in add dists.sort(key=operator.attrgetter('hashcmp'), reverse=True) pkg_resources/__init__.py:2620: in hashcmp self.parsed_version, pkg_resources/__init__.py:2667: in parsed_version self._parsed_version = parse_version(self.version) pkg_resources/__init__.py:128: in parse_version return packaging.version.LegacyVersion(v) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , version = '1.17.1-unknown' def __init__(self, version: str) -> None: self._version = str(version) self._key = _legacy_cmpkey(self._version) > warnings.warn( "Creating a LegacyVersion has been deprecated and will be " "removed in the next major release", DeprecationWarning, ) E DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release pkg_resources/_vendor/packaging/version.py:111: DeprecationWarning __________________________________________ TestSetupRequires.test_setup_requires_with_attr_version[use_setup_cfg3] ___________________________________________ v = '1.17.1-unknown' def parse_version(v): try: > return packaging.version.Version(v) pkg_resources/__init__.py:121: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'Version' object has no attribute '_version'") raised in repr()] Version object at 0x7ffb5029c3d0>, version = '1.17.1-unknown' def __init__(self, version: str) -> None: # Validate the version and parse it into pieces match = self._regex.search(version) if not match: > raise InvalidVersion(f"Invalid version: '{version}'") E pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: '1.17.1-unknown' pkg_resources/_vendor/packaging/version.py:266: InvalidVersion During handling of the above exception, another exception occurred: @contextlib.contextmanager def save_modules(): """ Context in which imported modules are saved. Translates exceptions internal to the context into the equivalent exception outside the context. """ saved = sys.modules.copy() with ExceptionSaver() as saved_exc: > yield saved setuptools/sandbox.py:156: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setup_dir = '/tmp/tmprzburr09/test_pkg' @contextlib.contextmanager def setup_context(setup_dir): temp_dir = os.path.join(setup_dir, 'temp') with save_pkg_resources_state(): with save_modules(): with save_path(): hide_setuptools() with save_argv(): with override_temp(temp_dir): with pushd(setup_dir): # ensure setuptools commands are available __import__('setuptools') > yield setuptools/sandbox.py:198: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setup_script = '/tmp/tmprzburr09/test_pkg/setup.py', args = ['--version'] def run_setup(setup_script, args): """Run a distutils setup script, sandboxed in its directory""" setup_dir = os.path.abspath(os.path.dirname(setup_script)) with setup_context(setup_dir): try: sys.argv[:] = [setup_script] + list(args) sys.path.insert(0, setup_dir) # reset to include setup dir, w/clean callback list working_set.__init__() working_set.callbacks.append(lambda dist: dist.activate()) with DirectorySandbox(setup_dir): ns = dict(__file__=setup_script, __name__='__main__') > _execfile(setup_script, ns) setuptools/sandbox.py:259: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ filename = '/tmp/tmprzburr09/test_pkg/setup.py' globals = {'__builtins__': {'ArithmeticError': , 'AssertionError': , 'Attribute...__', 'setuptools': } locals = {'__builtins__': {'ArithmeticError': , 'AssertionError': , 'Attribute...__', 'setuptools': } def _execfile(filename, globals, locals=None): """ Python 3 implementation of execfile. """ mode = 'rb' with open(filename, mode) as stream: script = stream.read() if locals is None: locals = globals code = compile(script, filename, 'exec') > exec(code, globals, locals) setuptools/sandbox.py:46: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > ??? /tmp/tmprzburr09/test_pkg/setup.py:2: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ attrs = {'name': 'test_pkg'} def setup(**attrs): # Make sure we have any requirements needed to interpret 'attrs'. logging.configure() > _install_setup_requires(attrs) setuptools/__init__.py:86: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ attrs = {'name': 'test_pkg'} def _install_setup_requires(attrs): # Note: do not use `setuptools.Distribution` directly, as # our PEP 517 backend patch `distutils.core.Distribution`. class MinimalDistribution(distutils.core.Distribution): """ A minimal version of a distribution for supporting the fetch_build_eggs interface. """ def __init__(self, attrs): _incl = 'dependency_links', 'setup_requires' filtered = {k: attrs[k] for k in set(_incl) & set(attrs)} super().__init__(filtered) # Prevent accidentally triggering discovery with incomplete set of attrs self.set_defaults._disable() def _get_project_config_files(self, filenames=None): """Ignore ``pyproject.toml``, they are not related to setup_requires""" try: cfg, toml = super()._split_standard_project_metadata(filenames) return cfg, () except Exception: return filenames, () def finalize_options(self): """ Disable finalize_options to avoid building the working set. Ref #2158. """ dist = MinimalDistribution(attrs) # Honor setup.cfg's options. dist.parse_config_files(ignore_option_errors=True) if dist.setup_requires: > dist.fetch_build_eggs(dist.setup_requires) setuptools/__init__.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .MinimalDistribution object at 0x7ffb5074ebe0>, requires = ['foobar==0.1'] def fetch_build_eggs(self, requires): """Resolve pre-setup requirements""" > resolved_dists = pkg_resources.working_set.resolve( _reqs.parse(requires), installer=self.fetch_build_egg, replace_conflicting=True, ) setuptools/dist.py:876: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , requirements = [], env = None installer = .MinimalDistribution object at 0x7ffb5074ebe0>> replace_conflicting = True, extras = None def resolve(self, requirements, env=None, installer=None, # noqa: C901 replace_conflicting=False, extras=None): """List all distributions needed to (recursively) meet `requirements` `requirements` must be a sequence of ``Requirement`` objects. `env`, if supplied, should be an ``Environment`` instance. If not supplied, it defaults to all distributions available within any entry or distribution in the working set. `installer`, if supplied, will be invoked with each requirement that cannot be met by an already-installed distribution; it should return a ``Distribution`` or ``None``. Unless `replace_conflicting=True`, raises a VersionConflict exception if any requirements are found on the path that have the correct name but the wrong version. Otherwise, if an `installer` is supplied it will be invoked to obtain the correct version of the requirement and activate it. `extras` is a list of the extras to be used with these requirements. This is important because extra requirements may look like `my_req; extra = "my_extra"`, which would otherwise be interpreted as a purely optional requirement. Instead, we want to be able to assert that these requirements are truly required. """ # set up the stack requirements = list(requirements)[::-1] # set of processed requirements processed = {} # key -> dist best = {} to_activate = [] req_extras = _ReqExtras() # Mapping of requirement to set of distributions that required it; # useful for reporting info about conflicts. required_by = collections.defaultdict(set) while requirements: # process dependencies breadth-first req = requirements.pop(0) if req in processed: # Ignore cyclic or redundant dependencies continue if not req_extras.markers_pass(req, extras): continue dist = best.get(req.key) if dist is None: # Find the best distribution and add it to the map dist = self.by_key.get(req.key) if dist is None or (dist not in req and replace_conflicting): ws = self if env is None: if dist is None: > env = Environment(self.entries) pkg_resources/__init__.py:782: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = search_path = ['does-not-matter', '/home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4', '/usr/bin', '/home/tkloczko/rpmbuild/BUILDROOT/...uild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages', '/usr/lib64/python38.zip', ...] platform = 'linux-x86_64', python = '3.8' def __init__( self, search_path=None, platform=get_supported_platform(), python=PY_MAJOR): """Snapshot distributions available on a search path Any distributions found on `search_path` are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. `platform` is an optional string specifying the name of the platform that platform-specific distributions must be compatible with. If unspecified, it defaults to the current platform. `python` is an optional string naming the desired version of Python (e.g. ``'3.6'``); it defaults to the current version. You may explicitly set `platform` (and/or `python`) to ``None`` if you wish to map *all* distributions, not just those compatible with the running platform or Python version. """ self._distmap = {} self.platform = platform self.python = python > self.scan(search_path) pkg_resources/__init__.py:994: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = search_path = ['does-not-matter', '/home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4', '/usr/bin', '/home/tkloczko/rpmbuild/BUILDROOT/...uild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages', '/usr/lib64/python38.zip', ...] def scan(self, search_path=None): """Scan `search_path` for distributions usable in this environment Any distributions found are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. Only distributions conforming to the platform/python version defined at initialization are added. """ if search_path is None: search_path = sys.path for item in search_path: for dist in find_distributions(item): > self.add(dist) pkg_resources/__init__.py:1027: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , dist = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) def add(self, dist): """Add `dist` if we ``can_add()`` it and it has not already been added """ if self.can_add(dist) and dist.has_version(): dists = self._distmap.setdefault(dist.key, []) if dist not in dists: dists.append(dist) > dists.sort(key=operator.attrgetter('hashcmp'), reverse=True) pkg_resources/__init__.py:1047: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) @property def hashcmp(self): return ( > self.parsed_version, self.precedence, self.key, self.location, self.py_version or '', self.platform or '', ) pkg_resources/__init__.py:2620: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) @property def parsed_version(self): if not hasattr(self, "_parsed_version"): > self._parsed_version = parse_version(self.version) pkg_resources/__init__.py:2667: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ v = '1.17.1-unknown' def parse_version(v): try: return packaging.version.Version(v) except packaging.version.InvalidVersion: warnings.warn( f"{v} is an invalid version and will not be supported in " "a future release", PkgResourcesDeprecationWarning, ) > return packaging.version.LegacyVersion(v) pkg_resources/__init__.py:128: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , version = '1.17.1-unknown' def __init__(self, version: str) -> None: self._version = str(version) self._key = _legacy_cmpkey(self._version) > warnings.warn( "Creating a LegacyVersion has been deprecated and will be " "removed in the next major release", DeprecationWarning, ) E DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release pkg_resources/_vendor/packaging/version.py:111: DeprecationWarning During handling of the above exception, another exception occurred: self = , use_setup_cfg = ('dependency_links', 'setup_requires') @pytest.mark.parametrize('use_setup_cfg', use_setup_cfg) def test_setup_requires_with_attr_version(self, use_setup_cfg): def make_dependency_sdist(dist_path, distname, version): files = [( 'setup.py', DALS(""" import setuptools setuptools.setup( name={name!r}, version={version!r}, py_modules=[{name!r}], ) """.format(name=distname, version=version)), ), ( distname + '.py', DALS(""" version = 42 """), )] make_sdist(dist_path, files) with contexts.save_pkg_resources_state(): with contexts.tempdir() as temp_dir: test_pkg = create_setup_requires_package( temp_dir, setup_attrs=dict(version='attr: foobar.version'), make_package=make_dependency_sdist, use_setup_cfg=use_setup_cfg + ('version',), ) test_setup_py = os.path.join(test_pkg, 'setup.py') with contexts.quiet() as (stdout, stderr): > run_setup(test_setup_py, [str('--version')]) setuptools/tests/test_easy_install.py:689: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setuptools/sandbox.py:262: in run_setup raise /usr/lib64/python3.8/contextlib.py:131: in __exit__ self.gen.throw(type, value, traceback) setuptools/sandbox.py:198: in setup_context yield /usr/lib64/python3.8/contextlib.py:131: in __exit__ self.gen.throw(type, value, traceback) setuptools/sandbox.py:169: in save_modules saved_exc.resume() setuptools/sandbox.py:143: in resume raise exc.with_traceback(self._tb) setuptools/sandbox.py:156: in save_modules yield saved setuptools/sandbox.py:198: in setup_context yield setuptools/sandbox.py:259: in run_setup _execfile(setup_script, ns) setuptools/sandbox.py:46: in _execfile exec(code, globals, locals) /tmp/tmprzburr09/test_pkg/setup.py:2: in ??? setuptools/__init__.py:86: in setup _install_setup_requires(attrs) setuptools/__init__.py:80: in _install_setup_requires dist.fetch_build_eggs(dist.setup_requires) setuptools/dist.py:876: in fetch_build_eggs resolved_dists = pkg_resources.working_set.resolve( pkg_resources/__init__.py:782: in resolve env = Environment(self.entries) pkg_resources/__init__.py:994: in __init__ self.scan(search_path) pkg_resources/__init__.py:1027: in scan self.add(dist) pkg_resources/__init__.py:1047: in add dists.sort(key=operator.attrgetter('hashcmp'), reverse=True) pkg_resources/__init__.py:2620: in hashcmp self.parsed_version, pkg_resources/__init__.py:2667: in parsed_version self._parsed_version = parse_version(self.version) pkg_resources/__init__.py:128: in parse_version return packaging.version.LegacyVersion(v) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , version = '1.17.1-unknown' def __init__(self, version: str) -> None: self._version = str(version) self._key = _legacy_cmpkey(self._version) > warnings.warn( "Creating a LegacyVersion has been deprecated and will be " "removed in the next major release", DeprecationWarning, ) E DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release pkg_resources/_vendor/packaging/version.py:111: DeprecationWarning ____________________________________________________ TestSetupRequires.test_setup_requires_honors_pip_env ____________________________________________________ v = '1.17.1-unknown' def parse_version(v): try: > return packaging.version.Version(v) pkg_resources/__init__.py:121: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'Version' object has no attribute '_version'") raised in repr()] Version object at 0x7ffb4fd24a90>, version = '1.17.1-unknown' def __init__(self, version: str) -> None: # Validate the version and parse it into pieces match = self._regex.search(version) if not match: > raise InvalidVersion(f"Invalid version: '{version}'") E pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: '1.17.1-unknown' pkg_resources/_vendor/packaging/version.py:266: InvalidVersion During handling of the above exception, another exception occurred: @contextlib.contextmanager def save_modules(): """ Context in which imported modules are saved. Translates exceptions internal to the context into the equivalent exception outside the context. """ saved = sys.modules.copy() with ExceptionSaver() as saved_exc: > yield saved setuptools/sandbox.py:156: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setup_dir = '/tmp/tmpack3kv9d/test_pkg' @contextlib.contextmanager def setup_context(setup_dir): temp_dir = os.path.join(setup_dir, 'temp') with save_pkg_resources_state(): with save_modules(): with save_path(): hide_setuptools() with save_argv(): with override_temp(temp_dir): with pushd(setup_dir): # ensure setuptools commands are available __import__('setuptools') > yield setuptools/sandbox.py:198: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setup_script = '/tmp/tmpack3kv9d/test_pkg/setup.py', args = ['--version'] def run_setup(setup_script, args): """Run a distutils setup script, sandboxed in its directory""" setup_dir = os.path.abspath(os.path.dirname(setup_script)) with setup_context(setup_dir): try: sys.argv[:] = [setup_script] + list(args) sys.path.insert(0, setup_dir) # reset to include setup dir, w/clean callback list working_set.__init__() working_set.callbacks.append(lambda dist: dist.activate()) with DirectorySandbox(setup_dir): ns = dict(__file__=setup_script, __name__='__main__') > _execfile(setup_script, ns) setuptools/sandbox.py:259: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ filename = '/tmp/tmpack3kv9d/test_pkg/setup.py' globals = {'__builtins__': {'ArithmeticError': , 'AssertionError': , 'Attribute...__', 'setuptools': } locals = {'__builtins__': {'ArithmeticError': , 'AssertionError': , 'Attribute...__', 'setuptools': } def _execfile(filename, globals, locals=None): """ Python 3 implementation of execfile. """ mode = 'rb' with open(filename, mode) as stream: script = stream.read() if locals is None: locals = globals code = compile(script, filename, 'exec') > exec(code, globals, locals) setuptools/sandbox.py:46: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > ??? /tmp/tmpack3kv9d/test_pkg/setup.py:2: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ attrs = {'dependency_links': [], 'name': 'test_pkg', 'setup_requires': ['python-xlib==0.19'], 'version': '0.0'} def setup(**attrs): # Make sure we have any requirements needed to interpret 'attrs'. logging.configure() > _install_setup_requires(attrs) setuptools/__init__.py:86: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ attrs = {'dependency_links': [], 'name': 'test_pkg', 'setup_requires': ['python-xlib==0.19'], 'version': '0.0'} def _install_setup_requires(attrs): # Note: do not use `setuptools.Distribution` directly, as # our PEP 517 backend patch `distutils.core.Distribution`. class MinimalDistribution(distutils.core.Distribution): """ A minimal version of a distribution for supporting the fetch_build_eggs interface. """ def __init__(self, attrs): _incl = 'dependency_links', 'setup_requires' filtered = {k: attrs[k] for k in set(_incl) & set(attrs)} super().__init__(filtered) # Prevent accidentally triggering discovery with incomplete set of attrs self.set_defaults._disable() def _get_project_config_files(self, filenames=None): """Ignore ``pyproject.toml``, they are not related to setup_requires""" try: cfg, toml = super()._split_standard_project_metadata(filenames) return cfg, () except Exception: return filenames, () def finalize_options(self): """ Disable finalize_options to avoid building the working set. Ref #2158. """ dist = MinimalDistribution(attrs) # Honor setup.cfg's options. dist.parse_config_files(ignore_option_errors=True) if dist.setup_requires: > dist.fetch_build_eggs(dist.setup_requires) setuptools/__init__.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .MinimalDistribution object at 0x7ffb50109c10>, requires = ['python-xlib==0.19'] def fetch_build_eggs(self, requires): """Resolve pre-setup requirements""" > resolved_dists = pkg_resources.working_set.resolve( _reqs.parse(requires), installer=self.fetch_build_egg, replace_conflicting=True, ) setuptools/dist.py:876: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , requirements = [], env = None installer = .MinimalDistribution object at 0x7ffb50109c10>> replace_conflicting = True, extras = None def resolve(self, requirements, env=None, installer=None, # noqa: C901 replace_conflicting=False, extras=None): """List all distributions needed to (recursively) meet `requirements` `requirements` must be a sequence of ``Requirement`` objects. `env`, if supplied, should be an ``Environment`` instance. If not supplied, it defaults to all distributions available within any entry or distribution in the working set. `installer`, if supplied, will be invoked with each requirement that cannot be met by an already-installed distribution; it should return a ``Distribution`` or ``None``. Unless `replace_conflicting=True`, raises a VersionConflict exception if any requirements are found on the path that have the correct name but the wrong version. Otherwise, if an `installer` is supplied it will be invoked to obtain the correct version of the requirement and activate it. `extras` is a list of the extras to be used with these requirements. This is important because extra requirements may look like `my_req; extra = "my_extra"`, which would otherwise be interpreted as a purely optional requirement. Instead, we want to be able to assert that these requirements are truly required. """ # set up the stack requirements = list(requirements)[::-1] # set of processed requirements processed = {} # key -> dist best = {} to_activate = [] req_extras = _ReqExtras() # Mapping of requirement to set of distributions that required it; # useful for reporting info about conflicts. required_by = collections.defaultdict(set) while requirements: # process dependencies breadth-first req = requirements.pop(0) if req in processed: # Ignore cyclic or redundant dependencies continue if not req_extras.markers_pass(req, extras): continue dist = best.get(req.key) if dist is None: # Find the best distribution and add it to the map dist = self.by_key.get(req.key) if dist is None or (dist not in req and replace_conflicting): ws = self if env is None: if dist is None: > env = Environment(self.entries) pkg_resources/__init__.py:782: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = search_path = ['does-not-matter', '/home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4', '/usr/bin', '/home/tkloczko/rpmbuild/BUILDROOT/...uild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages', '/usr/lib64/python38.zip', ...] platform = 'linux-x86_64', python = '3.8' def __init__( self, search_path=None, platform=get_supported_platform(), python=PY_MAJOR): """Snapshot distributions available on a search path Any distributions found on `search_path` are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. `platform` is an optional string specifying the name of the platform that platform-specific distributions must be compatible with. If unspecified, it defaults to the current platform. `python` is an optional string naming the desired version of Python (e.g. ``'3.6'``); it defaults to the current version. You may explicitly set `platform` (and/or `python`) to ``None`` if you wish to map *all* distributions, not just those compatible with the running platform or Python version. """ self._distmap = {} self.platform = platform self.python = python > self.scan(search_path) pkg_resources/__init__.py:994: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = search_path = ['does-not-matter', '/home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4', '/usr/bin', '/home/tkloczko/rpmbuild/BUILDROOT/...uild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages', '/usr/lib64/python38.zip', ...] def scan(self, search_path=None): """Scan `search_path` for distributions usable in this environment Any distributions found are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. Only distributions conforming to the platform/python version defined at initialization are added. """ if search_path is None: search_path = sys.path for item in search_path: for dist in find_distributions(item): > self.add(dist) pkg_resources/__init__.py:1027: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , dist = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) def add(self, dist): """Add `dist` if we ``can_add()`` it and it has not already been added """ if self.can_add(dist) and dist.has_version(): dists = self._distmap.setdefault(dist.key, []) if dist not in dists: dists.append(dist) > dists.sort(key=operator.attrgetter('hashcmp'), reverse=True) pkg_resources/__init__.py:1047: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) @property def hashcmp(self): return ( > self.parsed_version, self.precedence, self.key, self.location, self.py_version or '', self.platform or '', ) pkg_resources/__init__.py:2620: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) @property def parsed_version(self): if not hasattr(self, "_parsed_version"): > self._parsed_version = parse_version(self.version) pkg_resources/__init__.py:2667: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ v = '1.17.1-unknown' def parse_version(v): try: return packaging.version.Version(v) except packaging.version.InvalidVersion: warnings.warn( f"{v} is an invalid version and will not be supported in " "a future release", PkgResourcesDeprecationWarning, ) > return packaging.version.LegacyVersion(v) pkg_resources/__init__.py:128: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , version = '1.17.1-unknown' def __init__(self, version: str) -> None: self._version = str(version) self._key = _legacy_cmpkey(self._version) > warnings.warn( "Creating a LegacyVersion has been deprecated and will be " "removed in the next major release", DeprecationWarning, ) E DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release pkg_resources/_vendor/packaging/version.py:111: DeprecationWarning During handling of the above exception, another exception occurred: self = , mock_index = monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7ffb4fce00d0> def test_setup_requires_honors_pip_env(self, mock_index, monkeypatch): monkeypatch.setenv(str('PIP_RETRIES'), str('0')) monkeypatch.setenv(str('PIP_TIMEOUT'), str('0')) monkeypatch.setenv('PIP_NO_INDEX', 'false') monkeypatch.setenv(str('PIP_INDEX_URL'), mock_index.url) with contexts.save_pkg_resources_state(): with contexts.tempdir() as temp_dir: test_pkg = create_setup_requires_package( temp_dir, 'python-xlib', '0.19', setup_attrs=dict(dependency_links=[])) test_setup_cfg = os.path.join(test_pkg, 'setup.cfg') with open(test_setup_cfg, 'w') as fp: fp.write(DALS( ''' [easy_install] index_url = https://pypi.org/legacy/ ''')) test_setup_py = os.path.join(test_pkg, 'setup.py') with pytest.raises(distutils.errors.DistutilsError): > run_setup(test_setup_py, [str('--version')]) setuptools/tests/test_easy_install.py:713: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setuptools/sandbox.py:262: in run_setup raise /usr/lib64/python3.8/contextlib.py:131: in __exit__ self.gen.throw(type, value, traceback) setuptools/sandbox.py:198: in setup_context yield /usr/lib64/python3.8/contextlib.py:131: in __exit__ self.gen.throw(type, value, traceback) setuptools/sandbox.py:169: in save_modules saved_exc.resume() setuptools/sandbox.py:143: in resume raise exc.with_traceback(self._tb) setuptools/sandbox.py:156: in save_modules yield saved setuptools/sandbox.py:198: in setup_context yield setuptools/sandbox.py:259: in run_setup _execfile(setup_script, ns) setuptools/sandbox.py:46: in _execfile exec(code, globals, locals) /tmp/tmpack3kv9d/test_pkg/setup.py:2: in ??? setuptools/__init__.py:86: in setup _install_setup_requires(attrs) setuptools/__init__.py:80: in _install_setup_requires dist.fetch_build_eggs(dist.setup_requires) setuptools/dist.py:876: in fetch_build_eggs resolved_dists = pkg_resources.working_set.resolve( pkg_resources/__init__.py:782: in resolve env = Environment(self.entries) pkg_resources/__init__.py:994: in __init__ self.scan(search_path) pkg_resources/__init__.py:1027: in scan self.add(dist) pkg_resources/__init__.py:1047: in add dists.sort(key=operator.attrgetter('hashcmp'), reverse=True) pkg_resources/__init__.py:2620: in hashcmp self.parsed_version, pkg_resources/__init__.py:2667: in parsed_version self._parsed_version = parse_version(self.version) pkg_resources/__init__.py:128: in parse_version return packaging.version.LegacyVersion(v) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , version = '1.17.1-unknown' def __init__(self, version: str) -> None: self._version = str(version) self._key = _legacy_cmpkey(self._version) > warnings.warn( "Creating a LegacyVersion has been deprecated and will be " "removed in the next major release", DeprecationWarning, ) E DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release pkg_resources/_vendor/packaging/version.py:111: DeprecationWarning ___________________________________________________ TestSetupRequires.test_setup_requires_with_pep508_url ____________________________________________________ v = '1.17.1-unknown' def parse_version(v): try: > return packaging.version.Version(v) pkg_resources/__init__.py:121: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'Version' object has no attribute '_version'") raised in repr()] Version object at 0x7ffb4f729100>, version = '1.17.1-unknown' def __init__(self, version: str) -> None: # Validate the version and parse it into pieces match = self._regex.search(version) if not match: > raise InvalidVersion(f"Invalid version: '{version}'") E pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: '1.17.1-unknown' pkg_resources/_vendor/packaging/version.py:266: InvalidVersion During handling of the above exception, another exception occurred: @contextlib.contextmanager def save_modules(): """ Context in which imported modules are saved. Translates exceptions internal to the context into the equivalent exception outside the context. """ saved = sys.modules.copy() with ExceptionSaver() as saved_exc: > yield saved setuptools/sandbox.py:156: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setup_dir = '/tmp/tmplz389liu/test_pkg' @contextlib.contextmanager def setup_context(setup_dir): temp_dir = os.path.join(setup_dir, 'temp') with save_pkg_resources_state(): with save_modules(): with save_path(): hide_setuptools() with save_argv(): with override_temp(temp_dir): with pushd(setup_dir): # ensure setuptools commands are available __import__('setuptools') > yield setuptools/sandbox.py:198: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setup_script = '/tmp/tmplz389liu/test_pkg/setup.py', args = ['--version'] def run_setup(setup_script, args): """Run a distutils setup script, sandboxed in its directory""" setup_dir = os.path.abspath(os.path.dirname(setup_script)) with setup_context(setup_dir): try: sys.argv[:] = [setup_script] + list(args) sys.path.insert(0, setup_dir) # reset to include setup dir, w/clean callback list working_set.__init__() working_set.callbacks.append(lambda dist: dist.activate()) with DirectorySandbox(setup_dir): ns = dict(__file__=setup_script, __name__='__main__') > _execfile(setup_script, ns) setuptools/sandbox.py:259: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ filename = '/tmp/tmplz389liu/test_pkg/setup.py' globals = {'__builtins__': {'ArithmeticError': , 'AssertionError': , 'Attribute...__', 'setuptools': } locals = {'__builtins__': {'ArithmeticError': , 'AssertionError': , 'Attribute...__', 'setuptools': } def _execfile(filename, globals, locals=None): """ Python 3 implementation of execfile. """ mode = 'rb' with open(filename, mode) as stream: script = stream.read() if locals is None: locals = globals code = compile(script, filename, 'exec') > exec(code, globals, locals) setuptools/sandbox.py:46: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > ??? /tmp/tmplz389liu/test_pkg/setup.py:2: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ attrs = {'dependency_links': ['/tmp/tmplz389liu'], 'name': 'test_pkg', 'setup_requires': 'dependency @ file://localhost/tmp/tmplz389liu/dep.tar.gz', 'version': '0.0'} def setup(**attrs): # Make sure we have any requirements needed to interpret 'attrs'. logging.configure() > _install_setup_requires(attrs) setuptools/__init__.py:86: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ attrs = {'dependency_links': ['/tmp/tmplz389liu'], 'name': 'test_pkg', 'setup_requires': 'dependency @ file://localhost/tmp/tmplz389liu/dep.tar.gz', 'version': '0.0'} def _install_setup_requires(attrs): # Note: do not use `setuptools.Distribution` directly, as # our PEP 517 backend patch `distutils.core.Distribution`. class MinimalDistribution(distutils.core.Distribution): """ A minimal version of a distribution for supporting the fetch_build_eggs interface. """ def __init__(self, attrs): _incl = 'dependency_links', 'setup_requires' filtered = {k: attrs[k] for k in set(_incl) & set(attrs)} super().__init__(filtered) # Prevent accidentally triggering discovery with incomplete set of attrs self.set_defaults._disable() def _get_project_config_files(self, filenames=None): """Ignore ``pyproject.toml``, they are not related to setup_requires""" try: cfg, toml = super()._split_standard_project_metadata(filenames) return cfg, () except Exception: return filenames, () def finalize_options(self): """ Disable finalize_options to avoid building the working set. Ref #2158. """ dist = MinimalDistribution(attrs) # Honor setup.cfg's options. dist.parse_config_files(ignore_option_errors=True) if dist.setup_requires: > dist.fetch_build_eggs(dist.setup_requires) setuptools/__init__.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .MinimalDistribution object at 0x7ffb4f9034f0> requires = 'dependency @ file://localhost/tmp/tmplz389liu/dep.tar.gz' def fetch_build_eggs(self, requires): """Resolve pre-setup requirements""" > resolved_dists = pkg_resources.working_set.resolve( _reqs.parse(requires), installer=self.fetch_build_egg, replace_conflicting=True, ) setuptools/dist.py:876: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , requirements = [], env = None installer = .MinimalDistribution object at 0x7ffb4f9034f0>> replace_conflicting = True, extras = None def resolve(self, requirements, env=None, installer=None, # noqa: C901 replace_conflicting=False, extras=None): """List all distributions needed to (recursively) meet `requirements` `requirements` must be a sequence of ``Requirement`` objects. `env`, if supplied, should be an ``Environment`` instance. If not supplied, it defaults to all distributions available within any entry or distribution in the working set. `installer`, if supplied, will be invoked with each requirement that cannot be met by an already-installed distribution; it should return a ``Distribution`` or ``None``. Unless `replace_conflicting=True`, raises a VersionConflict exception if any requirements are found on the path that have the correct name but the wrong version. Otherwise, if an `installer` is supplied it will be invoked to obtain the correct version of the requirement and activate it. `extras` is a list of the extras to be used with these requirements. This is important because extra requirements may look like `my_req; extra = "my_extra"`, which would otherwise be interpreted as a purely optional requirement. Instead, we want to be able to assert that these requirements are truly required. """ # set up the stack requirements = list(requirements)[::-1] # set of processed requirements processed = {} # key -> dist best = {} to_activate = [] req_extras = _ReqExtras() # Mapping of requirement to set of distributions that required it; # useful for reporting info about conflicts. required_by = collections.defaultdict(set) while requirements: # process dependencies breadth-first req = requirements.pop(0) if req in processed: # Ignore cyclic or redundant dependencies continue if not req_extras.markers_pass(req, extras): continue dist = best.get(req.key) if dist is None: # Find the best distribution and add it to the map dist = self.by_key.get(req.key) if dist is None or (dist not in req and replace_conflicting): ws = self if env is None: if dist is None: > env = Environment(self.entries) pkg_resources/__init__.py:782: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = search_path = ['does-not-matter', '/home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4', '/usr/bin', '/home/tkloczko/rpmbuild/BUILDROOT/...uild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages', '/usr/lib64/python38.zip', ...] platform = 'linux-x86_64', python = '3.8' def __init__( self, search_path=None, platform=get_supported_platform(), python=PY_MAJOR): """Snapshot distributions available on a search path Any distributions found on `search_path` are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. `platform` is an optional string specifying the name of the platform that platform-specific distributions must be compatible with. If unspecified, it defaults to the current platform. `python` is an optional string naming the desired version of Python (e.g. ``'3.6'``); it defaults to the current version. You may explicitly set `platform` (and/or `python`) to ``None`` if you wish to map *all* distributions, not just those compatible with the running platform or Python version. """ self._distmap = {} self.platform = platform self.python = python > self.scan(search_path) pkg_resources/__init__.py:994: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = search_path = ['does-not-matter', '/home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4', '/usr/bin', '/home/tkloczko/rpmbuild/BUILDROOT/...uild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages', '/usr/lib64/python38.zip', ...] def scan(self, search_path=None): """Scan `search_path` for distributions usable in this environment Any distributions found are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. Only distributions conforming to the platform/python version defined at initialization are added. """ if search_path is None: search_path = sys.path for item in search_path: for dist in find_distributions(item): > self.add(dist) pkg_resources/__init__.py:1027: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , dist = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) def add(self, dist): """Add `dist` if we ``can_add()`` it and it has not already been added """ if self.can_add(dist) and dist.has_version(): dists = self._distmap.setdefault(dist.key, []) if dist not in dists: dists.append(dist) > dists.sort(key=operator.attrgetter('hashcmp'), reverse=True) pkg_resources/__init__.py:1047: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) @property def hashcmp(self): return ( > self.parsed_version, self.precedence, self.key, self.location, self.py_version or '', self.platform or '', ) pkg_resources/__init__.py:2620: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) @property def parsed_version(self): if not hasattr(self, "_parsed_version"): > self._parsed_version = parse_version(self.version) pkg_resources/__init__.py:2667: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ v = '1.17.1-unknown' def parse_version(v): try: return packaging.version.Version(v) except packaging.version.InvalidVersion: warnings.warn( f"{v} is an invalid version and will not be supported in " "a future release", PkgResourcesDeprecationWarning, ) > return packaging.version.LegacyVersion(v) pkg_resources/__init__.py:128: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , version = '1.17.1-unknown' def __init__(self, version: str) -> None: self._version = str(version) self._key = _legacy_cmpkey(self._version) > warnings.warn( "Creating a LegacyVersion has been deprecated and will be " "removed in the next major release", DeprecationWarning, ) E DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release pkg_resources/_vendor/packaging/version.py:111: DeprecationWarning During handling of the above exception, another exception occurred: self = , mock_index = monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7ffb4fa9d5b0> def test_setup_requires_with_pep508_url(self, mock_index, monkeypatch): monkeypatch.setenv(str('PIP_RETRIES'), str('0')) monkeypatch.setenv(str('PIP_TIMEOUT'), str('0')) monkeypatch.setenv(str('PIP_INDEX_URL'), mock_index.url) with contexts.save_pkg_resources_state(): with contexts.tempdir() as temp_dir: dep_sdist = os.path.join(temp_dir, 'dep.tar.gz') make_trivial_sdist(dep_sdist, 'dependency', '42') dep_url = path_to_url(dep_sdist, authority='localhost') test_pkg = create_setup_requires_package( temp_dir, # Ignored (overridden by setup_attrs) 'python-xlib', '0.19', setup_attrs=dict( setup_requires='dependency @ %s' % dep_url)) test_setup_py = os.path.join(test_pkg, 'setup.py') > run_setup(test_setup_py, [str('--version')]) setuptools/tests/test_easy_install.py:733: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setuptools/sandbox.py:262: in run_setup raise /usr/lib64/python3.8/contextlib.py:131: in __exit__ self.gen.throw(type, value, traceback) setuptools/sandbox.py:198: in setup_context yield /usr/lib64/python3.8/contextlib.py:131: in __exit__ self.gen.throw(type, value, traceback) setuptools/sandbox.py:169: in save_modules saved_exc.resume() setuptools/sandbox.py:143: in resume raise exc.with_traceback(self._tb) setuptools/sandbox.py:156: in save_modules yield saved setuptools/sandbox.py:198: in setup_context yield setuptools/sandbox.py:259: in run_setup _execfile(setup_script, ns) setuptools/sandbox.py:46: in _execfile exec(code, globals, locals) /tmp/tmplz389liu/test_pkg/setup.py:2: in ??? setuptools/__init__.py:86: in setup _install_setup_requires(attrs) setuptools/__init__.py:80: in _install_setup_requires dist.fetch_build_eggs(dist.setup_requires) setuptools/dist.py:876: in fetch_build_eggs resolved_dists = pkg_resources.working_set.resolve( pkg_resources/__init__.py:782: in resolve env = Environment(self.entries) pkg_resources/__init__.py:994: in __init__ self.scan(search_path) pkg_resources/__init__.py:1027: in scan self.add(dist) pkg_resources/__init__.py:1047: in add dists.sort(key=operator.attrgetter('hashcmp'), reverse=True) pkg_resources/__init__.py:2620: in hashcmp self.parsed_version, pkg_resources/__init__.py:2667: in parsed_version self._parsed_version = parse_version(self.version) pkg_resources/__init__.py:128: in parse_version return packaging.version.LegacyVersion(v) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , version = '1.17.1-unknown' def __init__(self, version: str) -> None: self._version = str(version) self._key = _legacy_cmpkey(self._version) > warnings.warn( "Creating a LegacyVersion has been deprecated and will be " "removed in the next major release", DeprecationWarning, ) E DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release pkg_resources/_vendor/packaging/version.py:111: DeprecationWarning ___________________________________________________ TestSetupRequires.test_setup_requires_with_allow_hosts ___________________________________________________ v = '1.17.1-unknown' def parse_version(v): try: > return packaging.version.Version(v) pkg_resources/__init__.py:121: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'Version' object has no attribute '_version'") raised in repr()] Version object at 0x7ffb4e82de20>, version = '1.17.1-unknown' def __init__(self, version: str) -> None: # Validate the version and parse it into pieces match = self._regex.search(version) if not match: > raise InvalidVersion(f"Invalid version: '{version}'") E pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: '1.17.1-unknown' pkg_resources/_vendor/packaging/version.py:266: InvalidVersion During handling of the above exception, another exception occurred: @contextlib.contextmanager def save_modules(): """ Context in which imported modules are saved. Translates exceptions internal to the context into the equivalent exception outside the context. """ saved = sys.modules.copy() with ExceptionSaver() as saved_exc: > yield saved setuptools/sandbox.py:156: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setup_dir = '/tmp/tmpoizaxasj/test_pkg' @contextlib.contextmanager def setup_context(setup_dir): temp_dir = os.path.join(setup_dir, 'temp') with save_pkg_resources_state(): with save_modules(): with save_path(): hide_setuptools() with save_argv(): with override_temp(temp_dir): with pushd(setup_dir): # ensure setuptools commands are available __import__('setuptools') > yield setuptools/sandbox.py:198: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setup_script = '/tmp/tmpoizaxasj/test_pkg/setup.py', args = ['--version'] def run_setup(setup_script, args): """Run a distutils setup script, sandboxed in its directory""" setup_dir = os.path.abspath(os.path.dirname(setup_script)) with setup_context(setup_dir): try: sys.argv[:] = [setup_script] + list(args) sys.path.insert(0, setup_dir) # reset to include setup dir, w/clean callback list working_set.__init__() working_set.callbacks.append(lambda dist: dist.activate()) with DirectorySandbox(setup_dir): ns = dict(__file__=setup_script, __name__='__main__') > _execfile(setup_script, ns) setuptools/sandbox.py:259: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ filename = '/tmp/tmpoizaxasj/test_pkg/setup.py' globals = {'__builtins__': {'ArithmeticError': , 'AssertionError': , 'Attribute... '__file__': '/tmp/tmpoizaxasj/test_pkg/setup.py', '__name__': '__main__', 'setup': } locals = {'__builtins__': {'ArithmeticError': , 'AssertionError': , 'Attribute... '__file__': '/tmp/tmpoizaxasj/test_pkg/setup.py', '__name__': '__main__', 'setup': } def _execfile(filename, globals, locals=None): """ Python 3 implementation of execfile. """ mode = 'rb' with open(filename, mode) as stream: script = stream.read() if locals is None: locals = globals code = compile(script, filename, 'exec') > exec(code, globals, locals) setuptools/sandbox.py:46: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > ??? /tmp/tmpoizaxasj/test_pkg/setup.py:2: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ attrs = {'setup_requires': 'python-xlib'} def setup(**attrs): # Make sure we have any requirements needed to interpret 'attrs'. logging.configure() > _install_setup_requires(attrs) setuptools/__init__.py:86: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ attrs = {'setup_requires': 'python-xlib'} def _install_setup_requires(attrs): # Note: do not use `setuptools.Distribution` directly, as # our PEP 517 backend patch `distutils.core.Distribution`. class MinimalDistribution(distutils.core.Distribution): """ A minimal version of a distribution for supporting the fetch_build_eggs interface. """ def __init__(self, attrs): _incl = 'dependency_links', 'setup_requires' filtered = {k: attrs[k] for k in set(_incl) & set(attrs)} super().__init__(filtered) # Prevent accidentally triggering discovery with incomplete set of attrs self.set_defaults._disable() def _get_project_config_files(self, filenames=None): """Ignore ``pyproject.toml``, they are not related to setup_requires""" try: cfg, toml = super()._split_standard_project_metadata(filenames) return cfg, () except Exception: return filenames, () def finalize_options(self): """ Disable finalize_options to avoid building the working set. Ref #2158. """ dist = MinimalDistribution(attrs) # Honor setup.cfg's options. dist.parse_config_files(ignore_option_errors=True) if dist.setup_requires: > dist.fetch_build_eggs(dist.setup_requires) setuptools/__init__.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .MinimalDistribution object at 0x7ffb4f4c8880>, requires = 'python-xlib' def fetch_build_eggs(self, requires): """Resolve pre-setup requirements""" > resolved_dists = pkg_resources.working_set.resolve( _reqs.parse(requires), installer=self.fetch_build_egg, replace_conflicting=True, ) setuptools/dist.py:876: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , requirements = [], env = None installer = .MinimalDistribution object at 0x7ffb4f4c8880>> replace_conflicting = True, extras = None def resolve(self, requirements, env=None, installer=None, # noqa: C901 replace_conflicting=False, extras=None): """List all distributions needed to (recursively) meet `requirements` `requirements` must be a sequence of ``Requirement`` objects. `env`, if supplied, should be an ``Environment`` instance. If not supplied, it defaults to all distributions available within any entry or distribution in the working set. `installer`, if supplied, will be invoked with each requirement that cannot be met by an already-installed distribution; it should return a ``Distribution`` or ``None``. Unless `replace_conflicting=True`, raises a VersionConflict exception if any requirements are found on the path that have the correct name but the wrong version. Otherwise, if an `installer` is supplied it will be invoked to obtain the correct version of the requirement and activate it. `extras` is a list of the extras to be used with these requirements. This is important because extra requirements may look like `my_req; extra = "my_extra"`, which would otherwise be interpreted as a purely optional requirement. Instead, we want to be able to assert that these requirements are truly required. """ # set up the stack requirements = list(requirements)[::-1] # set of processed requirements processed = {} # key -> dist best = {} to_activate = [] req_extras = _ReqExtras() # Mapping of requirement to set of distributions that required it; # useful for reporting info about conflicts. required_by = collections.defaultdict(set) while requirements: # process dependencies breadth-first req = requirements.pop(0) if req in processed: # Ignore cyclic or redundant dependencies continue if not req_extras.markers_pass(req, extras): continue dist = best.get(req.key) if dist is None: # Find the best distribution and add it to the map dist = self.by_key.get(req.key) if dist is None or (dist not in req and replace_conflicting): ws = self if env is None: if dist is None: > env = Environment(self.entries) pkg_resources/__init__.py:782: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = search_path = ['does-not-matter', '/home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4', '/usr/bin', '/home/tkloczko/rpmbuild/BUILDROOT/...uild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages', '/usr/lib64/python38.zip', ...] platform = 'linux-x86_64', python = '3.8' def __init__( self, search_path=None, platform=get_supported_platform(), python=PY_MAJOR): """Snapshot distributions available on a search path Any distributions found on `search_path` are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. `platform` is an optional string specifying the name of the platform that platform-specific distributions must be compatible with. If unspecified, it defaults to the current platform. `python` is an optional string naming the desired version of Python (e.g. ``'3.6'``); it defaults to the current version. You may explicitly set `platform` (and/or `python`) to ``None`` if you wish to map *all* distributions, not just those compatible with the running platform or Python version. """ self._distmap = {} self.platform = platform self.python = python > self.scan(search_path) pkg_resources/__init__.py:994: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = search_path = ['does-not-matter', '/home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4', '/usr/bin', '/home/tkloczko/rpmbuild/BUILDROOT/...uild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages', '/usr/lib64/python38.zip', ...] def scan(self, search_path=None): """Scan `search_path` for distributions usable in this environment Any distributions found are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. Only distributions conforming to the platform/python version defined at initialization are added. """ if search_path is None: search_path = sys.path for item in search_path: for dist in find_distributions(item): > self.add(dist) pkg_resources/__init__.py:1027: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , dist = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) def add(self, dist): """Add `dist` if we ``can_add()`` it and it has not already been added """ if self.can_add(dist) and dist.has_version(): dists = self._distmap.setdefault(dist.key, []) if dist not in dists: dists.append(dist) > dists.sort(key=operator.attrgetter('hashcmp'), reverse=True) pkg_resources/__init__.py:1047: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) @property def hashcmp(self): return ( > self.parsed_version, self.precedence, self.key, self.location, self.py_version or '', self.platform or '', ) pkg_resources/__init__.py:2620: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) @property def parsed_version(self): if not hasattr(self, "_parsed_version"): > self._parsed_version = parse_version(self.version) pkg_resources/__init__.py:2667: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ v = '1.17.1-unknown' def parse_version(v): try: return packaging.version.Version(v) except packaging.version.InvalidVersion: warnings.warn( f"{v} is an invalid version and will not be supported in " "a future release", PkgResourcesDeprecationWarning, ) > return packaging.version.LegacyVersion(v) pkg_resources/__init__.py:128: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , version = '1.17.1-unknown' def __init__(self, version: str) -> None: self._version = str(version) self._key = _legacy_cmpkey(self._version) > warnings.warn( "Creating a LegacyVersion has been deprecated and will be " "removed in the next major release", DeprecationWarning, ) E DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release pkg_resources/_vendor/packaging/version.py:111: DeprecationWarning During handling of the above exception, another exception occurred: self = , mock_index = def test_setup_requires_with_allow_hosts(self, mock_index): ''' The `allow-hosts` option in not supported anymore. ''' files = { 'test_pkg': { 'setup.py': DALS(''' from setuptools import setup setup(setup_requires='python-xlib') '''), 'setup.cfg': DALS(''' [easy_install] allow_hosts = * '''), } } with contexts.save_pkg_resources_state(): with contexts.tempdir() as temp_dir: path.build(files, prefix=temp_dir) setup_py = str(pathlib.Path(temp_dir, 'test_pkg', 'setup.py')) with pytest.raises(distutils.errors.DistutilsError): > run_setup(setup_py, [str('--version')]) setuptools/tests/test_easy_install.py:755: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setuptools/sandbox.py:262: in run_setup raise /usr/lib64/python3.8/contextlib.py:131: in __exit__ self.gen.throw(type, value, traceback) setuptools/sandbox.py:198: in setup_context yield /usr/lib64/python3.8/contextlib.py:131: in __exit__ self.gen.throw(type, value, traceback) setuptools/sandbox.py:169: in save_modules saved_exc.resume() setuptools/sandbox.py:143: in resume raise exc.with_traceback(self._tb) setuptools/sandbox.py:156: in save_modules yield saved setuptools/sandbox.py:198: in setup_context yield setuptools/sandbox.py:259: in run_setup _execfile(setup_script, ns) setuptools/sandbox.py:46: in _execfile exec(code, globals, locals) /tmp/tmpoizaxasj/test_pkg/setup.py:2: in ??? setuptools/__init__.py:86: in setup _install_setup_requires(attrs) setuptools/__init__.py:80: in _install_setup_requires dist.fetch_build_eggs(dist.setup_requires) setuptools/dist.py:876: in fetch_build_eggs resolved_dists = pkg_resources.working_set.resolve( pkg_resources/__init__.py:782: in resolve env = Environment(self.entries) pkg_resources/__init__.py:994: in __init__ self.scan(search_path) pkg_resources/__init__.py:1027: in scan self.add(dist) pkg_resources/__init__.py:1047: in add dists.sort(key=operator.attrgetter('hashcmp'), reverse=True) pkg_resources/__init__.py:2620: in hashcmp self.parsed_version, pkg_resources/__init__.py:2667: in parsed_version self._parsed_version = parse_version(self.version) pkg_resources/__init__.py:128: in parse_version return packaging.version.LegacyVersion(v) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , version = '1.17.1-unknown' def __init__(self, version: str) -> None: self._version = str(version) self._key = _legacy_cmpkey(self._version) > warnings.warn( "Creating a LegacyVersion has been deprecated and will be " "removed in the next major release", DeprecationWarning, ) E DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release pkg_resources/_vendor/packaging/version.py:111: DeprecationWarning _________________________________________________ TestSetupRequires.test_setup_requires_with_python_requires _________________________________________________ v = '1.17.1-unknown' def parse_version(v): try: > return packaging.version.Version(v) pkg_resources/__init__.py:121: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'Version' object has no attribute '_version'") raised in repr()] Version object at 0x7ffb4da8f1f0>, version = '1.17.1-unknown' def __init__(self, version: str) -> None: # Validate the version and parse it into pieces match = self._regex.search(version) if not match: > raise InvalidVersion(f"Invalid version: '{version}'") E pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: '1.17.1-unknown' pkg_resources/_vendor/packaging/version.py:266: InvalidVersion During handling of the above exception, another exception occurred: @contextlib.contextmanager def save_modules(): """ Context in which imported modules are saved. Translates exceptions internal to the context into the equivalent exception outside the context. """ saved = sys.modules.copy() with ExceptionSaver() as saved_exc: > yield saved setuptools/sandbox.py:156: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setup_dir = '/tmp/pytest-of-tkloczko/pytest-40/test_setup_requires_with_pytho0/test_pkg' @contextlib.contextmanager def setup_context(setup_dir): temp_dir = os.path.join(setup_dir, 'temp') with save_pkg_resources_state(): with save_modules(): with save_path(): hide_setuptools() with save_argv(): with override_temp(temp_dir): with pushd(setup_dir): # ensure setuptools commands are available __import__('setuptools') > yield setuptools/sandbox.py:198: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setup_script = '/tmp/pytest-of-tkloczko/pytest-40/test_setup_requires_with_pytho0/test_pkg/setup.py', args = ['--version'] def run_setup(setup_script, args): """Run a distutils setup script, sandboxed in its directory""" setup_dir = os.path.abspath(os.path.dirname(setup_script)) with setup_context(setup_dir): try: sys.argv[:] = [setup_script] + list(args) sys.path.insert(0, setup_dir) # reset to include setup dir, w/clean callback list working_set.__init__() working_set.callbacks.append(lambda dist: dist.activate()) with DirectorySandbox(setup_dir): ns = dict(__file__=setup_script, __name__='__main__') > _execfile(setup_script, ns) setuptools/sandbox.py:259: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ filename = '/tmp/pytest-of-tkloczko/pytest-40/test_setup_requires_with_pytho0/test_pkg/setup.py' globals = {'__builtins__': {'ArithmeticError': , 'AssertionError': , 'Attribute...__', 'setuptools': } locals = {'__builtins__': {'ArithmeticError': , 'AssertionError': , 'Attribute...__', 'setuptools': } def _execfile(filename, globals, locals=None): """ Python 3 implementation of execfile. """ mode = 'rb' with open(filename, mode) as stream: script = stream.read() if locals is None: locals = globals code = compile(script, filename, 'exec') > exec(code, globals, locals) setuptools/sandbox.py:46: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ import setuptools > setuptools.setup(**{'name': 'test_pkg', 'version': '0.0', 'setup_requires': 'dep', 'dependency_links': ['file:///tmp/pytest-of-tkloczko/pytest-40/test_setup_requires_with_pytho0/index.html']}) /tmp/pytest-of-tkloczko/pytest-40/test_setup_requires_with_pytho0/test_pkg/setup.py:2: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ attrs = {'dependency_links': ['file:///tmp/pytest-of-tkloczko/pytest-40/test_setup_requires_with_pytho0/index.html'], 'name': 'test_pkg', 'setup_requires': 'dep', 'version': '0.0'} def setup(**attrs): # Make sure we have any requirements needed to interpret 'attrs'. logging.configure() > _install_setup_requires(attrs) setuptools/__init__.py:86: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ attrs = {'dependency_links': ['file:///tmp/pytest-of-tkloczko/pytest-40/test_setup_requires_with_pytho0/index.html'], 'name': 'test_pkg', 'setup_requires': 'dep', 'version': '0.0'} def _install_setup_requires(attrs): # Note: do not use `setuptools.Distribution` directly, as # our PEP 517 backend patch `distutils.core.Distribution`. class MinimalDistribution(distutils.core.Distribution): """ A minimal version of a distribution for supporting the fetch_build_eggs interface. """ def __init__(self, attrs): _incl = 'dependency_links', 'setup_requires' filtered = {k: attrs[k] for k in set(_incl) & set(attrs)} super().__init__(filtered) # Prevent accidentally triggering discovery with incomplete set of attrs self.set_defaults._disable() def _get_project_config_files(self, filenames=None): """Ignore ``pyproject.toml``, they are not related to setup_requires""" try: cfg, toml = super()._split_standard_project_metadata(filenames) return cfg, () except Exception: return filenames, () def finalize_options(self): """ Disable finalize_options to avoid building the working set. Ref #2158. """ dist = MinimalDistribution(attrs) # Honor setup.cfg's options. dist.parse_config_files(ignore_option_errors=True) if dist.setup_requires: > dist.fetch_build_eggs(dist.setup_requires) setuptools/__init__.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .MinimalDistribution object at 0x7ffb4daa2100>, requires = 'dep' def fetch_build_eggs(self, requires): """Resolve pre-setup requirements""" > resolved_dists = pkg_resources.working_set.resolve( _reqs.parse(requires), installer=self.fetch_build_egg, replace_conflicting=True, ) setuptools/dist.py:876: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , requirements = [], env = None installer = .MinimalDistribution object at 0x7ffb4daa2100>> replace_conflicting = True, extras = None def resolve(self, requirements, env=None, installer=None, # noqa: C901 replace_conflicting=False, extras=None): """List all distributions needed to (recursively) meet `requirements` `requirements` must be a sequence of ``Requirement`` objects. `env`, if supplied, should be an ``Environment`` instance. If not supplied, it defaults to all distributions available within any entry or distribution in the working set. `installer`, if supplied, will be invoked with each requirement that cannot be met by an already-installed distribution; it should return a ``Distribution`` or ``None``. Unless `replace_conflicting=True`, raises a VersionConflict exception if any requirements are found on the path that have the correct name but the wrong version. Otherwise, if an `installer` is supplied it will be invoked to obtain the correct version of the requirement and activate it. `extras` is a list of the extras to be used with these requirements. This is important because extra requirements may look like `my_req; extra = "my_extra"`, which would otherwise be interpreted as a purely optional requirement. Instead, we want to be able to assert that these requirements are truly required. """ # set up the stack requirements = list(requirements)[::-1] # set of processed requirements processed = {} # key -> dist best = {} to_activate = [] req_extras = _ReqExtras() # Mapping of requirement to set of distributions that required it; # useful for reporting info about conflicts. required_by = collections.defaultdict(set) while requirements: # process dependencies breadth-first req = requirements.pop(0) if req in processed: # Ignore cyclic or redundant dependencies continue if not req_extras.markers_pass(req, extras): continue dist = best.get(req.key) if dist is None: # Find the best distribution and add it to the map dist = self.by_key.get(req.key) if dist is None or (dist not in req and replace_conflicting): ws = self if env is None: if dist is None: > env = Environment(self.entries) pkg_resources/__init__.py:782: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = search_path = ['does-not-matter', '/home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4', '/usr/bin', '/home/tkloczko/rpmbuild/BUILDROOT/...uild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages', '/usr/lib64/python38.zip', ...] platform = 'linux-x86_64', python = '3.8' def __init__( self, search_path=None, platform=get_supported_platform(), python=PY_MAJOR): """Snapshot distributions available on a search path Any distributions found on `search_path` are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. `platform` is an optional string specifying the name of the platform that platform-specific distributions must be compatible with. If unspecified, it defaults to the current platform. `python` is an optional string naming the desired version of Python (e.g. ``'3.6'``); it defaults to the current version. You may explicitly set `platform` (and/or `python`) to ``None`` if you wish to map *all* distributions, not just those compatible with the running platform or Python version. """ self._distmap = {} self.platform = platform self.python = python > self.scan(search_path) pkg_resources/__init__.py:994: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = search_path = ['does-not-matter', '/home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4', '/usr/bin', '/home/tkloczko/rpmbuild/BUILDROOT/...uild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages', '/usr/lib64/python38.zip', ...] def scan(self, search_path=None): """Scan `search_path` for distributions usable in this environment Any distributions found are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. Only distributions conforming to the platform/python version defined at initialization are added. """ if search_path is None: search_path = sys.path for item in search_path: for dist in find_distributions(item): > self.add(dist) pkg_resources/__init__.py:1027: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , dist = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) def add(self, dist): """Add `dist` if we ``can_add()`` it and it has not already been added """ if self.can_add(dist) and dist.has_version(): dists = self._distmap.setdefault(dist.key, []) if dist not in dists: dists.append(dist) > dists.sort(key=operator.attrgetter('hashcmp'), reverse=True) pkg_resources/__init__.py:1047: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) @property def hashcmp(self): return ( > self.parsed_version, self.precedence, self.key, self.location, self.py_version or '', self.platform or '', ) pkg_resources/__init__.py:2620: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) @property def parsed_version(self): if not hasattr(self, "_parsed_version"): > self._parsed_version = parse_version(self.version) pkg_resources/__init__.py:2667: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ v = '1.17.1-unknown' def parse_version(v): try: return packaging.version.Version(v) except packaging.version.InvalidVersion: warnings.warn( f"{v} is an invalid version and will not be supported in " "a future release", PkgResourcesDeprecationWarning, ) > return packaging.version.LegacyVersion(v) pkg_resources/__init__.py:128: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , version = '1.17.1-unknown' def __init__(self, version: str) -> None: self._version = str(version) self._key = _legacy_cmpkey(self._version) > warnings.warn( "Creating a LegacyVersion has been deprecated and will be " "removed in the next major release", DeprecationWarning, ) E DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release pkg_resources/_vendor/packaging/version.py:111: DeprecationWarning During handling of the above exception, another exception occurred: self = monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7ffb4e6ef430>, tmpdir = local('/tmp/pytest-of-tkloczko/pytest-40/test_setup_requires_with_pytho0') def test_setup_requires_with_python_requires(self, monkeypatch, tmpdir): ''' Check `python_requires` is honored. ''' monkeypatch.setenv(str('PIP_RETRIES'), str('0')) monkeypatch.setenv(str('PIP_TIMEOUT'), str('0')) monkeypatch.setenv(str('PIP_NO_INDEX'), str('1')) monkeypatch.setenv(str('PIP_VERBOSE'), str('1')) dep_1_0_sdist = 'dep-1.0.tar.gz' dep_1_0_url = path_to_url(str(tmpdir / dep_1_0_sdist)) dep_1_0_python_requires = '>=2.7' make_python_requires_sdist( str(tmpdir / dep_1_0_sdist), 'dep', '1.0', dep_1_0_python_requires) dep_2_0_sdist = 'dep-2.0.tar.gz' dep_2_0_url = path_to_url(str(tmpdir / dep_2_0_sdist)) dep_2_0_python_requires = '!=' + '.'.join( map(str, sys.version_info[:2])) + '.*' make_python_requires_sdist( str(tmpdir / dep_2_0_sdist), 'dep', '2.0', dep_2_0_python_requires) index = tmpdir / 'index.html' index.write_text(DALS( ''' Links for dep

Links for dep

{dep_1_0_sdist}
{dep_2_0_sdist}
''').format( # noqa dep_1_0_url=dep_1_0_url, dep_1_0_sdist=dep_1_0_sdist, dep_1_0_python_requires=dep_1_0_python_requires, dep_2_0_url=dep_2_0_url, dep_2_0_sdist=dep_2_0_sdist, dep_2_0_python_requires=dep_2_0_python_requires, ), 'utf-8') index_url = path_to_url(str(index)) with contexts.save_pkg_resources_state(): test_pkg = create_setup_requires_package( str(tmpdir), 'python-xlib', '0.19', # Ignored (overridden by setup_attrs). setup_attrs=dict( setup_requires='dep', dependency_links=[index_url])) test_setup_py = os.path.join(test_pkg, 'setup.py') > run_setup(test_setup_py, [str('--version')]) setuptools/tests/test_easy_install.py:802: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setuptools/sandbox.py:262: in run_setup raise /usr/lib64/python3.8/contextlib.py:131: in __exit__ self.gen.throw(type, value, traceback) setuptools/sandbox.py:198: in setup_context yield /usr/lib64/python3.8/contextlib.py:131: in __exit__ self.gen.throw(type, value, traceback) setuptools/sandbox.py:169: in save_modules saved_exc.resume() setuptools/sandbox.py:143: in resume raise exc.with_traceback(self._tb) setuptools/sandbox.py:156: in save_modules yield saved setuptools/sandbox.py:198: in setup_context yield setuptools/sandbox.py:259: in run_setup _execfile(setup_script, ns) setuptools/sandbox.py:46: in _execfile exec(code, globals, locals) /tmp/pytest-of-tkloczko/pytest-40/test_setup_requires_with_pytho0/test_pkg/setup.py:2: in setuptools.setup(**{'name': 'test_pkg', 'version': '0.0', 'setup_requires': 'dep', 'dependency_links': ['file:///tmp/pytest-of-tkloczko/pytest-40/test_setup_requires_with_pytho0/index.html']}) setuptools/__init__.py:86: in setup _install_setup_requires(attrs) setuptools/__init__.py:80: in _install_setup_requires dist.fetch_build_eggs(dist.setup_requires) setuptools/dist.py:876: in fetch_build_eggs resolved_dists = pkg_resources.working_set.resolve( pkg_resources/__init__.py:782: in resolve env = Environment(self.entries) pkg_resources/__init__.py:994: in __init__ self.scan(search_path) pkg_resources/__init__.py:1027: in scan self.add(dist) pkg_resources/__init__.py:1047: in add dists.sort(key=operator.attrgetter('hashcmp'), reverse=True) pkg_resources/__init__.py:2620: in hashcmp self.parsed_version, pkg_resources/__init__.py:2667: in parsed_version self._parsed_version = parse_version(self.version) pkg_resources/__init__.py:128: in parse_version return packaging.version.LegacyVersion(v) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , version = '1.17.1-unknown' def __init__(self, version: str) -> None: self._version = str(version) self._key = _legacy_cmpkey(self._version) > warnings.warn( "Creating a LegacyVersion has been deprecated and will be " "removed in the next major release", DeprecationWarning, ) E DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release pkg_resources/_vendor/packaging/version.py:111: DeprecationWarning _________________________________________ TestSetupRequires.test_setup_requires_with_find_links_in_setup_cfg[False] __________________________________________ v = '1.17.1-unknown' def parse_version(v): try: > return packaging.version.Version(v) pkg_resources/__init__.py:121: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'Version' object has no attribute '_version'") raised in repr()] Version object at 0x7ffb4d3a6d60>, version = '1.17.1-unknown' def __init__(self, version: str) -> None: # Validate the version and parse it into pieces match = self._regex.search(version) if not match: > raise InvalidVersion(f"Invalid version: '{version}'") E pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: '1.17.1-unknown' pkg_resources/_vendor/packaging/version.py:266: InvalidVersion During handling of the above exception, another exception occurred: @contextlib.contextmanager def save_modules(): """ Context in which imported modules are saved. Translates exceptions internal to the context into the equivalent exception outside the context. """ saved = sys.modules.copy() with ExceptionSaver() as saved_exc: > yield saved setuptools/sandbox.py:156: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setup_dir = '/tmp/tmplg0xzuqn/test_pkg' @contextlib.contextmanager def setup_context(setup_dir): temp_dir = os.path.join(setup_dir, 'temp') with save_pkg_resources_state(): with save_modules(): with save_path(): hide_setuptools() with save_argv(): with override_temp(temp_dir): with pushd(setup_dir): # ensure setuptools commands are available __import__('setuptools') > yield setuptools/sandbox.py:198: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setup_script = '/tmp/tmplg0xzuqn/test_pkg/setup.py', args = ['--version'] def run_setup(setup_script, args): """Run a distutils setup script, sandboxed in its directory""" setup_dir = os.path.abspath(os.path.dirname(setup_script)) with setup_context(setup_dir): try: sys.argv[:] = [setup_script] + list(args) sys.path.insert(0, setup_dir) # reset to include setup dir, w/clean callback list working_set.__init__() working_set.callbacks.append(lambda dist: dist.activate()) with DirectorySandbox(setup_dir): ns = dict(__file__=setup_script, __name__='__main__') > _execfile(setup_script, ns) setuptools/sandbox.py:259: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ filename = '/tmp/tmplg0xzuqn/test_pkg/setup.py' globals = {'__builtins__': {'ArithmeticError': , 'AssertionError': , 'Attribute...': , ...} locals = {'__builtins__': {'ArithmeticError': , 'AssertionError': , 'Attribute...': , ...} def _execfile(filename, globals, locals=None): """ Python 3 implementation of execfile. """ mode = 'rb' with open(filename, mode) as stream: script = stream.read() if locals is None: locals = globals code = compile(script, filename, 'exec') > exec(code, globals, locals) setuptools/sandbox.py:46: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > ??? /tmp/tmplg0xzuqn/test_pkg/setup.py:2: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ attrs = {'dependency_links': [], 'setup_requires': 'python-xlib==42'} def setup(**attrs): # Make sure we have any requirements needed to interpret 'attrs'. logging.configure() > _install_setup_requires(attrs) setuptools/__init__.py:86: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ attrs = {'dependency_links': [], 'setup_requires': 'python-xlib==42'} def _install_setup_requires(attrs): # Note: do not use `setuptools.Distribution` directly, as # our PEP 517 backend patch `distutils.core.Distribution`. class MinimalDistribution(distutils.core.Distribution): """ A minimal version of a distribution for supporting the fetch_build_eggs interface. """ def __init__(self, attrs): _incl = 'dependency_links', 'setup_requires' filtered = {k: attrs[k] for k in set(_incl) & set(attrs)} super().__init__(filtered) # Prevent accidentally triggering discovery with incomplete set of attrs self.set_defaults._disable() def _get_project_config_files(self, filenames=None): """Ignore ``pyproject.toml``, they are not related to setup_requires""" try: cfg, toml = super()._split_standard_project_metadata(filenames) return cfg, () except Exception: return filenames, () def finalize_options(self): """ Disable finalize_options to avoid building the working set. Ref #2158. """ dist = MinimalDistribution(attrs) # Honor setup.cfg's options. dist.parse_config_files(ignore_option_errors=True) if dist.setup_requires: > dist.fetch_build_eggs(dist.setup_requires) setuptools/__init__.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .MinimalDistribution object at 0x7ffb4d862f70>, requires = 'python-xlib==42' def fetch_build_eggs(self, requires): """Resolve pre-setup requirements""" > resolved_dists = pkg_resources.working_set.resolve( _reqs.parse(requires), installer=self.fetch_build_egg, replace_conflicting=True, ) setuptools/dist.py:876: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , requirements = [], env = None installer = .MinimalDistribution object at 0x7ffb4d862f70>> replace_conflicting = True, extras = None def resolve(self, requirements, env=None, installer=None, # noqa: C901 replace_conflicting=False, extras=None): """List all distributions needed to (recursively) meet `requirements` `requirements` must be a sequence of ``Requirement`` objects. `env`, if supplied, should be an ``Environment`` instance. If not supplied, it defaults to all distributions available within any entry or distribution in the working set. `installer`, if supplied, will be invoked with each requirement that cannot be met by an already-installed distribution; it should return a ``Distribution`` or ``None``. Unless `replace_conflicting=True`, raises a VersionConflict exception if any requirements are found on the path that have the correct name but the wrong version. Otherwise, if an `installer` is supplied it will be invoked to obtain the correct version of the requirement and activate it. `extras` is a list of the extras to be used with these requirements. This is important because extra requirements may look like `my_req; extra = "my_extra"`, which would otherwise be interpreted as a purely optional requirement. Instead, we want to be able to assert that these requirements are truly required. """ # set up the stack requirements = list(requirements)[::-1] # set of processed requirements processed = {} # key -> dist best = {} to_activate = [] req_extras = _ReqExtras() # Mapping of requirement to set of distributions that required it; # useful for reporting info about conflicts. required_by = collections.defaultdict(set) while requirements: # process dependencies breadth-first req = requirements.pop(0) if req in processed: # Ignore cyclic or redundant dependencies continue if not req_extras.markers_pass(req, extras): continue dist = best.get(req.key) if dist is None: # Find the best distribution and add it to the map dist = self.by_key.get(req.key) if dist is None or (dist not in req and replace_conflicting): ws = self if env is None: if dist is None: > env = Environment(self.entries) pkg_resources/__init__.py:782: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = search_path = ['does-not-matter', '/home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4', '/usr/bin', '/home/tkloczko/rpmbuild/BUILDROOT/...uild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages', '/usr/lib64/python38.zip', ...] platform = 'linux-x86_64', python = '3.8' def __init__( self, search_path=None, platform=get_supported_platform(), python=PY_MAJOR): """Snapshot distributions available on a search path Any distributions found on `search_path` are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. `platform` is an optional string specifying the name of the platform that platform-specific distributions must be compatible with. If unspecified, it defaults to the current platform. `python` is an optional string naming the desired version of Python (e.g. ``'3.6'``); it defaults to the current version. You may explicitly set `platform` (and/or `python`) to ``None`` if you wish to map *all* distributions, not just those compatible with the running platform or Python version. """ self._distmap = {} self.platform = platform self.python = python > self.scan(search_path) pkg_resources/__init__.py:994: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = search_path = ['does-not-matter', '/home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4', '/usr/bin', '/home/tkloczko/rpmbuild/BUILDROOT/...uild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages', '/usr/lib64/python38.zip', ...] def scan(self, search_path=None): """Scan `search_path` for distributions usable in this environment Any distributions found are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. Only distributions conforming to the platform/python version defined at initialization are added. """ if search_path is None: search_path = sys.path for item in search_path: for dist in find_distributions(item): > self.add(dist) pkg_resources/__init__.py:1027: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , dist = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) def add(self, dist): """Add `dist` if we ``can_add()`` it and it has not already been added """ if self.can_add(dist) and dist.has_version(): dists = self._distmap.setdefault(dist.key, []) if dist not in dists: dists.append(dist) > dists.sort(key=operator.attrgetter('hashcmp'), reverse=True) pkg_resources/__init__.py:1047: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) @property def hashcmp(self): return ( > self.parsed_version, self.precedence, self.key, self.location, self.py_version or '', self.platform or '', ) pkg_resources/__init__.py:2620: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) @property def parsed_version(self): if not hasattr(self, "_parsed_version"): > self._parsed_version = parse_version(self.version) pkg_resources/__init__.py:2667: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ v = '1.17.1-unknown' def parse_version(v): try: return packaging.version.Version(v) except packaging.version.InvalidVersion: warnings.warn( f"{v} is an invalid version and will not be supported in " "a future release", PkgResourcesDeprecationWarning, ) > return packaging.version.LegacyVersion(v) pkg_resources/__init__.py:128: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , version = '1.17.1-unknown' def __init__(self, version: str) -> None: self._version = str(version) self._key = _legacy_cmpkey(self._version) > warnings.warn( "Creating a LegacyVersion has been deprecated and will be " "removed in the next major release", DeprecationWarning, ) E DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release pkg_resources/_vendor/packaging/version.py:111: DeprecationWarning During handling of the above exception, another exception occurred: self = monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7ffb4d862a60>, with_dependency_links_in_setup_py = False @pytest.mark.parametrize( 'with_dependency_links_in_setup_py', (False, True)) def test_setup_requires_with_find_links_in_setup_cfg( self, monkeypatch, with_dependency_links_in_setup_py): monkeypatch.setenv(str('PIP_RETRIES'), str('0')) monkeypatch.setenv(str('PIP_TIMEOUT'), str('0')) with contexts.save_pkg_resources_state(): with contexts.tempdir() as temp_dir: make_trivial_sdist( os.path.join(temp_dir, 'python-xlib-42.tar.gz'), 'python-xlib', '42') test_pkg = os.path.join(temp_dir, 'test_pkg') test_setup_py = os.path.join(test_pkg, 'setup.py') test_setup_cfg = os.path.join(test_pkg, 'setup.cfg') os.mkdir(test_pkg) with open(test_setup_py, 'w') as fp: if with_dependency_links_in_setup_py: dependency_links = [os.path.join(temp_dir, 'links')] else: dependency_links = [] fp.write(DALS( ''' from setuptools import installer, setup setup(setup_requires='python-xlib==42', dependency_links={dependency_links!r}) ''').format( dependency_links=dependency_links)) with open(test_setup_cfg, 'w') as fp: fp.write(DALS( ''' [easy_install] index_url = {index_url} find_links = {find_links} ''').format(index_url=os.path.join(temp_dir, 'index'), find_links=temp_dir)) > run_setup(test_setup_py, [str('--version')]) setuptools/tests/test_easy_install.py:845: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setuptools/sandbox.py:262: in run_setup raise /usr/lib64/python3.8/contextlib.py:131: in __exit__ self.gen.throw(type, value, traceback) setuptools/sandbox.py:198: in setup_context yield /usr/lib64/python3.8/contextlib.py:131: in __exit__ self.gen.throw(type, value, traceback) setuptools/sandbox.py:169: in save_modules saved_exc.resume() setuptools/sandbox.py:143: in resume raise exc.with_traceback(self._tb) setuptools/sandbox.py:156: in save_modules yield saved setuptools/sandbox.py:198: in setup_context yield setuptools/sandbox.py:259: in run_setup _execfile(setup_script, ns) setuptools/sandbox.py:46: in _execfile exec(code, globals, locals) /tmp/tmplg0xzuqn/test_pkg/setup.py:2: in ??? setuptools/__init__.py:86: in setup _install_setup_requires(attrs) setuptools/__init__.py:80: in _install_setup_requires dist.fetch_build_eggs(dist.setup_requires) setuptools/dist.py:876: in fetch_build_eggs resolved_dists = pkg_resources.working_set.resolve( pkg_resources/__init__.py:782: in resolve env = Environment(self.entries) pkg_resources/__init__.py:994: in __init__ self.scan(search_path) pkg_resources/__init__.py:1027: in scan self.add(dist) pkg_resources/__init__.py:1047: in add dists.sort(key=operator.attrgetter('hashcmp'), reverse=True) pkg_resources/__init__.py:2620: in hashcmp self.parsed_version, pkg_resources/__init__.py:2667: in parsed_version self._parsed_version = parse_version(self.version) pkg_resources/__init__.py:128: in parse_version return packaging.version.LegacyVersion(v) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , version = '1.17.1-unknown' def __init__(self, version: str) -> None: self._version = str(version) self._key = _legacy_cmpkey(self._version) > warnings.warn( "Creating a LegacyVersion has been deprecated and will be " "removed in the next major release", DeprecationWarning, ) E DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release pkg_resources/_vendor/packaging/version.py:111: DeprecationWarning __________________________________________ TestSetupRequires.test_setup_requires_with_find_links_in_setup_cfg[True] __________________________________________ v = '1.17.1-unknown' def parse_version(v): try: > return packaging.version.Version(v) pkg_resources/__init__.py:121: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'Version' object has no attribute '_version'") raised in repr()] Version object at 0x7ffb4ccd9370>, version = '1.17.1-unknown' def __init__(self, version: str) -> None: # Validate the version and parse it into pieces match = self._regex.search(version) if not match: > raise InvalidVersion(f"Invalid version: '{version}'") E pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: '1.17.1-unknown' pkg_resources/_vendor/packaging/version.py:266: InvalidVersion During handling of the above exception, another exception occurred: @contextlib.contextmanager def save_modules(): """ Context in which imported modules are saved. Translates exceptions internal to the context into the equivalent exception outside the context. """ saved = sys.modules.copy() with ExceptionSaver() as saved_exc: > yield saved setuptools/sandbox.py:156: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setup_dir = '/tmp/tmprtisnbz5/test_pkg' @contextlib.contextmanager def setup_context(setup_dir): temp_dir = os.path.join(setup_dir, 'temp') with save_pkg_resources_state(): with save_modules(): with save_path(): hide_setuptools() with save_argv(): with override_temp(temp_dir): with pushd(setup_dir): # ensure setuptools commands are available __import__('setuptools') > yield setuptools/sandbox.py:198: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setup_script = '/tmp/tmprtisnbz5/test_pkg/setup.py', args = ['--version'] def run_setup(setup_script, args): """Run a distutils setup script, sandboxed in its directory""" setup_dir = os.path.abspath(os.path.dirname(setup_script)) with setup_context(setup_dir): try: sys.argv[:] = [setup_script] + list(args) sys.path.insert(0, setup_dir) # reset to include setup dir, w/clean callback list working_set.__init__() working_set.callbacks.append(lambda dist: dist.activate()) with DirectorySandbox(setup_dir): ns = dict(__file__=setup_script, __name__='__main__') > _execfile(setup_script, ns) setuptools/sandbox.py:259: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ filename = '/tmp/tmprtisnbz5/test_pkg/setup.py' globals = {'__builtins__': {'ArithmeticError': , 'AssertionError': , 'Attribute...': , ...} locals = {'__builtins__': {'ArithmeticError': , 'AssertionError': , 'Attribute...': , ...} def _execfile(filename, globals, locals=None): """ Python 3 implementation of execfile. """ mode = 'rb' with open(filename, mode) as stream: script = stream.read() if locals is None: locals = globals code = compile(script, filename, 'exec') > exec(code, globals, locals) setuptools/sandbox.py:46: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > ??? /tmp/tmprtisnbz5/test_pkg/setup.py:2: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ attrs = {'dependency_links': ['/tmp/tmprtisnbz5/links'], 'setup_requires': 'python-xlib==42'} def setup(**attrs): # Make sure we have any requirements needed to interpret 'attrs'. logging.configure() > _install_setup_requires(attrs) setuptools/__init__.py:86: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ attrs = {'dependency_links': ['/tmp/tmprtisnbz5/links'], 'setup_requires': 'python-xlib==42'} def _install_setup_requires(attrs): # Note: do not use `setuptools.Distribution` directly, as # our PEP 517 backend patch `distutils.core.Distribution`. class MinimalDistribution(distutils.core.Distribution): """ A minimal version of a distribution for supporting the fetch_build_eggs interface. """ def __init__(self, attrs): _incl = 'dependency_links', 'setup_requires' filtered = {k: attrs[k] for k in set(_incl) & set(attrs)} super().__init__(filtered) # Prevent accidentally triggering discovery with incomplete set of attrs self.set_defaults._disable() def _get_project_config_files(self, filenames=None): """Ignore ``pyproject.toml``, they are not related to setup_requires""" try: cfg, toml = super()._split_standard_project_metadata(filenames) return cfg, () except Exception: return filenames, () def finalize_options(self): """ Disable finalize_options to avoid building the working set. Ref #2158. """ dist = MinimalDistribution(attrs) # Honor setup.cfg's options. dist.parse_config_files(ignore_option_errors=True) if dist.setup_requires: > dist.fetch_build_eggs(dist.setup_requires) setuptools/__init__.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .MinimalDistribution object at 0x7ffb4cce6250>, requires = 'python-xlib==42' def fetch_build_eggs(self, requires): """Resolve pre-setup requirements""" > resolved_dists = pkg_resources.working_set.resolve( _reqs.parse(requires), installer=self.fetch_build_egg, replace_conflicting=True, ) setuptools/dist.py:876: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , requirements = [], env = None installer = .MinimalDistribution object at 0x7ffb4cce6250>> replace_conflicting = True, extras = None def resolve(self, requirements, env=None, installer=None, # noqa: C901 replace_conflicting=False, extras=None): """List all distributions needed to (recursively) meet `requirements` `requirements` must be a sequence of ``Requirement`` objects. `env`, if supplied, should be an ``Environment`` instance. If not supplied, it defaults to all distributions available within any entry or distribution in the working set. `installer`, if supplied, will be invoked with each requirement that cannot be met by an already-installed distribution; it should return a ``Distribution`` or ``None``. Unless `replace_conflicting=True`, raises a VersionConflict exception if any requirements are found on the path that have the correct name but the wrong version. Otherwise, if an `installer` is supplied it will be invoked to obtain the correct version of the requirement and activate it. `extras` is a list of the extras to be used with these requirements. This is important because extra requirements may look like `my_req; extra = "my_extra"`, which would otherwise be interpreted as a purely optional requirement. Instead, we want to be able to assert that these requirements are truly required. """ # set up the stack requirements = list(requirements)[::-1] # set of processed requirements processed = {} # key -> dist best = {} to_activate = [] req_extras = _ReqExtras() # Mapping of requirement to set of distributions that required it; # useful for reporting info about conflicts. required_by = collections.defaultdict(set) while requirements: # process dependencies breadth-first req = requirements.pop(0) if req in processed: # Ignore cyclic or redundant dependencies continue if not req_extras.markers_pass(req, extras): continue dist = best.get(req.key) if dist is None: # Find the best distribution and add it to the map dist = self.by_key.get(req.key) if dist is None or (dist not in req and replace_conflicting): ws = self if env is None: if dist is None: > env = Environment(self.entries) pkg_resources/__init__.py:782: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = search_path = ['does-not-matter', '/home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4', '/usr/bin', '/home/tkloczko/rpmbuild/BUILDROOT/...uild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages', '/usr/lib64/python38.zip', ...] platform = 'linux-x86_64', python = '3.8' def __init__( self, search_path=None, platform=get_supported_platform(), python=PY_MAJOR): """Snapshot distributions available on a search path Any distributions found on `search_path` are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. `platform` is an optional string specifying the name of the platform that platform-specific distributions must be compatible with. If unspecified, it defaults to the current platform. `python` is an optional string naming the desired version of Python (e.g. ``'3.6'``); it defaults to the current version. You may explicitly set `platform` (and/or `python`) to ``None`` if you wish to map *all* distributions, not just those compatible with the running platform or Python version. """ self._distmap = {} self.platform = platform self.python = python > self.scan(search_path) pkg_resources/__init__.py:994: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = search_path = ['does-not-matter', '/home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4', '/usr/bin', '/home/tkloczko/rpmbuild/BUILDROOT/...uild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages', '/usr/lib64/python38.zip', ...] def scan(self, search_path=None): """Scan `search_path` for distributions usable in this environment Any distributions found are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. Only distributions conforming to the platform/python version defined at initialization are added. """ if search_path is None: search_path = sys.path for item in search_path: for dist in find_distributions(item): > self.add(dist) pkg_resources/__init__.py:1027: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , dist = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) def add(self, dist): """Add `dist` if we ``can_add()`` it and it has not already been added """ if self.can_add(dist) and dist.has_version(): dists = self._distmap.setdefault(dist.key, []) if dist not in dists: dists.append(dist) > dists.sort(key=operator.attrgetter('hashcmp'), reverse=True) pkg_resources/__init__.py:1047: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) @property def hashcmp(self): return ( > self.parsed_version, self.precedence, self.key, self.location, self.py_version or '', self.platform or '', ) pkg_resources/__init__.py:2620: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) @property def parsed_version(self): if not hasattr(self, "_parsed_version"): > self._parsed_version = parse_version(self.version) pkg_resources/__init__.py:2667: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ v = '1.17.1-unknown' def parse_version(v): try: return packaging.version.Version(v) except packaging.version.InvalidVersion: warnings.warn( f"{v} is an invalid version and will not be supported in " "a future release", PkgResourcesDeprecationWarning, ) > return packaging.version.LegacyVersion(v) pkg_resources/__init__.py:128: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , version = '1.17.1-unknown' def __init__(self, version: str) -> None: self._version = str(version) self._key = _legacy_cmpkey(self._version) > warnings.warn( "Creating a LegacyVersion has been deprecated and will be " "removed in the next major release", DeprecationWarning, ) E DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release pkg_resources/_vendor/packaging/version.py:111: DeprecationWarning During handling of the above exception, another exception occurred: self = monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7ffb4e81b850>, with_dependency_links_in_setup_py = True @pytest.mark.parametrize( 'with_dependency_links_in_setup_py', (False, True)) def test_setup_requires_with_find_links_in_setup_cfg( self, monkeypatch, with_dependency_links_in_setup_py): monkeypatch.setenv(str('PIP_RETRIES'), str('0')) monkeypatch.setenv(str('PIP_TIMEOUT'), str('0')) with contexts.save_pkg_resources_state(): with contexts.tempdir() as temp_dir: make_trivial_sdist( os.path.join(temp_dir, 'python-xlib-42.tar.gz'), 'python-xlib', '42') test_pkg = os.path.join(temp_dir, 'test_pkg') test_setup_py = os.path.join(test_pkg, 'setup.py') test_setup_cfg = os.path.join(test_pkg, 'setup.cfg') os.mkdir(test_pkg) with open(test_setup_py, 'w') as fp: if with_dependency_links_in_setup_py: dependency_links = [os.path.join(temp_dir, 'links')] else: dependency_links = [] fp.write(DALS( ''' from setuptools import installer, setup setup(setup_requires='python-xlib==42', dependency_links={dependency_links!r}) ''').format( dependency_links=dependency_links)) with open(test_setup_cfg, 'w') as fp: fp.write(DALS( ''' [easy_install] index_url = {index_url} find_links = {find_links} ''').format(index_url=os.path.join(temp_dir, 'index'), find_links=temp_dir)) > run_setup(test_setup_py, [str('--version')]) setuptools/tests/test_easy_install.py:845: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setuptools/sandbox.py:262: in run_setup raise /usr/lib64/python3.8/contextlib.py:131: in __exit__ self.gen.throw(type, value, traceback) setuptools/sandbox.py:198: in setup_context yield /usr/lib64/python3.8/contextlib.py:131: in __exit__ self.gen.throw(type, value, traceback) setuptools/sandbox.py:169: in save_modules saved_exc.resume() setuptools/sandbox.py:143: in resume raise exc.with_traceback(self._tb) setuptools/sandbox.py:156: in save_modules yield saved setuptools/sandbox.py:198: in setup_context yield setuptools/sandbox.py:259: in run_setup _execfile(setup_script, ns) setuptools/sandbox.py:46: in _execfile exec(code, globals, locals) /tmp/tmprtisnbz5/test_pkg/setup.py:2: in ??? setuptools/__init__.py:86: in setup _install_setup_requires(attrs) setuptools/__init__.py:80: in _install_setup_requires dist.fetch_build_eggs(dist.setup_requires) setuptools/dist.py:876: in fetch_build_eggs resolved_dists = pkg_resources.working_set.resolve( pkg_resources/__init__.py:782: in resolve env = Environment(self.entries) pkg_resources/__init__.py:994: in __init__ self.scan(search_path) pkg_resources/__init__.py:1027: in scan self.add(dist) pkg_resources/__init__.py:1047: in add dists.sort(key=operator.attrgetter('hashcmp'), reverse=True) pkg_resources/__init__.py:2620: in hashcmp self.parsed_version, pkg_resources/__init__.py:2667: in parsed_version self._parsed_version = parse_version(self.version) pkg_resources/__init__.py:128: in parse_version return packaging.version.LegacyVersion(v) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , version = '1.17.1-unknown' def __init__(self, version: str) -> None: self._version = str(version) self._key = _legacy_cmpkey(self._version) > warnings.warn( "Creating a LegacyVersion has been deprecated and will be " "removed in the next major release", DeprecationWarning, ) E DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release pkg_resources/_vendor/packaging/version.py:111: DeprecationWarning ___________________________________________ TestSetupRequires.test_setup_requires_with_transitive_extra_dependency ___________________________________________ v = '1.17.1-unknown' def parse_version(v): try: > return packaging.version.Version(v) pkg_resources/__init__.py:121: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'Version' object has no attribute '_version'") raised in repr()] Version object at 0x7ffb4c48d430>, version = '1.17.1-unknown' def __init__(self, version: str) -> None: # Validate the version and parse it into pieces match = self._regex.search(version) if not match: > raise InvalidVersion(f"Invalid version: '{version}'") E pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: '1.17.1-unknown' pkg_resources/_vendor/packaging/version.py:266: InvalidVersion During handling of the above exception, another exception occurred: @contextlib.contextmanager def save_modules(): """ Context in which imported modules are saved. Translates exceptions internal to the context into the equivalent exception outside the context. """ saved = sys.modules.copy() with ExceptionSaver() as saved_exc: > yield saved setuptools/sandbox.py:156: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setup_dir = '/tmp/tmpvlzb7pxb/test_pkg' @contextlib.contextmanager def setup_context(setup_dir): temp_dir = os.path.join(setup_dir, 'temp') with save_pkg_resources_state(): with save_modules(): with save_path(): hide_setuptools() with save_argv(): with override_temp(temp_dir): with pushd(setup_dir): # ensure setuptools commands are available __import__('setuptools') > yield setuptools/sandbox.py:198: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setup_script = '/tmp/tmpvlzb7pxb/test_pkg/setup.py', args = ['--version'] def run_setup(setup_script, args): """Run a distutils setup script, sandboxed in its directory""" setup_dir = os.path.abspath(os.path.dirname(setup_script)) with setup_context(setup_dir): try: sys.argv[:] = [setup_script] + list(args) sys.path.insert(0, setup_dir) # reset to include setup dir, w/clean callback list working_set.__init__() working_set.callbacks.append(lambda dist: dist.activate()) with DirectorySandbox(setup_dir): ns = dict(__file__=setup_script, __name__='__main__') > _execfile(setup_script, ns) setuptools/sandbox.py:259: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ filename = '/tmp/tmpvlzb7pxb/test_pkg/setup.py' globals = {'__builtins__': {'ArithmeticError': , 'AssertionError': , 'Attribute...': , ...} locals = {'__builtins__': {'ArithmeticError': , 'AssertionError': , 'Attribute...': , ...} def _execfile(filename, globals, locals=None): """ Python 3 implementation of execfile. """ mode = 'rb' with open(filename, mode) as stream: script = stream.read() if locals is None: locals = globals code = compile(script, filename, 'exec') > exec(code, globals, locals) setuptools/sandbox.py:46: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > ??? /tmp/tmpvlzb7pxb/test_pkg/setup.py:2: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ attrs = {'setup_requires': 'dep[extra]'} def setup(**attrs): # Make sure we have any requirements needed to interpret 'attrs'. logging.configure() > _install_setup_requires(attrs) setuptools/__init__.py:86: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ attrs = {'setup_requires': 'dep[extra]'} def _install_setup_requires(attrs): # Note: do not use `setuptools.Distribution` directly, as # our PEP 517 backend patch `distutils.core.Distribution`. class MinimalDistribution(distutils.core.Distribution): """ A minimal version of a distribution for supporting the fetch_build_eggs interface. """ def __init__(self, attrs): _incl = 'dependency_links', 'setup_requires' filtered = {k: attrs[k] for k in set(_incl) & set(attrs)} super().__init__(filtered) # Prevent accidentally triggering discovery with incomplete set of attrs self.set_defaults._disable() def _get_project_config_files(self, filenames=None): """Ignore ``pyproject.toml``, they are not related to setup_requires""" try: cfg, toml = super()._split_standard_project_metadata(filenames) return cfg, () except Exception: return filenames, () def finalize_options(self): """ Disable finalize_options to avoid building the working set. Ref #2158. """ dist = MinimalDistribution(attrs) # Honor setup.cfg's options. dist.parse_config_files(ignore_option_errors=True) if dist.setup_requires: > dist.fetch_build_eggs(dist.setup_requires) setuptools/__init__.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .MinimalDistribution object at 0x7ffb4c7662e0>, requires = 'dep[extra]' def fetch_build_eggs(self, requires): """Resolve pre-setup requirements""" > resolved_dists = pkg_resources.working_set.resolve( _reqs.parse(requires), installer=self.fetch_build_egg, replace_conflicting=True, ) setuptools/dist.py:876: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , requirements = [], env = None installer = .MinimalDistribution object at 0x7ffb4c7662e0>> replace_conflicting = True, extras = None def resolve(self, requirements, env=None, installer=None, # noqa: C901 replace_conflicting=False, extras=None): """List all distributions needed to (recursively) meet `requirements` `requirements` must be a sequence of ``Requirement`` objects. `env`, if supplied, should be an ``Environment`` instance. If not supplied, it defaults to all distributions available within any entry or distribution in the working set. `installer`, if supplied, will be invoked with each requirement that cannot be met by an already-installed distribution; it should return a ``Distribution`` or ``None``. Unless `replace_conflicting=True`, raises a VersionConflict exception if any requirements are found on the path that have the correct name but the wrong version. Otherwise, if an `installer` is supplied it will be invoked to obtain the correct version of the requirement and activate it. `extras` is a list of the extras to be used with these requirements. This is important because extra requirements may look like `my_req; extra = "my_extra"`, which would otherwise be interpreted as a purely optional requirement. Instead, we want to be able to assert that these requirements are truly required. """ # set up the stack requirements = list(requirements)[::-1] # set of processed requirements processed = {} # key -> dist best = {} to_activate = [] req_extras = _ReqExtras() # Mapping of requirement to set of distributions that required it; # useful for reporting info about conflicts. required_by = collections.defaultdict(set) while requirements: # process dependencies breadth-first req = requirements.pop(0) if req in processed: # Ignore cyclic or redundant dependencies continue if not req_extras.markers_pass(req, extras): continue dist = best.get(req.key) if dist is None: # Find the best distribution and add it to the map dist = self.by_key.get(req.key) if dist is None or (dist not in req and replace_conflicting): ws = self if env is None: if dist is None: > env = Environment(self.entries) pkg_resources/__init__.py:782: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = search_path = ['/tmp/tmpvlzb7pxb/dep', 'does-not-matter', '/home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4', '/usr/bin', '/home/tklo...ages', '/home/tkloczko/rpmbuild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages', ...] platform = 'linux-x86_64', python = '3.8' def __init__( self, search_path=None, platform=get_supported_platform(), python=PY_MAJOR): """Snapshot distributions available on a search path Any distributions found on `search_path` are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. `platform` is an optional string specifying the name of the platform that platform-specific distributions must be compatible with. If unspecified, it defaults to the current platform. `python` is an optional string naming the desired version of Python (e.g. ``'3.6'``); it defaults to the current version. You may explicitly set `platform` (and/or `python`) to ``None`` if you wish to map *all* distributions, not just those compatible with the running platform or Python version. """ self._distmap = {} self.platform = platform self.python = python > self.scan(search_path) pkg_resources/__init__.py:994: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = search_path = ['/tmp/tmpvlzb7pxb/dep', 'does-not-matter', '/home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4', '/usr/bin', '/home/tklo...ages', '/home/tkloczko/rpmbuild/BUILDROOT/python-setuptools-62.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages', ...] def scan(self, search_path=None): """Scan `search_path` for distributions usable in this environment Any distributions found are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. Only distributions conforming to the platform/python version defined at initialization are added. """ if search_path is None: search_path = sys.path for item in search_path: for dist in find_distributions(item): > self.add(dist) pkg_resources/__init__.py:1027: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , dist = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) def add(self, dist): """Add `dist` if we ``can_add()`` it and it has not already been added """ if self.can_add(dist) and dist.has_version(): dists = self._distmap.setdefault(dist.key, []) if dist not in dists: dists.append(dist) > dists.sort(key=operator.attrgetter('hashcmp'), reverse=True) pkg_resources/__init__.py:1047: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) @property def hashcmp(self): return ( > self.parsed_version, self.precedence, self.key, self.location, self.py_version or '', self.platform or '', ) pkg_resources/__init__.py:2620: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) @property def parsed_version(self): if not hasattr(self, "_parsed_version"): > self._parsed_version = parse_version(self.version) pkg_resources/__init__.py:2667: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ v = '1.17.1-unknown' def parse_version(v): try: return packaging.version.Version(v) except packaging.version.InvalidVersion: warnings.warn( f"{v} is an invalid version and will not be supported in " "a future release", PkgResourcesDeprecationWarning, ) > return packaging.version.LegacyVersion(v) pkg_resources/__init__.py:128: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , version = '1.17.1-unknown' def __init__(self, version: str) -> None: self._version = str(version) self._key = _legacy_cmpkey(self._version) > warnings.warn( "Creating a LegacyVersion has been deprecated and will be " "removed in the next major release", DeprecationWarning, ) E DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release pkg_resources/_vendor/packaging/version.py:111: DeprecationWarning During handling of the above exception, another exception occurred: self = monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7ffb4c68f1f0> def test_setup_requires_with_transitive_extra_dependency( self, monkeypatch): # Use case: installing a package with a build dependency on # an already installed `dep[extra]`, which in turn depends # on `extra_dep` (whose is not already installed). with contexts.save_pkg_resources_state(): with contexts.tempdir() as temp_dir: # Create source distribution for `extra_dep`. make_trivial_sdist( os.path.join(temp_dir, 'extra_dep-1.0.tar.gz'), 'extra_dep', '1.0') # Create source tree for `dep`. dep_pkg = os.path.join(temp_dir, 'dep') os.mkdir(dep_pkg) path.build({ 'setup.py': DALS(""" import setuptools setuptools.setup( name='dep', version='2.0', extras_require={'extra': ['extra_dep']}, ) """), 'setup.cfg': '', }, prefix=dep_pkg) # "Install" dep. run_setup( os.path.join(dep_pkg, 'setup.py'), [str('dist_info')]) working_set.add_entry(dep_pkg) # Create source tree for test package. test_pkg = os.path.join(temp_dir, 'test_pkg') test_setup_py = os.path.join(test_pkg, 'setup.py') os.mkdir(test_pkg) with open(test_setup_py, 'w') as fp: fp.write(DALS( ''' from setuptools import installer, setup setup(setup_requires='dep[extra]') ''')) # Check... monkeypatch.setenv(str('PIP_FIND_LINKS'), str(temp_dir)) monkeypatch.setenv(str('PIP_NO_INDEX'), str('1')) monkeypatch.setenv(str('PIP_RETRIES'), str('0')) monkeypatch.setenv(str('PIP_TIMEOUT'), str('0')) > run_setup(test_setup_py, [str('--version')]) setuptools/tests/test_easy_install.py:891: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setuptools/sandbox.py:262: in run_setup raise /usr/lib64/python3.8/contextlib.py:131: in __exit__ self.gen.throw(type, value, traceback) setuptools/sandbox.py:198: in setup_context yield /usr/lib64/python3.8/contextlib.py:131: in __exit__ self.gen.throw(type, value, traceback) setuptools/sandbox.py:169: in save_modules saved_exc.resume() setuptools/sandbox.py:143: in resume raise exc.with_traceback(self._tb) setuptools/sandbox.py:156: in save_modules yield saved setuptools/sandbox.py:198: in setup_context yield setuptools/sandbox.py:259: in run_setup _execfile(setup_script, ns) setuptools/sandbox.py:46: in _execfile exec(code, globals, locals) /tmp/tmpvlzb7pxb/test_pkg/setup.py:2: in ??? setuptools/__init__.py:86: in setup _install_setup_requires(attrs) setuptools/__init__.py:80: in _install_setup_requires dist.fetch_build_eggs(dist.setup_requires) setuptools/dist.py:876: in fetch_build_eggs resolved_dists = pkg_resources.working_set.resolve( pkg_resources/__init__.py:782: in resolve env = Environment(self.entries) pkg_resources/__init__.py:994: in __init__ self.scan(search_path) pkg_resources/__init__.py:1027: in scan self.add(dist) pkg_resources/__init__.py:1047: in add dists.sort(key=operator.attrgetter('hashcmp'), reverse=True) pkg_resources/__init__.py:2620: in hashcmp self.parsed_version, pkg_resources/__init__.py:2667: in parsed_version self._parsed_version = parse_version(self.version) pkg_resources/__init__.py:128: in parse_version return packaging.version.LegacyVersion(v) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , version = '1.17.1-unknown' def __init__(self, version: str) -> None: self._version = str(version) self._key = _legacy_cmpkey(self._version) > warnings.warn( "Creating a LegacyVersion has been deprecated and will be " "removed in the next major release", DeprecationWarning, ) E DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release pkg_resources/_vendor/packaging/version.py:111: DeprecationWarning -------------------------------------------------------------------- Captured stdout call -------------------------------------------------------------------- running dist_info creating dep.egg-info writing dep.egg-info/PKG-INFO writing dependency_links to dep.egg-info/dependency_links.txt writing requirements to dep.egg-info/requires.txt writing dep.egg-info/PKG-INFO writing dependency_links to dep.egg-info/dependency_links.txt writing requirements to dep.egg-info/requires.txt writing top-level names to dep.egg-info/top_level.txt writing dep.egg-info/PKG-INFO writing dependency_links to dep.egg-info/dependency_links.txt writing requirements to dep.egg-info/requires.txt writing top-level names to dep.egg-info/top_level.txt writing manifest file 'dep.egg-info/SOURCES.txt' reading manifest file 'dep.egg-info/SOURCES.txt' writing manifest file 'dep.egg-info/SOURCES.txt' creating '/tmp/tmpvlzb7pxb/dep/dep-2.0.dist-info' -------------------------------------------------------------------- Captured stderr call -------------------------------------------------------------------- package init file 'temp/__init__.py' not found (or not a regular file) ___________________________________________________________ test_editable_user_and_build_isolation ___________________________________________________________ v = '1.17.1-unknown' def parse_version(v): try: > return packaging.version.Version(v) /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/pkg_resources/__init__.py:121: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'Version' object has no attribute '_version'") raised in repr()] Version object at 0x7ffb474e23a0>, version = '1.17.1-unknown' def __init__(self, version: str) -> None: # Validate the version and parse it into pieces match = self._regex.search(version) if not match: > raise InvalidVersion(f"Invalid version: '{version}'") E pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: '1.17.1-unknown' /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/pkg_resources/_vendor/packaging/version.py:266: InvalidVersion During handling of the above exception, another exception occurred: @contextlib.contextmanager def save_modules(): """ Context in which imported modules are saved. Translates exceptions internal to the context into the equivalent exception outside the context. """ saved = sys.modules.copy() with ExceptionSaver() as saved_exc: > yield saved /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/setuptools/sandbox.py:156: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setup_dir = '/tmp/pytest-of-tkloczko/pytest-40/test_editable_user_and_build_i0' @contextlib.contextmanager def setup_context(setup_dir): temp_dir = os.path.join(setup_dir, 'temp') with save_pkg_resources_state(): with save_modules(): with save_path(): hide_setuptools() with save_argv(): with override_temp(temp_dir): with pushd(setup_dir): # ensure setuptools commands are available __import__('setuptools') > yield /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/setuptools/sandbox.py:198: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ setup_script = 'setup.py', args = ['develop', '--user'] def run_setup(setup_script, args): """Run a distutils setup script, sandboxed in its directory""" setup_dir = os.path.abspath(os.path.dirname(setup_script)) with setup_context(setup_dir): try: sys.argv[:] = [setup_script] + list(args) sys.path.insert(0, setup_dir) # reset to include setup dir, w/clean callback list working_set.__init__() working_set.callbacks.append(lambda dist: dist.activate()) with DirectorySandbox(setup_dir): ns = dict(__file__=setup_script, __name__='__main__') > _execfile(setup_script, ns) /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/setuptools/sandbox.py:259: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ filename = 'setup.py' globals = {'__builtins__': {'ArithmeticError': , 'AssertionError': , 'Attribute...lass 'AttributeError'>, 'BaseException': , ...}, '__file__': 'setup.py', '__name__': '__main__'} locals = {'__builtins__': {'ArithmeticError': , 'AssertionError': , 'Attribute...lass 'AttributeError'>, 'BaseException': , ...}, '__file__': 'setup.py', '__name__': '__main__'} def _execfile(filename, globals, locals=None): """ Python 3 implementation of execfile. """ mode = 'rb' with open(filename, mode) as stream: script = stream.read() if locals is None: locals = globals code = compile(script, filename, 'exec') > exec(code, globals, locals) /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/setuptools/sandbox.py:46: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > __import__('setuptools').setup(name='aproj', version=42, packages=[]) /tmp/pytest-of-tkloczko/pytest-40/test_editable_user_and_build_i0/setup.py:1: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ attrs = {'name': 'aproj', 'packages': [], 'version': 42} def setup(**attrs): # Make sure we have any requirements needed to interpret 'attrs'. logging.configure() _install_setup_requires(attrs) > return distutils.core.setup(**attrs) /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/setuptools/__init__.py:87: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ attrs = {'name': 'aproj', 'packages': [], 'script_args': ['develop', '--user'], 'script_name': 'setup.py', ...} klass = , dist = , ok = True def setup (**attrs): """The gateway to the Distutils: do everything your setup script needs to do, in a highly flexible and user-driven way. Briefly: create a Distribution instance; find and parse config files; parse the command line; run each Distutils command found there, customized by the options supplied to 'setup()' (as keyword arguments), in config files, and on the command line. The Distribution instance might be an instance of a class supplied via the 'distclass' keyword argument to 'setup'; if no such class is supplied, then the Distribution class (in dist.py) is instantiated. All other arguments to 'setup' (except for 'cmdclass') are used to set attributes of the Distribution instance. The 'cmdclass' argument, if supplied, is a dictionary mapping command names to command classes. Each command encountered on the command line will be turned into a command class, which is in turn instantiated; any class found in 'cmdclass' is used in place of the default, which is (for command 'foo_bar') class 'foo_bar' in module 'distutils.command.foo_bar'. The command class must provide a 'user_options' attribute which is a list of option specifiers for 'distutils.fancy_getopt'. Any command-line options between the current and the next command are used to set attributes of the current command object. When the entire command-line has been successfully parsed, calls the 'run()' method on each command object in turn. This method will be driven entirely by the Distribution object (which each command object has a reference to, thanks to its constructor), and the command-specific options that became attributes of each command object. """ global _setup_stop_after, _setup_distribution # Determine the distribution class -- either caller-supplied or # our Distribution (see below). klass = attrs.get('distclass') if klass: del attrs['distclass'] else: klass = Distribution if 'script_name' not in attrs: attrs['script_name'] = os.path.basename(sys.argv[0]) if 'script_args' not in attrs: attrs['script_args'] = sys.argv[1:] # Create the Distribution instance, using the remaining arguments # (ie. everything except distclass) to initialize it try: _setup_distribution = dist = klass(attrs) except DistutilsSetupError as msg: if 'name' not in attrs: raise SystemExit("error in setup command: %s" % msg) else: raise SystemExit("error in %s setup command: %s" % \ (attrs['name'], msg)) if _setup_stop_after == "init": return dist # Find and parse the config file(s): they will override options from # the setup script, but be overridden by the command line. dist.parse_config_files() if DEBUG: print("options (after parsing config files):") dist.dump_option_dicts() if _setup_stop_after == "config": return dist # Parse the command line and override config files; any # command-line errors are the end user's fault, so turn them into # SystemExit to suppress tracebacks. try: ok = dist.parse_command_line() except DistutilsArgError as msg: raise SystemExit(gen_usage(dist.script_name) + "\nerror: %s" % msg) if DEBUG: print("options (after parsing command line):") dist.dump_option_dicts() if _setup_stop_after == "commandline": return dist # And finally, run all the commands found on the command line. if ok: > return run_commands(dist) /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/setuptools/_distutils/core.py:148: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ dist = def run_commands (dist): """Given a Distribution object run all the commands, raising ``SystemExit`` errors in the case of failure. This function assumes that either ``sys.argv`` or ``dist.script_args`` is already set accordingly. """ try: > dist.run_commands() /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/setuptools/_distutils/core.py:163: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def run_commands(self): """Run each command that was seen on the setup script command line. Uses the list of commands found and cache of command objects created by 'get_command_obj()'. """ for cmd in self.commands: > self.run_command(cmd) /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/setuptools/_distutils/dist.py:967: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , command = 'develop' def run_command(self, command): self.set_defaults() # Postpone defaults until all explicit configuration is considered # (setup() args, config files, command line and plugins) > super().run_command(command) /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/setuptools/dist.py:1229: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , command = 'develop' def run_command(self, command): """Do whatever it takes to run a command (including nothing at all, if the command has already been run). Specifically: if we have already created and run the command named by 'command', return silently without doing anything. If the command named by 'command' doesn't even have a command object yet, create one. Then invoke 'run()' on that command object (or an existing one). """ # Already been here, done that? then return silently. if self.have_run.get(command): return log.info("running %s", command) cmd_obj = self.get_command_obj(command) > cmd_obj.ensure_finalized() /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/setuptools/_distutils/dist.py:985: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def ensure_finalized(self): if not self.finalized: > self.finalize_options() /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/setuptools/_distutils/cmd.py:107: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def finalize_options(self): ei = self.get_finalized_command("egg_info") if ei.broken_egg_info: template = "Please rename %r to %r before using 'develop'" args = ei.egg_info, ei.broken_egg_info raise DistutilsError(template % args) self.args = [ei.egg_name] > easy_install.finalize_options(self) /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/setuptools/command/develop.py:52: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def finalize_options(self): # noqa: C901 # is too complex (25) # FIXME self.version and self._render_version() py_version = sys.version.split()[0] self.config_vars = dict(sysconfig.get_config_vars()) self.config_vars.update({ 'dist_name': self.distribution.get_name(), 'dist_version': self.distribution.get_version(), 'dist_fullname': self.distribution.get_fullname(), 'py_version': py_version, 'py_version_short': f'{sys.version_info.major}.{sys.version_info.minor}', 'py_version_nodot': f'{sys.version_info.major}{sys.version_info.minor}', 'sys_prefix': self.config_vars['prefix'], 'sys_exec_prefix': self.config_vars['exec_prefix'], # Only python 3.2+ has abiflags 'abiflags': getattr(sys, 'abiflags', ''), 'platlibdir': getattr(sys, 'platlibdir', 'lib'), }) with contextlib.suppress(AttributeError): # only for distutils outside stdlib self.config_vars.update({ 'implementation_lower': install._get_implementation().lower(), 'implementation': install._get_implementation(), }) # pypa/distutils#113 Python 3.9 compat self.config_vars.setdefault( 'py_version_nodot_plat', getattr(sys, 'windir', '').replace('.', ''), ) self.config_vars['userbase'] = self.install_userbase self.config_vars['usersite'] = self.install_usersite if self.user and not site.ENABLE_USER_SITE: log.warn("WARNING: The user site-packages directory is disabled.") self._fix_install_dir_for_user_site() self.expand_basedirs() self.expand_dirs() self._expand( 'install_dir', 'script_dir', 'build_directory', 'site_dirs', ) # If a non-default installation directory was specified, default the # script directory to match it. if self.script_dir is None: self.script_dir = self.install_dir if self.no_find_links is None: self.no_find_links = False # Let install_dir get set by install_lib command, which in turn # gets its info from the install command, and takes into account # --prefix and --home and all that other crud. self.set_undefined_options( 'install_lib', ('install_dir', 'install_dir') ) # Likewise, set default script_dir from 'install_scripts.install_dir' self.set_undefined_options( 'install_scripts', ('install_dir', 'script_dir') ) if self.user and self.install_purelib: self.install_dir = self.install_purelib self.script_dir = self.install_scripts # default --record from the install command self.set_undefined_options('install', ('record', 'record')) self.all_site_dirs = get_site_dirs() self.all_site_dirs.extend(self._process_site_dirs(self.site_dirs)) if not self.editable: self.check_site_dir() default_index = os.getenv("__EASYINSTALL_INDEX", "https://pypi.org/simple/") # ^ Private API for testing purposes only self.index_url = self.index_url or default_index self.shadow_path = self.all_site_dirs[:] for path_item in self.install_dir, normalize_path(self.script_dir): if path_item not in self.shadow_path: self.shadow_path.insert(0, path_item) if self.allow_hosts is not None: hosts = [s.strip() for s in self.allow_hosts.split(',')] else: hosts = ['*'] if self.package_index is None: self.package_index = self.create_index( self.index_url, search_path=self.shadow_path, hosts=hosts, ) > self.local_index = Environment(self.shadow_path + sys.path) /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/setuptools/command/easy_install.py:311: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = search_path = ['/tmp/pytest-of-tkloczko/pytest-40/test_editable_user_and_build_i0/.home/.local/bin', '/tmp/pytest-of-tkloczko/pytest...8/site-packages', '/tmp/pytest-of-tkloczko/pytest-40/test_editable_user_and_build_i0/.sys_prefix/lib/site-python', ...] platform = 'linux-x86_64', python = '3.8' def __init__( self, search_path=None, platform=get_supported_platform(), python=PY_MAJOR): """Snapshot distributions available on a search path Any distributions found on `search_path` are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. `platform` is an optional string specifying the name of the platform that platform-specific distributions must be compatible with. If unspecified, it defaults to the current platform. `python` is an optional string naming the desired version of Python (e.g. ``'3.6'``); it defaults to the current version. You may explicitly set `platform` (and/or `python`) to ``None`` if you wish to map *all* distributions, not just those compatible with the running platform or Python version. """ self._distmap = {} self.platform = platform self.python = python > self.scan(search_path) /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/pkg_resources/__init__.py:994: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = search_path = ['/tmp/pytest-of-tkloczko/pytest-40/test_editable_user_and_build_i0/.home/.local/bin', '/tmp/pytest-of-tkloczko/pytest...8/site-packages', '/tmp/pytest-of-tkloczko/pytest-40/test_editable_user_and_build_i0/.sys_prefix/lib/site-python', ...] def scan(self, search_path=None): """Scan `search_path` for distributions usable in this environment Any distributions found are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. Only distributions conforming to the platform/python version defined at initialization are added. """ if search_path is None: search_path = sys.path for item in search_path: for dist in find_distributions(item): > self.add(dist) /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/pkg_resources/__init__.py:1027: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , dist = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) def add(self, dist): """Add `dist` if we ``can_add()`` it and it has not already been added """ if self.can_add(dist) and dist.has_version(): dists = self._distmap.setdefault(dist.key, []) if dist not in dists: dists.append(dist) > dists.sort(key=operator.attrgetter('hashcmp'), reverse=True) /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/pkg_resources/__init__.py:1047: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) @property def hashcmp(self): return ( > self.parsed_version, self.precedence, self.key, self.location, self.py_version or '', self.platform or '', ) /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/pkg_resources/__init__.py:2620: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gpg 1.17.1-unknown (/usr/lib64/python3.8/site-packages) @property def parsed_version(self): if not hasattr(self, "_parsed_version"): > self._parsed_version = parse_version(self.version) /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/pkg_resources/__init__.py:2667: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ v = '1.17.1-unknown' def parse_version(v): try: return packaging.version.Version(v) except packaging.version.InvalidVersion: warnings.warn( f"{v} is an invalid version and will not be supported in " "a future release", PkgResourcesDeprecationWarning, ) > return packaging.version.LegacyVersion(v) /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/pkg_resources/__init__.py:128: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , version = '1.17.1-unknown' def __init__(self, version: str) -> None: self._version = str(version) self._key = _legacy_cmpkey(self._version) > warnings.warn( "Creating a LegacyVersion has been deprecated and will be " "removed in the next major release", DeprecationWarning, ) E DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/pkg_resources/_vendor/packaging/version.py:111: DeprecationWarning During handling of the above exception, another exception occurred: setup_context = local('/tmp/pytest-of-tkloczko/pytest-40/test_editable_user_and_build_i0') monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7ffb47be8c40> tmp_path = PosixPath('/tmp/pytest-of-tkloczko/pytest-40/test_editable_user_and_build_i0') def test_editable_user_and_build_isolation(setup_context, monkeypatch, tmp_path): ''' `setup.py develop` should honor `--user` even under build isolation''' # == Arrange == # Pretend that build isolation was enabled # e.g pip sets the environment varible PYTHONNOUSERSITE=1 monkeypatch.setattr('site.ENABLE_USER_SITE', False) # Patching $HOME for 2 reasons: # 1. setuptools/command/easy_install.py:create_home_path # tries creating directories in $HOME # given `self.config_vars['DESTDIRS'] = "/home/user/.pyenv/versions/3.9.10 /home/user/.pyenv/versions/3.9.10/lib /home/user/.pyenv/versions/3.9.10/lib/python3.9 /home/user/.pyenv/versions/3.9.10/lib/python3.9/lib-dynload"`` # noqa: E501 # it will `makedirs("/home/user/.pyenv/versions/3.9.10 /home/user/.pyenv/versions/3.9.10/lib /home/user/.pyenv/versions/3.9.10/lib/python3.9 /home/user/.pyenv/versions/3.9.10/lib/python3.9/lib-dynload")`` # noqa: E501 # 2. We are going to force `site` to update site.USER_BASE and site.USER_SITE # To point inside our new home monkeypatch.setenv('HOME', str(tmp_path / '.home')) monkeypatch.setenv('USERPROFILE', str(tmp_path / '.home')) monkeypatch.setenv('APPDATA', str(tmp_path / '.home')) monkeypatch.setattr('site.USER_BASE', None) monkeypatch.setattr('site.USER_SITE', None) user_site = Path(site.getusersitepackages()) user_site.mkdir(parents=True, exist_ok=True) sys_prefix = (tmp_path / '.sys_prefix') sys_prefix.mkdir(parents=True, exist_ok=True) monkeypatch.setattr('sys.prefix', str(sys_prefix)) setup_script = ( "__import__('setuptools').setup(name='aproj', version=42, packages=[])\n" ) (tmp_path / "setup.py").write_text(setup_script, encoding="utf-8") # == Sanity check == assert list(sys_prefix.glob("*")) == [] assert list(user_site.glob("*")) == [] # == Act == > run_setup('setup.py', ['develop', '--user']) /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/setuptools/tests/test_easy_install.py:1214: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/setuptools/sandbox.py:262: in run_setup raise /usr/lib64/python3.8/contextlib.py:131: in __exit__ self.gen.throw(type, value, traceback) /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/setuptools/sandbox.py:198: in setup_context yield /usr/lib64/python3.8/contextlib.py:131: in __exit__ self.gen.throw(type, value, traceback) /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/setuptools/sandbox.py:169: in save_modules saved_exc.resume() /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/setuptools/sandbox.py:143: in resume raise exc.with_traceback(self._tb) /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/setuptools/sandbox.py:156: in save_modules yield saved /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/setuptools/sandbox.py:198: in setup_context yield /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/setuptools/sandbox.py:259: in run_setup _execfile(setup_script, ns) /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/setuptools/sandbox.py:46: in _execfile exec(code, globals, locals) /tmp/pytest-of-tkloczko/pytest-40/test_editable_user_and_build_i0/setup.py:1: in __import__('setuptools').setup(name='aproj', version=42, packages=[]) /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/setuptools/__init__.py:87: in setup return distutils.core.setup(**attrs) /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/setuptools/_distutils/core.py:148: in setup return run_commands(dist) /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/setuptools/_distutils/core.py:163: in run_commands dist.run_commands() /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/setuptools/_distutils/dist.py:967: in run_commands self.run_command(cmd) /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/setuptools/dist.py:1229: in run_command super().run_command(command) /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/setuptools/_distutils/dist.py:985: in run_command cmd_obj.ensure_finalized() /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/setuptools/_distutils/cmd.py:107: in ensure_finalized self.finalize_options() /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/setuptools/command/develop.py:52: in finalize_options easy_install.finalize_options(self) /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/setuptools/command/easy_install.py:311: in finalize_options self.local_index = Environment(self.shadow_path + sys.path) /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/pkg_resources/__init__.py:994: in __init__ self.scan(search_path) /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/pkg_resources/__init__.py:1027: in scan self.add(dist) /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/pkg_resources/__init__.py:1047: in add dists.sort(key=operator.attrgetter('hashcmp'), reverse=True) /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/pkg_resources/__init__.py:2620: in hashcmp self.parsed_version, /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/pkg_resources/__init__.py:2667: in parsed_version self._parsed_version = parse_version(self.version) /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/pkg_resources/__init__.py:128: in parse_version return packaging.version.LegacyVersion(v) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , version = '1.17.1-unknown' def __init__(self, version: str) -> None: self._version = str(version) self._key = _legacy_cmpkey(self._version) > warnings.warn( "Creating a LegacyVersion has been deprecated and will be " "removed in the next major release", DeprecationWarning, ) E DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release /home/tkloczko/rpmbuild/BUILD/setuptools-62.3.4/pkg_resources/_vendor/packaging/version.py:111: DeprecationWarning -------------------------------------------------------------------- Captured stdout call -------------------------------------------------------------------- running develop Checking .pth file support in /tmp/pytest-of-tkloczko/pytest-40/test_editable_user_and_build_i0/.home/.local/lib/python3.8/site-packages /usr/bin/python3 -E -c pass TEST PASSED: /tmp/pytest-of-tkloczko/pytest-40/test_editable_user_and_build_i0/.home/.local/lib/python3.8/site-packages appears to support .pth files -------------------------------------------------------------------- Captured stderr call -------------------------------------------------------------------- WARNING: The user site-packages directory is disabled. ================================================================== short test summary info =================================================================== SKIPPED [2] setuptools/tests/test_msvc.py:17: could not import 'distutils.msvc9compiler': No module named 'winreg' SKIPPED [1] setuptools/tests/test_develop.py:66: TODO: needs a fixture to cause 'develop' to be invoked without mutating environment. SKIPPED [1] setuptools/tests/test_install_scripts.py:50: Windows only SKIPPED [1] setuptools/tests/test_install_scripts.py:78: Windows only SKIPPED [5] setuptools/tests/test_integration.py:31: Integration tests cannot run when pbr is installed SKIPPED [1] setuptools/tests/test_msvc14.py:16: These tests are only for win32 SKIPPED [1] setuptools/tests/test_msvc14.py:34: These tests are only for win32 SKIPPED [1] setuptools/tests/test_msvc14.py:52: These tests are only for win32 SKIPPED [1] setuptools/tests/test_msvc14.py:68: These tests are only for win32 SKIPPED [1] setuptools/tests/test_windows_wrappers.py:80: Windows only SKIPPED [1] setuptools/tests/test_windows_wrappers.py:121: Windows only SKIPPED [1] setuptools/tests/test_windows_wrappers.py:180: Windows only SKIPPED [8] conftest.py:51: skipping integration tests XFAIL setuptools/tests/test_bdist_egg.py::Test::test_exclude_source_files Byte code disabled XFAIL setuptools/tests/test_build_py.py::test_excluded_subpackages reason: #3260 XFAIL setuptools/tests/test_dist.py::test_read_metadata[Metadata Version 1.2: Project-Url-attrs5] Issue #1578: project_urls not read XFAIL setuptools/tests/test_dist.py::test_read_metadata[Metadata Version 2.1: Provides Extra-attrs9] provides_extras not read XFAIL setuptools/tests/test_editable_install.py::test_editable_with_pyproject[None] Editable install is currently only supported with `setup.py` XFAIL setuptools/tests/test_egg_info.py::TestEggInfo::test_requires[extras_require_with_marker_in_setup_cfg] XFAIL setuptools/tests/test_virtualenv.py::test_pip_upgrade_from_source[pip<20] pypa/pip#6599 XPASS setuptools/tests/test_archive_util.py::test_unicode_files #710 and #712 XPASS setuptools/tests/test_virtualenv.py::test_pip_upgrade_from_source[https://github.com/pypa/pip/archive/main.zip] #2975 FAILED setuptools/tests/test_bdist_deprecations.py::test_bdist_rpm_warning - TypeError: issubclass() arg 1 must be a class FAILED setuptools/tests/test_develop.py::TestNamespaces::test_editable_prefix - subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'pip', '... FAILED setuptools/tests/test_dist.py::test_dist_fetch_build_egg - DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in t... FAILED setuptools/tests/test_easy_install.py::TestEasyInstallTest::test_no_find_links - DeprecationWarning: Creating a LegacyVersion has been deprecated an... FAILED setuptools/tests/test_easy_install.py::TestEasyInstallTest::test_unicode_filename_in_sdist - DeprecationWarning: Creating a LegacyVersion has been d... FAILED setuptools/tests/test_easy_install.py::TestEasyInstallTest::test_unicode_content_in_sdist - DeprecationWarning: Creating a LegacyVersion has been de... FAILED setuptools/tests/test_easy_install.py::TestEasyInstallTest::test_script_install - DeprecationWarning: Creating a LegacyVersion has been deprecated a... FAILED setuptools/tests/test_easy_install.py::TestUserInstallTest::test_user_install_not_implied_user_site_enabled - DeprecationWarning: Creating a LegacyV... FAILED setuptools/tests/test_easy_install.py::TestUserInstallTest::test_user_install_not_implied_user_site_disabled - DeprecationWarning: Creating a Legacy... FAILED setuptools/tests/test_easy_install.py::TestUserInstallTest::test_local_index - DeprecationWarning: Creating a LegacyVersion has been deprecated and ... FAILED setuptools/tests/test_easy_install.py::TestSetupRequires::test_setup_requires_overrides_version_conflict[use_setup_cfg0] - DeprecationWarning: Creat... FAILED setuptools/tests/test_easy_install.py::TestSetupRequires::test_setup_requires_overrides_version_conflict[use_setup_cfg1] - DeprecationWarning: Creat... FAILED setuptools/tests/test_easy_install.py::TestSetupRequires::test_setup_requires_overrides_version_conflict[use_setup_cfg2] - DeprecationWarning: Creat... FAILED setuptools/tests/test_easy_install.py::TestSetupRequires::test_setup_requires_overrides_version_conflict[use_setup_cfg3] - DeprecationWarning: Creat... FAILED setuptools/tests/test_easy_install.py::TestSetupRequires::test_setup_requires_override_nspkg[use_setup_cfg0] - DeprecationWarning: Creating a Legacy... FAILED setuptools/tests/test_easy_install.py::TestSetupRequires::test_setup_requires_override_nspkg[use_setup_cfg1] - DeprecationWarning: Creating a Legacy... FAILED setuptools/tests/test_easy_install.py::TestSetupRequires::test_setup_requires_override_nspkg[use_setup_cfg2] - DeprecationWarning: Creating a Legacy... FAILED setuptools/tests/test_easy_install.py::TestSetupRequires::test_setup_requires_override_nspkg[use_setup_cfg3] - DeprecationWarning: Creating a Legacy... FAILED setuptools/tests/test_easy_install.py::TestSetupRequires::test_setup_requires_with_attr_version[use_setup_cfg0] - DeprecationWarning: Creating a Leg... FAILED setuptools/tests/test_easy_install.py::TestSetupRequires::test_setup_requires_with_attr_version[use_setup_cfg1] - DeprecationWarning: Creating a Leg... FAILED setuptools/tests/test_easy_install.py::TestSetupRequires::test_setup_requires_with_attr_version[use_setup_cfg2] - DeprecationWarning: Creating a Leg... FAILED setuptools/tests/test_easy_install.py::TestSetupRequires::test_setup_requires_with_attr_version[use_setup_cfg3] - DeprecationWarning: Creating a Leg... FAILED setuptools/tests/test_easy_install.py::TestSetupRequires::test_setup_requires_honors_pip_env - DeprecationWarning: Creating a LegacyVersion has been... FAILED setuptools/tests/test_easy_install.py::TestSetupRequires::test_setup_requires_with_pep508_url - DeprecationWarning: Creating a LegacyVersion has bee... FAILED setuptools/tests/test_easy_install.py::TestSetupRequires::test_setup_requires_with_allow_hosts - DeprecationWarning: Creating a LegacyVersion has be... FAILED setuptools/tests/test_easy_install.py::TestSetupRequires::test_setup_requires_with_python_requires - DeprecationWarning: Creating a LegacyVersion ha... FAILED setuptools/tests/test_easy_install.py::TestSetupRequires::test_setup_requires_with_find_links_in_setup_cfg[False] - DeprecationWarning: Creating a L... FAILED setuptools/tests/test_easy_install.py::TestSetupRequires::test_setup_requires_with_find_links_in_setup_cfg[True] - DeprecationWarning: Creating a Le... FAILED setuptools/tests/test_easy_install.py::TestSetupRequires::test_setup_requires_with_transitive_extra_dependency - DeprecationWarning: Creating a Lega... FAILED setuptools/tests/test_easy_install.py::test_editable_user_and_build_isolation - DeprecationWarning: Creating a LegacyVersion has been deprecated and... ======================================= 30 failed, 813 passed, 25 skipped, 7 xfailed, 2 xpassed in 1216.08s (0:20:16) ========================================