ADAPT-Chase commited on
Commit
9b56d86
·
verified ·
1 Parent(s): 72c63e5

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +31 -0
  2. tool_server/.venv/lib/python3.12/site-packages/_distutils_hack/__pycache__/__init__.cpython-312.pyc +0 -0
  3. tool_server/.venv/lib/python3.12/site-packages/_distutils_hack/__pycache__/override.cpython-312.pyc +0 -0
  4. tool_server/.venv/lib/python3.12/site-packages/pkg_resources/__pycache__/__init__.cpython-312.pyc +3 -0
  5. tool_server/.venv/lib/python3.12/site-packages/pkg_resources/tests/__init__.py +0 -0
  6. tool_server/.venv/lib/python3.12/site-packages/pkg_resources/tests/__pycache__/__init__.cpython-312.pyc +0 -0
  7. tool_server/.venv/lib/python3.12/site-packages/pkg_resources/tests/__pycache__/test_find_distributions.cpython-312.pyc +0 -0
  8. tool_server/.venv/lib/python3.12/site-packages/pkg_resources/tests/__pycache__/test_integration_zope_interface.cpython-312.pyc +0 -0
  9. tool_server/.venv/lib/python3.12/site-packages/pkg_resources/tests/__pycache__/test_markers.cpython-312.pyc +0 -0
  10. tool_server/.venv/lib/python3.12/site-packages/pkg_resources/tests/__pycache__/test_pkg_resources.cpython-312.pyc +0 -0
  11. tool_server/.venv/lib/python3.12/site-packages/pkg_resources/tests/__pycache__/test_resources.cpython-312.pyc +0 -0
  12. tool_server/.venv/lib/python3.12/site-packages/pkg_resources/tests/__pycache__/test_working_set.cpython-312.pyc +0 -0
  13. tool_server/.venv/lib/python3.12/site-packages/pkg_resources/tests/data/my-test-package-source/__pycache__/setup.cpython-312.pyc +0 -0
  14. tool_server/.venv/lib/python3.12/site-packages/pkg_resources/tests/data/my-test-package-source/setup.cfg +0 -0
  15. tool_server/.venv/lib/python3.12/site-packages/pkg_resources/tests/data/my-test-package-source/setup.py +7 -0
  16. tool_server/.venv/lib/python3.12/site-packages/pkg_resources/tests/data/my-test-package-zip/my-test-package.zip +3 -0
  17. tool_server/.venv/lib/python3.12/site-packages/pkg_resources/tests/data/my-test-package_unpacked-egg/my_test_package-1.0-py3.7.egg/EGG-INFO/PKG-INFO +10 -0
  18. tool_server/.venv/lib/python3.12/site-packages/pkg_resources/tests/data/my-test-package_unpacked-egg/my_test_package-1.0-py3.7.egg/EGG-INFO/SOURCES.txt +7 -0
  19. tool_server/.venv/lib/python3.12/site-packages/pkg_resources/tests/data/my-test-package_unpacked-egg/my_test_package-1.0-py3.7.egg/EGG-INFO/dependency_links.txt +1 -0
  20. tool_server/.venv/lib/python3.12/site-packages/pkg_resources/tests/data/my-test-package_unpacked-egg/my_test_package-1.0-py3.7.egg/EGG-INFO/top_level.txt +1 -0
  21. tool_server/.venv/lib/python3.12/site-packages/pkg_resources/tests/data/my-test-package_unpacked-egg/my_test_package-1.0-py3.7.egg/EGG-INFO/zip-safe +1 -0
  22. tool_server/.venv/lib/python3.12/site-packages/pkg_resources/tests/data/my-test-package_zipped-egg/my_test_package-1.0-py3.7.egg +0 -0
  23. tool_server/.venv/lib/python3.12/site-packages/pkg_resources/tests/test_find_distributions.py +56 -0
  24. tool_server/.venv/lib/python3.12/site-packages/pkg_resources/tests/test_integration_zope_interface.py +54 -0
  25. tool_server/.venv/lib/python3.12/site-packages/pkg_resources/tests/test_markers.py +8 -0
  26. tool_server/.venv/lib/python3.12/site-packages/pkg_resources/tests/test_pkg_resources.py +485 -0
  27. tool_server/.venv/lib/python3.12/site-packages/pkg_resources/tests/test_resources.py +869 -0
  28. tool_server/.venv/lib/python3.12/site-packages/pkg_resources/tests/test_working_set.py +505 -0
  29. tool_server/.venv/lib/python3.12/site-packages/setuptools/__pycache__/__init__.cpython-312.pyc +0 -0
  30. tool_server/.venv/lib/python3.12/site-packages/setuptools/__pycache__/_core_metadata.cpython-312.pyc +0 -0
  31. tool_server/.venv/lib/python3.12/site-packages/setuptools/__pycache__/_entry_points.cpython-312.pyc +0 -0
  32. tool_server/.venv/lib/python3.12/site-packages/setuptools/__pycache__/_imp.cpython-312.pyc +0 -0
  33. tool_server/.venv/lib/python3.12/site-packages/setuptools/__pycache__/_importlib.cpython-312.pyc +0 -0
  34. tool_server/.venv/lib/python3.12/site-packages/setuptools/__pycache__/_itertools.cpython-312.pyc +0 -0
  35. tool_server/.venv/lib/python3.12/site-packages/setuptools/__pycache__/_normalization.cpython-312.pyc +0 -0
  36. tool_server/.venv/lib/python3.12/site-packages/setuptools/__pycache__/_path.cpython-312.pyc +0 -0
  37. tool_server/.venv/lib/python3.12/site-packages/setuptools/__pycache__/_reqs.cpython-312.pyc +0 -0
  38. tool_server/.venv/lib/python3.12/site-packages/setuptools/__pycache__/_shutil.cpython-312.pyc +0 -0
  39. tool_server/.venv/lib/python3.12/site-packages/setuptools/__pycache__/_static.cpython-312.pyc +0 -0
  40. tool_server/.venv/lib/python3.12/site-packages/setuptools/__pycache__/archive_util.cpython-312.pyc +0 -0
  41. tool_server/.venv/lib/python3.12/site-packages/setuptools/__pycache__/build_meta.cpython-312.pyc +0 -0
  42. tool_server/.venv/lib/python3.12/site-packages/setuptools/__pycache__/depends.cpython-312.pyc +0 -0
  43. tool_server/.venv/lib/python3.12/site-packages/setuptools/__pycache__/discovery.cpython-312.pyc +0 -0
  44. tool_server/.venv/lib/python3.12/site-packages/setuptools/__pycache__/dist.cpython-312.pyc +0 -0
  45. tool_server/.venv/lib/python3.12/site-packages/setuptools/__pycache__/errors.cpython-312.pyc +0 -0
  46. tool_server/.venv/lib/python3.12/site-packages/setuptools/__pycache__/extension.cpython-312.pyc +0 -0
  47. tool_server/.venv/lib/python3.12/site-packages/setuptools/__pycache__/glob.cpython-312.pyc +0 -0
  48. tool_server/.venv/lib/python3.12/site-packages/setuptools/__pycache__/installer.cpython-312.pyc +0 -0
  49. tool_server/.venv/lib/python3.12/site-packages/setuptools/__pycache__/launch.cpython-312.pyc +0 -0
  50. tool_server/.venv/lib/python3.12/site-packages/setuptools/__pycache__/logging.cpython-312.pyc +0 -0
.gitattributes CHANGED
@@ -4015,3 +4015,34 @@ tool_server/.venv/lib/python3.12/site-packages/sympy/polys/matrices/tests/__pyca
4015
  tool_server/.venv/lib/python3.12/site-packages/sympy/polys/numberfields/__pycache__/resolvent_lookup.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
4016
  tool_server/.venv/lib/python3.12/site-packages/sympy/polys/tests/__pycache__/test_rings.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
4017
  tool_server/.venv/lib/python3.12/site-packages/sympy/polys/tests/__pycache__/test_polytools.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4015
  tool_server/.venv/lib/python3.12/site-packages/sympy/polys/numberfields/__pycache__/resolvent_lookup.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
4016
  tool_server/.venv/lib/python3.12/site-packages/sympy/polys/tests/__pycache__/test_rings.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
4017
  tool_server/.venv/lib/python3.12/site-packages/sympy/polys/tests/__pycache__/test_polytools.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
4018
+ tool_server/.venv/lib/python3.12/site-packages/sympy/printing/__pycache__/latex.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
4019
+ tool_server/.venv/lib/python3.12/site-packages/sympy/printing/__pycache__/mathml.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
4020
+ tool_server/.venv/lib/python3.12/site-packages/sympy/printing/pretty/__pycache__/pretty.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
4021
+ tool_server/.venv/lib/python3.12/site-packages/sympy/printing/pretty/tests/__pycache__/test_pretty.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
4022
+ tool_server/.venv/lib/python3.12/site-packages/sympy/printing/tests/__pycache__/test_latex.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
4023
+ tool_server/.venv/lib/python3.12/site-packages/sympy/printing/tests/__pycache__/test_mathml.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
4024
+ tool_server/.venv/lib/python3.12/site-packages/sympy/series/tests/__pycache__/test_limits.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
4025
+ tool_server/.venv/lib/python3.12/site-packages/sympy/sets/__pycache__/sets.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
4026
+ tool_server/.venv/lib/python3.12/site-packages/sympy/sets/tests/__pycache__/test_fancysets.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
4027
+ tool_server/.venv/lib/python3.12/site-packages/sympy/sets/tests/__pycache__/test_sets.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
4028
+ tool_server/.venv/lib/python3.12/site-packages/sympy/simplify/__pycache__/hyperexpand.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
4029
+ tool_server/.venv/lib/python3.12/site-packages/sympy/solvers/__pycache__/solvers.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
4030
+ tool_server/.venv/lib/python3.12/site-packages/sympy/solvers/__pycache__/solveset.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
4031
+ tool_server/.venv/lib/python3.12/site-packages/sympy/solvers/diophantine/__pycache__/diophantine.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
4032
+ tool_server/.venv/lib/python3.12/site-packages/sympy/solvers/ode/__pycache__/ode.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
4033
+ tool_server/.venv/lib/python3.12/site-packages/sympy/solvers/ode/__pycache__/single.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
4034
+ tool_server/.venv/lib/python3.12/site-packages/sympy/solvers/ode/tests/__pycache__/test_ode.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
4035
+ tool_server/.venv/lib/python3.12/site-packages/sympy/solvers/ode/tests/__pycache__/test_single.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
4036
+ tool_server/.venv/lib/python3.12/site-packages/sympy/solvers/ode/tests/__pycache__/test_systems.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
4037
+ tool_server/.venv/lib/python3.12/site-packages/sympy/solvers/tests/__pycache__/test_solvers.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
4038
+ tool_server/.venv/lib/python3.12/site-packages/sympy/solvers/tests/__pycache__/test_solveset.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
4039
+ tool_server/.venv/lib/python3.12/site-packages/sympy/stats/__pycache__/crv_types.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
4040
+ tool_server/.venv/lib/python3.12/site-packages/sympy/stats/__pycache__/stochastic_process_types.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
4041
+ tool_server/.venv/lib/python3.12/site-packages/sympy/stats/tests/__pycache__/test_continuous_rv.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
4042
+ tool_server/.venv/lib/python3.12/site-packages/sympy/tensor/__pycache__/tensor.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
4043
+ tool_server/.venv/lib/python3.12/site-packages/sympy/tensor/array/expressions/__pycache__/array_expressions.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
4044
+ tool_server/.venv/lib/python3.12/site-packages/sympy/tensor/tests/__pycache__/test_tensor.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
4045
+ tool_server/.venv/lib/python3.12/site-packages/sympy/utilities/__pycache__/iterables.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
4046
+ tool_server/.venv/lib/python3.12/site-packages/sympy/utilities/tests/__pycache__/test_lambdify.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
4047
+ tool_server/.venv/lib/python3.12/site-packages/sympy/utilities/tests/__pycache__/test_wester.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
4048
+ tool_server/.venv/lib/python3.12/site-packages/pkg_resources/__pycache__/__init__.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
tool_server/.venv/lib/python3.12/site-packages/_distutils_hack/__pycache__/__init__.cpython-312.pyc ADDED
Binary file (10.6 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/_distutils_hack/__pycache__/override.cpython-312.pyc ADDED
Binary file (286 Bytes). View file
 
tool_server/.venv/lib/python3.12/site-packages/pkg_resources/__pycache__/__init__.cpython-312.pyc ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:21ed4a3bf8c35fd02aa7f6bdbc92750e07228491c56ed4c8504cc9d9d9dacb93
3
+ size 164697
tool_server/.venv/lib/python3.12/site-packages/pkg_resources/tests/__init__.py ADDED
File without changes
tool_server/.venv/lib/python3.12/site-packages/pkg_resources/tests/__pycache__/__init__.cpython-312.pyc ADDED
Binary file (189 Bytes). View file
 
tool_server/.venv/lib/python3.12/site-packages/pkg_resources/tests/__pycache__/test_find_distributions.cpython-312.pyc ADDED
Binary file (3.29 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/pkg_resources/tests/__pycache__/test_integration_zope_interface.cpython-312.pyc ADDED
Binary file (2 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/pkg_resources/tests/__pycache__/test_markers.cpython-312.pyc ADDED
Binary file (626 Bytes). View file
 
tool_server/.venv/lib/python3.12/site-packages/pkg_resources/tests/__pycache__/test_pkg_resources.cpython-312.pyc ADDED
Binary file (25.3 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/pkg_resources/tests/__pycache__/test_resources.cpython-312.pyc ADDED
Binary file (47.6 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/pkg_resources/tests/__pycache__/test_working_set.cpython-312.pyc ADDED
Binary file (10.5 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/pkg_resources/tests/data/my-test-package-source/__pycache__/setup.cpython-312.pyc ADDED
Binary file (363 Bytes). View file
 
tool_server/.venv/lib/python3.12/site-packages/pkg_resources/tests/data/my-test-package-source/setup.cfg ADDED
File without changes
tool_server/.venv/lib/python3.12/site-packages/pkg_resources/tests/data/my-test-package-source/setup.py ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ import setuptools
2
+
3
+ setuptools.setup(
4
+ name="my-test-package",
5
+ version="1.0",
6
+ zip_safe=True,
7
+ )
tool_server/.venv/lib/python3.12/site-packages/pkg_resources/tests/data/my-test-package-zip/my-test-package.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:01845c437f4655e3cf9cc4fc4e49cfd607431f22675e1b611129a90239f34822
3
+ size 1809
tool_server/.venv/lib/python3.12/site-packages/pkg_resources/tests/data/my-test-package_unpacked-egg/my_test_package-1.0-py3.7.egg/EGG-INFO/PKG-INFO ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ Metadata-Version: 1.0
2
+ Name: my-test-package
3
+ Version: 1.0
4
+ Summary: UNKNOWN
5
+ Home-page: UNKNOWN
6
+ Author: UNKNOWN
7
+ Author-email: UNKNOWN
8
+ License: UNKNOWN
9
+ Description: UNKNOWN
10
+ Platform: UNKNOWN
tool_server/.venv/lib/python3.12/site-packages/pkg_resources/tests/data/my-test-package_unpacked-egg/my_test_package-1.0-py3.7.egg/EGG-INFO/SOURCES.txt ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ setup.cfg
2
+ setup.py
3
+ my_test_package.egg-info/PKG-INFO
4
+ my_test_package.egg-info/SOURCES.txt
5
+ my_test_package.egg-info/dependency_links.txt
6
+ my_test_package.egg-info/top_level.txt
7
+ my_test_package.egg-info/zip-safe
tool_server/.venv/lib/python3.12/site-packages/pkg_resources/tests/data/my-test-package_unpacked-egg/my_test_package-1.0-py3.7.egg/EGG-INFO/dependency_links.txt ADDED
@@ -0,0 +1 @@
 
 
1
+
tool_server/.venv/lib/python3.12/site-packages/pkg_resources/tests/data/my-test-package_unpacked-egg/my_test_package-1.0-py3.7.egg/EGG-INFO/top_level.txt ADDED
@@ -0,0 +1 @@
 
 
1
+
tool_server/.venv/lib/python3.12/site-packages/pkg_resources/tests/data/my-test-package_unpacked-egg/my_test_package-1.0-py3.7.egg/EGG-INFO/zip-safe ADDED
@@ -0,0 +1 @@
 
 
1
+
tool_server/.venv/lib/python3.12/site-packages/pkg_resources/tests/data/my-test-package_zipped-egg/my_test_package-1.0-py3.7.egg ADDED
Binary file (843 Bytes). View file
 
tool_server/.venv/lib/python3.12/site-packages/pkg_resources/tests/test_find_distributions.py ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import shutil
2
+ from pathlib import Path
3
+
4
+ import pytest
5
+
6
+ import pkg_resources
7
+
8
+ TESTS_DATA_DIR = Path(__file__).parent / 'data'
9
+
10
+
11
+ class TestFindDistributions:
12
+ @pytest.fixture
13
+ def target_dir(self, tmpdir):
14
+ target_dir = tmpdir.mkdir('target')
15
+ # place a .egg named directory in the target that is not an egg:
16
+ target_dir.mkdir('not.an.egg')
17
+ return target_dir
18
+
19
+ def test_non_egg_dir_named_egg(self, target_dir):
20
+ dists = pkg_resources.find_distributions(str(target_dir))
21
+ assert not list(dists)
22
+
23
+ def test_standalone_egg_directory(self, target_dir):
24
+ shutil.copytree(
25
+ TESTS_DATA_DIR / 'my-test-package_unpacked-egg',
26
+ target_dir,
27
+ dirs_exist_ok=True,
28
+ )
29
+ dists = pkg_resources.find_distributions(str(target_dir))
30
+ assert [dist.project_name for dist in dists] == ['my-test-package']
31
+ dists = pkg_resources.find_distributions(str(target_dir), only=True)
32
+ assert not list(dists)
33
+
34
+ def test_zipped_egg(self, target_dir):
35
+ shutil.copytree(
36
+ TESTS_DATA_DIR / 'my-test-package_zipped-egg',
37
+ target_dir,
38
+ dirs_exist_ok=True,
39
+ )
40
+ dists = pkg_resources.find_distributions(str(target_dir))
41
+ assert [dist.project_name for dist in dists] == ['my-test-package']
42
+ dists = pkg_resources.find_distributions(str(target_dir), only=True)
43
+ assert not list(dists)
44
+
45
+ def test_zipped_sdist_one_level_removed(self, target_dir):
46
+ shutil.copytree(
47
+ TESTS_DATA_DIR / 'my-test-package-zip', target_dir, dirs_exist_ok=True
48
+ )
49
+ dists = pkg_resources.find_distributions(
50
+ str(target_dir / "my-test-package.zip")
51
+ )
52
+ assert [dist.project_name for dist in dists] == ['my-test-package']
53
+ dists = pkg_resources.find_distributions(
54
+ str(target_dir / "my-test-package.zip"), only=True
55
+ )
56
+ assert not list(dists)
tool_server/.venv/lib/python3.12/site-packages/pkg_resources/tests/test_integration_zope_interface.py ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import platform
2
+ from inspect import cleandoc
3
+
4
+ import jaraco.path
5
+ import pytest
6
+
7
+ pytestmark = pytest.mark.integration
8
+
9
+
10
+ # For the sake of simplicity this test uses fixtures defined in
11
+ # `setuptools.test.fixtures`,
12
+ # and it also exercise conditions considered deprecated...
13
+ # So if needed this test can be deleted.
14
+ @pytest.mark.skipif(
15
+ platform.system() != "Linux",
16
+ reason="only demonstrated to fail on Linux in #4399",
17
+ )
18
+ def test_interop_pkg_resources_iter_entry_points(tmp_path, venv):
19
+ """
20
+ Importing pkg_resources.iter_entry_points on console_scripts
21
+ seems to cause trouble with zope-interface, when deprecates installation method
22
+ is used. See #4399.
23
+ """
24
+ project = {
25
+ "pkg": {
26
+ "foo.py": cleandoc(
27
+ """
28
+ from pkg_resources import iter_entry_points
29
+
30
+ def bar():
31
+ print("Print me if you can")
32
+ """
33
+ ),
34
+ "setup.py": cleandoc(
35
+ """
36
+ from setuptools import setup, find_packages
37
+
38
+ setup(
39
+ install_requires=["zope-interface==6.4.post2"],
40
+ entry_points={
41
+ "console_scripts": [
42
+ "foo=foo:bar",
43
+ ],
44
+ },
45
+ )
46
+ """
47
+ ),
48
+ }
49
+ }
50
+ jaraco.path.build(project, prefix=tmp_path)
51
+ cmd = ["pip", "install", "-e", ".", "--no-use-pep517"]
52
+ venv.run(cmd, cwd=tmp_path / "pkg") # Needs this version of pkg_resources installed
53
+ out = venv.run(["foo"])
54
+ assert "Print me if you can" in out
tool_server/.venv/lib/python3.12/site-packages/pkg_resources/tests/test_markers.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ from unittest import mock
2
+
3
+ from pkg_resources import evaluate_marker
4
+
5
+
6
+ @mock.patch('platform.python_version', return_value='2.7.10')
7
+ def test_ordering(python_version_mock):
8
+ assert evaluate_marker("python_full_version > '2.7.3'") is True
tool_server/.venv/lib/python3.12/site-packages/pkg_resources/tests/test_pkg_resources.py ADDED
@@ -0,0 +1,485 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import builtins
4
+ import datetime
5
+ import inspect
6
+ import os
7
+ import plistlib
8
+ import stat
9
+ import subprocess
10
+ import sys
11
+ import tempfile
12
+ import zipfile
13
+ from unittest import mock
14
+
15
+ import pytest
16
+
17
+ import pkg_resources
18
+ from pkg_resources import DistInfoDistribution, Distribution, EggInfoDistribution
19
+
20
+ import distutils.command.install_egg_info
21
+ import distutils.dist
22
+
23
+
24
+ class EggRemover(str):
25
+ def __call__(self):
26
+ if self in sys.path:
27
+ sys.path.remove(self)
28
+ if os.path.exists(self):
29
+ os.remove(self)
30
+
31
+
32
+ class TestZipProvider:
33
+ finalizers: list[EggRemover] = []
34
+
35
+ ref_time = datetime.datetime(2013, 5, 12, 13, 25, 0)
36
+ "A reference time for a file modification"
37
+
38
+ @classmethod
39
+ def setup_class(cls):
40
+ "create a zip egg and add it to sys.path"
41
+ egg = tempfile.NamedTemporaryFile(suffix='.egg', delete=False)
42
+ zip_egg = zipfile.ZipFile(egg, 'w')
43
+ zip_info = zipfile.ZipInfo()
44
+ zip_info.filename = 'mod.py'
45
+ zip_info.date_time = cls.ref_time.timetuple()
46
+ zip_egg.writestr(zip_info, 'x = 3\n')
47
+ zip_info = zipfile.ZipInfo()
48
+ zip_info.filename = 'data.dat'
49
+ zip_info.date_time = cls.ref_time.timetuple()
50
+ zip_egg.writestr(zip_info, 'hello, world!')
51
+ zip_info = zipfile.ZipInfo()
52
+ zip_info.filename = 'subdir/mod2.py'
53
+ zip_info.date_time = cls.ref_time.timetuple()
54
+ zip_egg.writestr(zip_info, 'x = 6\n')
55
+ zip_info = zipfile.ZipInfo()
56
+ zip_info.filename = 'subdir/data2.dat'
57
+ zip_info.date_time = cls.ref_time.timetuple()
58
+ zip_egg.writestr(zip_info, 'goodbye, world!')
59
+ zip_egg.close()
60
+ egg.close()
61
+
62
+ sys.path.append(egg.name)
63
+ subdir = os.path.join(egg.name, 'subdir')
64
+ sys.path.append(subdir)
65
+ cls.finalizers.append(EggRemover(subdir))
66
+ cls.finalizers.append(EggRemover(egg.name))
67
+
68
+ @classmethod
69
+ def teardown_class(cls):
70
+ for finalizer in cls.finalizers:
71
+ finalizer()
72
+
73
+ def test_resource_listdir(self):
74
+ import mod # pyright: ignore[reportMissingImports] # Temporary package for test
75
+
76
+ zp = pkg_resources.ZipProvider(mod)
77
+
78
+ expected_root = ['data.dat', 'mod.py', 'subdir']
79
+ assert sorted(zp.resource_listdir('')) == expected_root
80
+
81
+ expected_subdir = ['data2.dat', 'mod2.py']
82
+ assert sorted(zp.resource_listdir('subdir')) == expected_subdir
83
+ assert sorted(zp.resource_listdir('subdir/')) == expected_subdir
84
+
85
+ assert zp.resource_listdir('nonexistent') == []
86
+ assert zp.resource_listdir('nonexistent/') == []
87
+
88
+ import mod2 # pyright: ignore[reportMissingImports] # Temporary package for test
89
+
90
+ zp2 = pkg_resources.ZipProvider(mod2)
91
+
92
+ assert sorted(zp2.resource_listdir('')) == expected_subdir
93
+
94
+ assert zp2.resource_listdir('subdir') == []
95
+ assert zp2.resource_listdir('subdir/') == []
96
+
97
+ def test_resource_filename_rewrites_on_change(self):
98
+ """
99
+ If a previous call to get_resource_filename has saved the file, but
100
+ the file has been subsequently mutated with different file of the
101
+ same size and modification time, it should not be overwritten on a
102
+ subsequent call to get_resource_filename.
103
+ """
104
+ import mod # pyright: ignore[reportMissingImports] # Temporary package for test
105
+
106
+ manager = pkg_resources.ResourceManager()
107
+ zp = pkg_resources.ZipProvider(mod)
108
+ filename = zp.get_resource_filename(manager, 'data.dat')
109
+ actual = datetime.datetime.fromtimestamp(os.stat(filename).st_mtime)
110
+ assert actual == self.ref_time
111
+ f = open(filename, 'w', encoding="utf-8")
112
+ f.write('hello, world?')
113
+ f.close()
114
+ ts = self.ref_time.timestamp()
115
+ os.utime(filename, (ts, ts))
116
+ filename = zp.get_resource_filename(manager, 'data.dat')
117
+ with open(filename, encoding="utf-8") as f:
118
+ assert f.read() == 'hello, world!'
119
+ manager.cleanup_resources()
120
+
121
+
122
+ class TestResourceManager:
123
+ def test_get_cache_path(self):
124
+ mgr = pkg_resources.ResourceManager()
125
+ path = mgr.get_cache_path('foo')
126
+ type_ = str(type(path))
127
+ message = "Unexpected type from get_cache_path: " + type_
128
+ assert isinstance(path, str), message
129
+
130
+ def test_get_cache_path_race(self, tmpdir):
131
+ # Patch to os.path.isdir to create a race condition
132
+ def patched_isdir(dirname, unpatched_isdir=pkg_resources.isdir):
133
+ patched_isdir.dirnames.append(dirname)
134
+
135
+ was_dir = unpatched_isdir(dirname)
136
+ if not was_dir:
137
+ os.makedirs(dirname)
138
+ return was_dir
139
+
140
+ patched_isdir.dirnames = []
141
+
142
+ # Get a cache path with a "race condition"
143
+ mgr = pkg_resources.ResourceManager()
144
+ mgr.set_extraction_path(str(tmpdir))
145
+
146
+ archive_name = os.sep.join(('foo', 'bar', 'baz'))
147
+ with mock.patch.object(pkg_resources, 'isdir', new=patched_isdir):
148
+ mgr.get_cache_path(archive_name)
149
+
150
+ # Because this test relies on the implementation details of this
151
+ # function, these assertions are a sentinel to ensure that the
152
+ # test suite will not fail silently if the implementation changes.
153
+ called_dirnames = patched_isdir.dirnames
154
+ assert len(called_dirnames) == 2
155
+ assert called_dirnames[0].split(os.sep)[-2:] == ['foo', 'bar']
156
+ assert called_dirnames[1].split(os.sep)[-1:] == ['foo']
157
+
158
+ """
159
+ Tests to ensure that pkg_resources runs independently from setuptools.
160
+ """
161
+
162
+ def test_setuptools_not_imported(self):
163
+ """
164
+ In a separate Python environment, import pkg_resources and assert
165
+ that action doesn't cause setuptools to be imported.
166
+ """
167
+ lines = (
168
+ 'import pkg_resources',
169
+ 'import sys',
170
+ ('assert "setuptools" not in sys.modules, "setuptools was imported"'),
171
+ )
172
+ cmd = [sys.executable, '-c', '; '.join(lines)]
173
+ subprocess.check_call(cmd)
174
+
175
+
176
+ def make_test_distribution(metadata_path, metadata):
177
+ """
178
+ Make a test Distribution object, and return it.
179
+
180
+ :param metadata_path: the path to the metadata file that should be
181
+ created. This should be inside a distribution directory that should
182
+ also be created. For example, an argument value might end with
183
+ "<project>.dist-info/METADATA".
184
+ :param metadata: the desired contents of the metadata file, as bytes.
185
+ """
186
+ dist_dir = os.path.dirname(metadata_path)
187
+ os.mkdir(dist_dir)
188
+ with open(metadata_path, 'wb') as f:
189
+ f.write(metadata)
190
+ dists = list(pkg_resources.distributions_from_metadata(dist_dir))
191
+ (dist,) = dists
192
+
193
+ return dist
194
+
195
+
196
+ def test_get_metadata__bad_utf8(tmpdir):
197
+ """
198
+ Test a metadata file with bytes that can't be decoded as utf-8.
199
+ """
200
+ filename = 'METADATA'
201
+ # Convert the tmpdir LocalPath object to a string before joining.
202
+ metadata_path = os.path.join(str(tmpdir), 'foo.dist-info', filename)
203
+ # Encode a non-ascii string with the wrong encoding (not utf-8).
204
+ metadata = 'née'.encode('iso-8859-1')
205
+ dist = make_test_distribution(metadata_path, metadata=metadata)
206
+
207
+ with pytest.raises(UnicodeDecodeError) as excinfo:
208
+ dist.get_metadata(filename)
209
+
210
+ exc = excinfo.value
211
+ actual = str(exc)
212
+ expected = (
213
+ # The error message starts with "'utf-8' codec ..." However, the
214
+ # spelling of "utf-8" can vary (e.g. "utf8") so we don't include it
215
+ "codec can't decode byte 0xe9 in position 1: "
216
+ 'invalid continuation byte in METADATA file at path: '
217
+ )
218
+ assert expected in actual, f'actual: {actual}'
219
+ assert actual.endswith(metadata_path), f'actual: {actual}'
220
+
221
+
222
+ def make_distribution_no_version(tmpdir, basename):
223
+ """
224
+ Create a distribution directory with no file containing the version.
225
+ """
226
+ dist_dir = tmpdir / basename
227
+ dist_dir.ensure_dir()
228
+ # Make the directory non-empty so distributions_from_metadata()
229
+ # will detect it and yield it.
230
+ dist_dir.join('temp.txt').ensure()
231
+
232
+ dists = list(pkg_resources.distributions_from_metadata(dist_dir))
233
+ assert len(dists) == 1
234
+ (dist,) = dists
235
+
236
+ return dist, dist_dir
237
+
238
+
239
+ @pytest.mark.parametrize(
240
+ ("suffix", "expected_filename", "expected_dist_type"),
241
+ [
242
+ ('egg-info', 'PKG-INFO', EggInfoDistribution),
243
+ ('dist-info', 'METADATA', DistInfoDistribution),
244
+ ],
245
+ )
246
+ @pytest.mark.xfail(
247
+ sys.version_info[:2] == (3, 12) and sys.version_info.releaselevel != 'final',
248
+ reason="https://github.com/python/cpython/issues/103632",
249
+ )
250
+ def test_distribution_version_missing(
251
+ tmpdir, suffix, expected_filename, expected_dist_type
252
+ ):
253
+ """
254
+ Test Distribution.version when the "Version" header is missing.
255
+ """
256
+ basename = f'foo.{suffix}'
257
+ dist, dist_dir = make_distribution_no_version(tmpdir, basename)
258
+
259
+ expected_text = (
260
+ f"Missing 'Version:' header and/or {expected_filename} file at path: "
261
+ )
262
+ metadata_path = os.path.join(dist_dir, expected_filename)
263
+
264
+ # Now check the exception raised when the "version" attribute is accessed.
265
+ with pytest.raises(ValueError) as excinfo:
266
+ dist.version
267
+
268
+ err = str(excinfo.value)
269
+ # Include a string expression after the assert so the full strings
270
+ # will be visible for inspection on failure.
271
+ assert expected_text in err, str((expected_text, err))
272
+
273
+ # Also check the args passed to the ValueError.
274
+ msg, dist = excinfo.value.args
275
+ assert expected_text in msg
276
+ # Check that the message portion contains the path.
277
+ assert metadata_path in msg, str((metadata_path, msg))
278
+ assert type(dist) is expected_dist_type
279
+
280
+
281
+ @pytest.mark.xfail(
282
+ sys.version_info[:2] == (3, 12) and sys.version_info.releaselevel != 'final',
283
+ reason="https://github.com/python/cpython/issues/103632",
284
+ )
285
+ def test_distribution_version_missing_undetected_path():
286
+ """
287
+ Test Distribution.version when the "Version" header is missing and
288
+ the path can't be detected.
289
+ """
290
+ # Create a Distribution object with no metadata argument, which results
291
+ # in an empty metadata provider.
292
+ dist = Distribution('/foo')
293
+ with pytest.raises(ValueError) as excinfo:
294
+ dist.version
295
+
296
+ msg, dist = excinfo.value.args
297
+ expected = (
298
+ "Missing 'Version:' header and/or PKG-INFO file at path: [could not detect]"
299
+ )
300
+ assert msg == expected
301
+
302
+
303
+ @pytest.mark.parametrize('only', [False, True])
304
+ def test_dist_info_is_not_dir(tmp_path, only):
305
+ """Test path containing a file with dist-info extension."""
306
+ dist_info = tmp_path / 'foobar.dist-info'
307
+ dist_info.touch()
308
+ assert not pkg_resources.dist_factory(str(tmp_path), str(dist_info), only)
309
+
310
+
311
+ def test_macos_vers_fallback(monkeypatch, tmp_path):
312
+ """Regression test for pkg_resources._macos_vers"""
313
+ orig_open = builtins.open
314
+
315
+ # Pretend we need to use the plist file
316
+ monkeypatch.setattr('platform.mac_ver', mock.Mock(return_value=('', (), '')))
317
+
318
+ # Create fake content for the fake plist file
319
+ with open(tmp_path / 'fake.plist', 'wb') as fake_file:
320
+ plistlib.dump({"ProductVersion": "11.4"}, fake_file)
321
+
322
+ # Pretend the fake file exists
323
+ monkeypatch.setattr('os.path.exists', mock.Mock(return_value=True))
324
+
325
+ def fake_open(file, *args, **kwargs):
326
+ return orig_open(tmp_path / 'fake.plist', *args, **kwargs)
327
+
328
+ # Ensure that the _macos_vers works correctly
329
+ with mock.patch('builtins.open', mock.Mock(side_effect=fake_open)) as m:
330
+ pkg_resources._macos_vers.cache_clear()
331
+ assert pkg_resources._macos_vers() == ["11", "4"]
332
+ pkg_resources._macos_vers.cache_clear()
333
+
334
+ m.assert_called()
335
+
336
+
337
+ class TestDeepVersionLookupDistutils:
338
+ @pytest.fixture
339
+ def env(self, tmpdir):
340
+ """
341
+ Create a package environment, similar to a virtualenv,
342
+ in which packages are installed.
343
+ """
344
+
345
+ class Environment(str):
346
+ pass
347
+
348
+ env = Environment(tmpdir)
349
+ tmpdir.chmod(stat.S_IRWXU)
350
+ subs = 'home', 'lib', 'scripts', 'data', 'egg-base'
351
+ env.paths = dict((dirname, str(tmpdir / dirname)) for dirname in subs)
352
+ list(map(os.mkdir, env.paths.values()))
353
+ return env
354
+
355
+ def create_foo_pkg(self, env, version):
356
+ """
357
+ Create a foo package installed (distutils-style) to env.paths['lib']
358
+ as version.
359
+ """
360
+ ld = "This package has unicode metadata! ❄"
361
+ attrs = dict(name='foo', version=version, long_description=ld)
362
+ dist = distutils.dist.Distribution(attrs)
363
+ iei_cmd = distutils.command.install_egg_info.install_egg_info(dist)
364
+ iei_cmd.initialize_options()
365
+ iei_cmd.install_dir = env.paths['lib']
366
+ iei_cmd.finalize_options()
367
+ iei_cmd.run()
368
+
369
+ def test_version_resolved_from_egg_info(self, env):
370
+ version = '1.11.0.dev0+2329eae'
371
+ self.create_foo_pkg(env, version)
372
+
373
+ # this requirement parsing will raise a VersionConflict unless the
374
+ # .egg-info file is parsed (see #419 on BitBucket)
375
+ req = pkg_resources.Requirement.parse('foo>=1.9')
376
+ dist = pkg_resources.WorkingSet([env.paths['lib']]).find(req)
377
+ assert dist.version == version
378
+
379
+ @pytest.mark.parametrize(
380
+ ("unnormalized", "normalized"),
381
+ [
382
+ ('foo', 'foo'),
383
+ ('foo/', 'foo'),
384
+ ('foo/bar', 'foo/bar'),
385
+ ('foo/bar/', 'foo/bar'),
386
+ ],
387
+ )
388
+ def test_normalize_path_trailing_sep(self, unnormalized, normalized):
389
+ """Ensure the trailing slash is cleaned for path comparison.
390
+
391
+ See pypa/setuptools#1519.
392
+ """
393
+ result_from_unnormalized = pkg_resources.normalize_path(unnormalized)
394
+ result_from_normalized = pkg_resources.normalize_path(normalized)
395
+ assert result_from_unnormalized == result_from_normalized
396
+
397
+ @pytest.mark.skipif(
398
+ os.path.normcase('A') != os.path.normcase('a'),
399
+ reason='Testing case-insensitive filesystems.',
400
+ )
401
+ @pytest.mark.parametrize(
402
+ ("unnormalized", "normalized"),
403
+ [
404
+ ('MiXeD/CasE', 'mixed/case'),
405
+ ],
406
+ )
407
+ def test_normalize_path_normcase(self, unnormalized, normalized):
408
+ """Ensure mixed case is normalized on case-insensitive filesystems."""
409
+ result_from_unnormalized = pkg_resources.normalize_path(unnormalized)
410
+ result_from_normalized = pkg_resources.normalize_path(normalized)
411
+ assert result_from_unnormalized == result_from_normalized
412
+
413
+ @pytest.mark.skipif(
414
+ os.path.sep != '\\',
415
+ reason='Testing systems using backslashes as path separators.',
416
+ )
417
+ @pytest.mark.parametrize(
418
+ ("unnormalized", "expected"),
419
+ [
420
+ ('forward/slash', 'forward\\slash'),
421
+ ('forward/slash/', 'forward\\slash'),
422
+ ('backward\\slash\\', 'backward\\slash'),
423
+ ],
424
+ )
425
+ def test_normalize_path_backslash_sep(self, unnormalized, expected):
426
+ """Ensure path seps are cleaned on backslash path sep systems."""
427
+ result = pkg_resources.normalize_path(unnormalized)
428
+ assert result.endswith(expected)
429
+
430
+
431
+ class TestWorkdirRequire:
432
+ def fake_site_packages(self, tmp_path, monkeypatch, dist_files):
433
+ site_packages = tmp_path / "site-packages"
434
+ site_packages.mkdir()
435
+ for file, content in self.FILES.items():
436
+ path = site_packages / file
437
+ path.parent.mkdir(exist_ok=True, parents=True)
438
+ path.write_text(inspect.cleandoc(content), encoding="utf-8")
439
+
440
+ monkeypatch.setattr(sys, "path", [site_packages])
441
+ return os.fspath(site_packages)
442
+
443
+ FILES = {
444
+ "pkg1_mod-1.2.3.dist-info/METADATA": """
445
+ Metadata-Version: 2.4
446
+ Name: pkg1.mod
447
+ Version: 1.2.3
448
+ """,
449
+ "pkg2.mod-0.42.dist-info/METADATA": """
450
+ Metadata-Version: 2.1
451
+ Name: pkg2.mod
452
+ Version: 0.42
453
+ """,
454
+ "pkg3_mod.egg-info/PKG-INFO": """
455
+ Name: pkg3.mod
456
+ Version: 1.2.3.4
457
+ """,
458
+ "pkg4.mod.egg-info/PKG-INFO": """
459
+ Name: pkg4.mod
460
+ Version: 0.42.1
461
+ """,
462
+ }
463
+
464
+ @pytest.mark.parametrize(
465
+ ("version", "requirement"),
466
+ [
467
+ ("1.2.3", "pkg1.mod>=1"),
468
+ ("0.42", "pkg2.mod>=0.4"),
469
+ ("1.2.3.4", "pkg3.mod<=2"),
470
+ ("0.42.1", "pkg4.mod>0.2,<1"),
471
+ ],
472
+ )
473
+ def test_require_non_normalised_name(
474
+ self, tmp_path, monkeypatch, version, requirement
475
+ ):
476
+ # https://github.com/pypa/setuptools/issues/4853
477
+ site_packages = self.fake_site_packages(tmp_path, monkeypatch, self.FILES)
478
+ ws = pkg_resources.WorkingSet([site_packages])
479
+
480
+ for req in [requirement, requirement.replace(".", "-")]:
481
+ [dist] = ws.require(req)
482
+ assert dist.version == version
483
+ assert os.path.samefile(
484
+ os.path.commonpath([dist.location, site_packages]), site_packages
485
+ )
tool_server/.venv/lib/python3.12/site-packages/pkg_resources/tests/test_resources.py ADDED
@@ -0,0 +1,869 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import itertools
2
+ import os
3
+ import platform
4
+ import string
5
+ import sys
6
+
7
+ import pytest
8
+ from packaging.specifiers import SpecifierSet
9
+
10
+ import pkg_resources
11
+ from pkg_resources import (
12
+ Distribution,
13
+ EntryPoint,
14
+ Requirement,
15
+ VersionConflict,
16
+ WorkingSet,
17
+ parse_requirements,
18
+ parse_version,
19
+ safe_name,
20
+ safe_version,
21
+ )
22
+
23
+
24
+ # from Python 3.6 docs. Available from itertools on Python 3.10
25
+ def pairwise(iterable):
26
+ "s -> (s0,s1), (s1,s2), (s2, s3), ..."
27
+ a, b = itertools.tee(iterable)
28
+ next(b, None)
29
+ return zip(a, b)
30
+
31
+
32
+ class Metadata(pkg_resources.EmptyProvider):
33
+ """Mock object to return metadata as if from an on-disk distribution"""
34
+
35
+ def __init__(self, *pairs) -> None:
36
+ self.metadata = dict(pairs)
37
+
38
+ def has_metadata(self, name) -> bool:
39
+ return name in self.metadata
40
+
41
+ def get_metadata(self, name):
42
+ return self.metadata[name]
43
+
44
+ def get_metadata_lines(self, name):
45
+ return pkg_resources.yield_lines(self.get_metadata(name))
46
+
47
+
48
+ dist_from_fn = pkg_resources.Distribution.from_filename
49
+
50
+
51
+ class TestDistro:
52
+ def testCollection(self):
53
+ # empty path should produce no distributions
54
+ ad = pkg_resources.Environment([], platform=None, python=None)
55
+ assert list(ad) == []
56
+ assert ad['FooPkg'] == []
57
+ ad.add(dist_from_fn("FooPkg-1.3_1.egg"))
58
+ ad.add(dist_from_fn("FooPkg-1.4-py2.4-win32.egg"))
59
+ ad.add(dist_from_fn("FooPkg-1.2-py2.4.egg"))
60
+
61
+ # Name is in there now
62
+ assert ad['FooPkg']
63
+ # But only 1 package
64
+ assert list(ad) == ['foopkg']
65
+
66
+ # Distributions sort by version
67
+ expected = ['1.4', '1.3-1', '1.2']
68
+ assert [dist.version for dist in ad['FooPkg']] == expected
69
+
70
+ # Removing a distribution leaves sequence alone
71
+ ad.remove(ad['FooPkg'][1])
72
+ assert [dist.version for dist in ad['FooPkg']] == ['1.4', '1.2']
73
+
74
+ # And inserting adds them in order
75
+ ad.add(dist_from_fn("FooPkg-1.9.egg"))
76
+ assert [dist.version for dist in ad['FooPkg']] == ['1.9', '1.4', '1.2']
77
+
78
+ ws = WorkingSet([])
79
+ foo12 = dist_from_fn("FooPkg-1.2-py2.4.egg")
80
+ foo14 = dist_from_fn("FooPkg-1.4-py2.4-win32.egg")
81
+ (req,) = parse_requirements("FooPkg>=1.3")
82
+
83
+ # Nominal case: no distros on path, should yield all applicable
84
+ assert ad.best_match(req, ws).version == '1.9'
85
+ # If a matching distro is already installed, should return only that
86
+ ws.add(foo14)
87
+ assert ad.best_match(req, ws).version == '1.4'
88
+
89
+ # If the first matching distro is unsuitable, it's a version conflict
90
+ ws = WorkingSet([])
91
+ ws.add(foo12)
92
+ ws.add(foo14)
93
+ with pytest.raises(VersionConflict):
94
+ ad.best_match(req, ws)
95
+
96
+ # If more than one match on the path, the first one takes precedence
97
+ ws = WorkingSet([])
98
+ ws.add(foo14)
99
+ ws.add(foo12)
100
+ ws.add(foo14)
101
+ assert ad.best_match(req, ws).version == '1.4'
102
+
103
+ def checkFooPkg(self, d):
104
+ assert d.project_name == "FooPkg"
105
+ assert d.key == "foopkg"
106
+ assert d.version == "1.3.post1"
107
+ assert d.py_version == "2.4"
108
+ assert d.platform == "win32"
109
+ assert d.parsed_version == parse_version("1.3-1")
110
+
111
+ def testDistroBasics(self):
112
+ d = Distribution(
113
+ "/some/path",
114
+ project_name="FooPkg",
115
+ version="1.3-1",
116
+ py_version="2.4",
117
+ platform="win32",
118
+ )
119
+ self.checkFooPkg(d)
120
+
121
+ d = Distribution("/some/path")
122
+ assert d.py_version == f'{sys.version_info.major}.{sys.version_info.minor}'
123
+ assert d.platform is None
124
+
125
+ def testDistroParse(self):
126
+ d = dist_from_fn("FooPkg-1.3.post1-py2.4-win32.egg")
127
+ self.checkFooPkg(d)
128
+ d = dist_from_fn("FooPkg-1.3.post1-py2.4-win32.egg-info")
129
+ self.checkFooPkg(d)
130
+
131
+ def testDistroMetadata(self):
132
+ d = Distribution(
133
+ "/some/path",
134
+ project_name="FooPkg",
135
+ py_version="2.4",
136
+ platform="win32",
137
+ metadata=Metadata(('PKG-INFO', "Metadata-Version: 1.0\nVersion: 1.3-1\n")),
138
+ )
139
+ self.checkFooPkg(d)
140
+
141
+ def distRequires(self, txt):
142
+ return Distribution("/foo", metadata=Metadata(('depends.txt', txt)))
143
+
144
+ def checkRequires(self, dist, txt, extras=()):
145
+ assert list(dist.requires(extras)) == list(parse_requirements(txt))
146
+
147
+ def testDistroDependsSimple(self):
148
+ for v in "Twisted>=1.5", "Twisted>=1.5\nZConfig>=2.0":
149
+ self.checkRequires(self.distRequires(v), v)
150
+
151
+ needs_object_dir = pytest.mark.skipif(
152
+ not hasattr(object, '__dir__'),
153
+ reason='object.__dir__ necessary for self.__dir__ implementation',
154
+ )
155
+
156
+ def test_distribution_dir(self):
157
+ d = pkg_resources.Distribution()
158
+ dir(d)
159
+
160
+ @needs_object_dir
161
+ def test_distribution_dir_includes_provider_dir(self):
162
+ d = pkg_resources.Distribution()
163
+ before = d.__dir__()
164
+ assert 'test_attr' not in before
165
+ d._provider.test_attr = None
166
+ after = d.__dir__()
167
+ assert len(after) == len(before) + 1
168
+ assert 'test_attr' in after
169
+
170
+ @needs_object_dir
171
+ def test_distribution_dir_ignores_provider_dir_leading_underscore(self):
172
+ d = pkg_resources.Distribution()
173
+ before = d.__dir__()
174
+ assert '_test_attr' not in before
175
+ d._provider._test_attr = None
176
+ after = d.__dir__()
177
+ assert len(after) == len(before)
178
+ assert '_test_attr' not in after
179
+
180
+ def testResolve(self):
181
+ ad = pkg_resources.Environment([])
182
+ ws = WorkingSet([])
183
+ # Resolving no requirements -> nothing to install
184
+ assert list(ws.resolve([], ad)) == []
185
+ # Request something not in the collection -> DistributionNotFound
186
+ with pytest.raises(pkg_resources.DistributionNotFound):
187
+ ws.resolve(parse_requirements("Foo"), ad)
188
+
189
+ Foo = Distribution.from_filename(
190
+ "/foo_dir/Foo-1.2.egg",
191
+ metadata=Metadata(('depends.txt', "[bar]\nBaz>=2.0")),
192
+ )
193
+ ad.add(Foo)
194
+ ad.add(Distribution.from_filename("Foo-0.9.egg"))
195
+
196
+ # Request thing(s) that are available -> list to activate
197
+ for i in range(3):
198
+ targets = list(ws.resolve(parse_requirements("Foo"), ad))
199
+ assert targets == [Foo]
200
+ list(map(ws.add, targets))
201
+ with pytest.raises(VersionConflict):
202
+ ws.resolve(parse_requirements("Foo==0.9"), ad)
203
+ ws = WorkingSet([]) # reset
204
+
205
+ # Request an extra that causes an unresolved dependency for "Baz"
206
+ with pytest.raises(pkg_resources.DistributionNotFound):
207
+ ws.resolve(parse_requirements("Foo[bar]"), ad)
208
+ Baz = Distribution.from_filename(
209
+ "/foo_dir/Baz-2.1.egg", metadata=Metadata(('depends.txt', "Foo"))
210
+ )
211
+ ad.add(Baz)
212
+
213
+ # Activation list now includes resolved dependency
214
+ assert list(ws.resolve(parse_requirements("Foo[bar]"), ad)) == [Foo, Baz]
215
+ # Requests for conflicting versions produce VersionConflict
216
+ with pytest.raises(VersionConflict) as vc:
217
+ ws.resolve(parse_requirements("Foo==1.2\nFoo!=1.2"), ad)
218
+
219
+ msg = 'Foo 0.9 is installed but Foo==1.2 is required'
220
+ assert vc.value.report() == msg
221
+
222
+ def test_environment_marker_evaluation_negative(self):
223
+ """Environment markers are evaluated at resolution time."""
224
+ ad = pkg_resources.Environment([])
225
+ ws = WorkingSet([])
226
+ res = ws.resolve(parse_requirements("Foo;python_version<'2'"), ad)
227
+ assert list(res) == []
228
+
229
+ def test_environment_marker_evaluation_positive(self):
230
+ ad = pkg_resources.Environment([])
231
+ ws = WorkingSet([])
232
+ Foo = Distribution.from_filename("/foo_dir/Foo-1.2.dist-info")
233
+ ad.add(Foo)
234
+ res = ws.resolve(parse_requirements("Foo;python_version>='2'"), ad)
235
+ assert list(res) == [Foo]
236
+
237
+ def test_environment_marker_evaluation_called(self):
238
+ """
239
+ If one package foo requires bar without any extras,
240
+ markers should pass for bar without extras.
241
+ """
242
+ (parent_req,) = parse_requirements("foo")
243
+ (req,) = parse_requirements("bar;python_version>='2'")
244
+ req_extras = pkg_resources._ReqExtras({req: parent_req.extras})
245
+ assert req_extras.markers_pass(req)
246
+
247
+ (parent_req,) = parse_requirements("foo[]")
248
+ (req,) = parse_requirements("bar;python_version>='2'")
249
+ req_extras = pkg_resources._ReqExtras({req: parent_req.extras})
250
+ assert req_extras.markers_pass(req)
251
+
252
+ def test_marker_evaluation_with_extras(self):
253
+ """Extras are also evaluated as markers at resolution time."""
254
+ ad = pkg_resources.Environment([])
255
+ ws = WorkingSet([])
256
+ Foo = Distribution.from_filename(
257
+ "/foo_dir/Foo-1.2.dist-info",
258
+ metadata=Metadata((
259
+ "METADATA",
260
+ "Provides-Extra: baz\nRequires-Dist: quux; extra=='baz'",
261
+ )),
262
+ )
263
+ ad.add(Foo)
264
+ assert list(ws.resolve(parse_requirements("Foo"), ad)) == [Foo]
265
+ quux = Distribution.from_filename("/foo_dir/quux-1.0.dist-info")
266
+ ad.add(quux)
267
+ res = list(ws.resolve(parse_requirements("Foo[baz]"), ad))
268
+ assert res == [Foo, quux]
269
+
270
+ def test_marker_evaluation_with_extras_normlized(self):
271
+ """Extras are also evaluated as markers at resolution time."""
272
+ ad = pkg_resources.Environment([])
273
+ ws = WorkingSet([])
274
+ Foo = Distribution.from_filename(
275
+ "/foo_dir/Foo-1.2.dist-info",
276
+ metadata=Metadata((
277
+ "METADATA",
278
+ "Provides-Extra: baz-lightyear\n"
279
+ "Requires-Dist: quux; extra=='baz-lightyear'",
280
+ )),
281
+ )
282
+ ad.add(Foo)
283
+ assert list(ws.resolve(parse_requirements("Foo"), ad)) == [Foo]
284
+ quux = Distribution.from_filename("/foo_dir/quux-1.0.dist-info")
285
+ ad.add(quux)
286
+ res = list(ws.resolve(parse_requirements("Foo[baz-lightyear]"), ad))
287
+ assert res == [Foo, quux]
288
+
289
+ def test_marker_evaluation_with_multiple_extras(self):
290
+ ad = pkg_resources.Environment([])
291
+ ws = WorkingSet([])
292
+ Foo = Distribution.from_filename(
293
+ "/foo_dir/Foo-1.2.dist-info",
294
+ metadata=Metadata((
295
+ "METADATA",
296
+ "Provides-Extra: baz\n"
297
+ "Requires-Dist: quux; extra=='baz'\n"
298
+ "Provides-Extra: bar\n"
299
+ "Requires-Dist: fred; extra=='bar'\n",
300
+ )),
301
+ )
302
+ ad.add(Foo)
303
+ quux = Distribution.from_filename("/foo_dir/quux-1.0.dist-info")
304
+ ad.add(quux)
305
+ fred = Distribution.from_filename("/foo_dir/fred-0.1.dist-info")
306
+ ad.add(fred)
307
+ res = list(ws.resolve(parse_requirements("Foo[baz,bar]"), ad))
308
+ assert sorted(res) == [fred, quux, Foo]
309
+
310
+ def test_marker_evaluation_with_extras_loop(self):
311
+ ad = pkg_resources.Environment([])
312
+ ws = WorkingSet([])
313
+ a = Distribution.from_filename(
314
+ "/foo_dir/a-0.2.dist-info",
315
+ metadata=Metadata(("METADATA", "Requires-Dist: c[a]")),
316
+ )
317
+ b = Distribution.from_filename(
318
+ "/foo_dir/b-0.3.dist-info",
319
+ metadata=Metadata(("METADATA", "Requires-Dist: c[b]")),
320
+ )
321
+ c = Distribution.from_filename(
322
+ "/foo_dir/c-1.0.dist-info",
323
+ metadata=Metadata((
324
+ "METADATA",
325
+ "Provides-Extra: a\n"
326
+ "Requires-Dist: b;extra=='a'\n"
327
+ "Provides-Extra: b\n"
328
+ "Requires-Dist: foo;extra=='b'",
329
+ )),
330
+ )
331
+ foo = Distribution.from_filename("/foo_dir/foo-0.1.dist-info")
332
+ for dist in (a, b, c, foo):
333
+ ad.add(dist)
334
+ res = list(ws.resolve(parse_requirements("a"), ad))
335
+ assert res == [a, c, b, foo]
336
+
337
+ @pytest.mark.xfail(
338
+ sys.version_info[:2] == (3, 12) and sys.version_info.releaselevel != 'final',
339
+ reason="https://github.com/python/cpython/issues/103632",
340
+ )
341
+ def testDistroDependsOptions(self):
342
+ d = self.distRequires(
343
+ """
344
+ Twisted>=1.5
345
+ [docgen]
346
+ ZConfig>=2.0
347
+ docutils>=0.3
348
+ [fastcgi]
349
+ fcgiapp>=0.1"""
350
+ )
351
+ self.checkRequires(d, "Twisted>=1.5")
352
+ self.checkRequires(
353
+ d, "Twisted>=1.5 ZConfig>=2.0 docutils>=0.3".split(), ["docgen"]
354
+ )
355
+ self.checkRequires(d, "Twisted>=1.5 fcgiapp>=0.1".split(), ["fastcgi"])
356
+ self.checkRequires(
357
+ d,
358
+ "Twisted>=1.5 ZConfig>=2.0 docutils>=0.3 fcgiapp>=0.1".split(),
359
+ ["docgen", "fastcgi"],
360
+ )
361
+ self.checkRequires(
362
+ d,
363
+ "Twisted>=1.5 fcgiapp>=0.1 ZConfig>=2.0 docutils>=0.3".split(),
364
+ ["fastcgi", "docgen"],
365
+ )
366
+ with pytest.raises(pkg_resources.UnknownExtra):
367
+ d.requires(["foo"])
368
+
369
+
370
+ class TestWorkingSet:
371
+ def test_find_conflicting(self):
372
+ ws = WorkingSet([])
373
+ Foo = Distribution.from_filename("/foo_dir/Foo-1.2.egg")
374
+ ws.add(Foo)
375
+
376
+ # create a requirement that conflicts with Foo 1.2
377
+ req = next(parse_requirements("Foo<1.2"))
378
+
379
+ with pytest.raises(VersionConflict) as vc:
380
+ ws.find(req)
381
+
382
+ msg = 'Foo 1.2 is installed but Foo<1.2 is required'
383
+ assert vc.value.report() == msg
384
+
385
+ def test_resolve_conflicts_with_prior(self):
386
+ """
387
+ A ContextualVersionConflict should be raised when a requirement
388
+ conflicts with a prior requirement for a different package.
389
+ """
390
+ # Create installation where Foo depends on Baz 1.0 and Bar depends on
391
+ # Baz 2.0.
392
+ ws = WorkingSet([])
393
+ md = Metadata(('depends.txt', "Baz==1.0"))
394
+ Foo = Distribution.from_filename("/foo_dir/Foo-1.0.egg", metadata=md)
395
+ ws.add(Foo)
396
+ md = Metadata(('depends.txt', "Baz==2.0"))
397
+ Bar = Distribution.from_filename("/foo_dir/Bar-1.0.egg", metadata=md)
398
+ ws.add(Bar)
399
+ Baz = Distribution.from_filename("/foo_dir/Baz-1.0.egg")
400
+ ws.add(Baz)
401
+ Baz = Distribution.from_filename("/foo_dir/Baz-2.0.egg")
402
+ ws.add(Baz)
403
+
404
+ with pytest.raises(VersionConflict) as vc:
405
+ ws.resolve(parse_requirements("Foo\nBar\n"))
406
+
407
+ msg = "Baz 1.0 is installed but Baz==2.0 is required by "
408
+ msg += repr(set(['Bar']))
409
+ assert vc.value.report() == msg
410
+
411
+
412
+ class TestEntryPoints:
413
+ def assertfields(self, ep):
414
+ assert ep.name == "foo"
415
+ assert ep.module_name == "pkg_resources.tests.test_resources"
416
+ assert ep.attrs == ("TestEntryPoints",)
417
+ assert ep.extras == ("x",)
418
+ assert ep.load() is TestEntryPoints
419
+ expect = "foo = pkg_resources.tests.test_resources:TestEntryPoints [x]"
420
+ assert str(ep) == expect
421
+
422
+ def setup_method(self, method):
423
+ self.dist = Distribution.from_filename(
424
+ "FooPkg-1.2-py2.4.egg", metadata=Metadata(('requires.txt', '[x]'))
425
+ )
426
+
427
+ def testBasics(self):
428
+ ep = EntryPoint(
429
+ "foo",
430
+ "pkg_resources.tests.test_resources",
431
+ ["TestEntryPoints"],
432
+ ["x"],
433
+ self.dist,
434
+ )
435
+ self.assertfields(ep)
436
+
437
+ def testParse(self):
438
+ s = "foo = pkg_resources.tests.test_resources:TestEntryPoints [x]"
439
+ ep = EntryPoint.parse(s, self.dist)
440
+ self.assertfields(ep)
441
+
442
+ ep = EntryPoint.parse("bar baz= spammity[PING]")
443
+ assert ep.name == "bar baz"
444
+ assert ep.module_name == "spammity"
445
+ assert ep.attrs == ()
446
+ assert ep.extras == ("ping",)
447
+
448
+ ep = EntryPoint.parse(" fizzly = wocka:foo")
449
+ assert ep.name == "fizzly"
450
+ assert ep.module_name == "wocka"
451
+ assert ep.attrs == ("foo",)
452
+ assert ep.extras == ()
453
+
454
+ # plus in the name
455
+ spec = "html+mako = mako.ext.pygmentplugin:MakoHtmlLexer"
456
+ ep = EntryPoint.parse(spec)
457
+ assert ep.name == 'html+mako'
458
+
459
+ reject_specs = "foo", "x=a:b:c", "q=x/na", "fez=pish:tush-z", "x=f[a]>2"
460
+
461
+ @pytest.mark.parametrize("reject_spec", reject_specs)
462
+ def test_reject_spec(self, reject_spec):
463
+ with pytest.raises(ValueError):
464
+ EntryPoint.parse(reject_spec)
465
+
466
+ def test_printable_name(self):
467
+ """
468
+ Allow any printable character in the name.
469
+ """
470
+ # Create a name with all printable characters; strip the whitespace.
471
+ name = string.printable.strip()
472
+ spec = "{name} = module:attr".format(**locals())
473
+ ep = EntryPoint.parse(spec)
474
+ assert ep.name == name
475
+
476
+ def checkSubMap(self, m):
477
+ assert len(m) == len(self.submap_expect)
478
+ for key, ep in self.submap_expect.items():
479
+ assert m.get(key).name == ep.name
480
+ assert m.get(key).module_name == ep.module_name
481
+ assert sorted(m.get(key).attrs) == sorted(ep.attrs)
482
+ assert sorted(m.get(key).extras) == sorted(ep.extras)
483
+
484
+ submap_expect = dict(
485
+ feature1=EntryPoint('feature1', 'somemodule', ['somefunction']),
486
+ feature2=EntryPoint(
487
+ 'feature2', 'another.module', ['SomeClass'], ['extra1', 'extra2']
488
+ ),
489
+ feature3=EntryPoint('feature3', 'this.module', extras=['something']),
490
+ )
491
+ submap_str = """
492
+ # define features for blah blah
493
+ feature1 = somemodule:somefunction
494
+ feature2 = another.module:SomeClass [extra1,extra2]
495
+ feature3 = this.module [something]
496
+ """
497
+
498
+ def testParseList(self):
499
+ self.checkSubMap(EntryPoint.parse_group("xyz", self.submap_str))
500
+ with pytest.raises(ValueError):
501
+ EntryPoint.parse_group("x a", "foo=bar")
502
+ with pytest.raises(ValueError):
503
+ EntryPoint.parse_group("x", ["foo=baz", "foo=bar"])
504
+
505
+ def testParseMap(self):
506
+ m = EntryPoint.parse_map({'xyz': self.submap_str})
507
+ self.checkSubMap(m['xyz'])
508
+ assert list(m.keys()) == ['xyz']
509
+ m = EntryPoint.parse_map("[xyz]\n" + self.submap_str)
510
+ self.checkSubMap(m['xyz'])
511
+ assert list(m.keys()) == ['xyz']
512
+ with pytest.raises(ValueError):
513
+ EntryPoint.parse_map(["[xyz]", "[xyz]"])
514
+ with pytest.raises(ValueError):
515
+ EntryPoint.parse_map(self.submap_str)
516
+
517
+ def testDeprecationWarnings(self):
518
+ ep = EntryPoint(
519
+ "foo", "pkg_resources.tests.test_resources", ["TestEntryPoints"], ["x"]
520
+ )
521
+ with pytest.warns(pkg_resources.PkgResourcesDeprecationWarning):
522
+ ep.load(require=False)
523
+
524
+
525
+ class TestRequirements:
526
+ def testBasics(self):
527
+ r = Requirement.parse("Twisted>=1.2")
528
+ assert str(r) == "Twisted>=1.2"
529
+ assert repr(r) == "Requirement.parse('Twisted>=1.2')"
530
+ assert r == Requirement("Twisted>=1.2")
531
+ assert r == Requirement("twisTed>=1.2")
532
+ assert r != Requirement("Twisted>=2.0")
533
+ assert r != Requirement("Zope>=1.2")
534
+ assert r != Requirement("Zope>=3.0")
535
+ assert r != Requirement("Twisted[extras]>=1.2")
536
+
537
+ def testOrdering(self):
538
+ r1 = Requirement("Twisted==1.2c1,>=1.2")
539
+ r2 = Requirement("Twisted>=1.2,==1.2c1")
540
+ assert r1 == r2
541
+ assert str(r1) == str(r2)
542
+ assert str(r2) == "Twisted==1.2c1,>=1.2"
543
+ assert Requirement("Twisted") != Requirement(
544
+ "Twisted @ https://localhost/twisted.zip"
545
+ )
546
+
547
+ def testBasicContains(self):
548
+ r = Requirement("Twisted>=1.2")
549
+ foo_dist = Distribution.from_filename("FooPkg-1.3_1.egg")
550
+ twist11 = Distribution.from_filename("Twisted-1.1.egg")
551
+ twist12 = Distribution.from_filename("Twisted-1.2.egg")
552
+ assert parse_version('1.2') in r
553
+ assert parse_version('1.1') not in r
554
+ assert '1.2' in r
555
+ assert '1.1' not in r
556
+ assert foo_dist not in r
557
+ assert twist11 not in r
558
+ assert twist12 in r
559
+
560
+ def testOptionsAndHashing(self):
561
+ r1 = Requirement.parse("Twisted[foo,bar]>=1.2")
562
+ r2 = Requirement.parse("Twisted[bar,FOO]>=1.2")
563
+ assert r1 == r2
564
+ assert set(r1.extras) == set(("foo", "bar"))
565
+ assert set(r2.extras) == set(("foo", "bar"))
566
+ assert hash(r1) == hash(r2)
567
+ assert hash(r1) == hash((
568
+ "twisted",
569
+ None,
570
+ SpecifierSet(">=1.2"),
571
+ frozenset(["foo", "bar"]),
572
+ None,
573
+ ))
574
+ assert hash(
575
+ Requirement.parse("Twisted @ https://localhost/twisted.zip")
576
+ ) == hash((
577
+ "twisted",
578
+ "https://localhost/twisted.zip",
579
+ SpecifierSet(),
580
+ frozenset(),
581
+ None,
582
+ ))
583
+
584
+ def testVersionEquality(self):
585
+ r1 = Requirement.parse("foo==0.3a2")
586
+ r2 = Requirement.parse("foo!=0.3a4")
587
+ d = Distribution.from_filename
588
+
589
+ assert d("foo-0.3a4.egg") not in r1
590
+ assert d("foo-0.3a1.egg") not in r1
591
+ assert d("foo-0.3a4.egg") not in r2
592
+
593
+ assert d("foo-0.3a2.egg") in r1
594
+ assert d("foo-0.3a2.egg") in r2
595
+ assert d("foo-0.3a3.egg") in r2
596
+ assert d("foo-0.3a5.egg") in r2
597
+
598
+ def testSetuptoolsProjectName(self):
599
+ """
600
+ The setuptools project should implement the setuptools package.
601
+ """
602
+
603
+ assert Requirement.parse('setuptools').project_name == 'setuptools'
604
+ # setuptools 0.7 and higher means setuptools.
605
+ assert Requirement.parse('setuptools == 0.7').project_name == 'setuptools'
606
+ assert Requirement.parse('setuptools == 0.7a1').project_name == 'setuptools'
607
+ assert Requirement.parse('setuptools >= 0.7').project_name == 'setuptools'
608
+
609
+
610
+ class TestParsing:
611
+ def testEmptyParse(self):
612
+ assert list(parse_requirements('')) == []
613
+
614
+ def testYielding(self):
615
+ for inp, out in [
616
+ ([], []),
617
+ ('x', ['x']),
618
+ ([[]], []),
619
+ (' x\n y', ['x', 'y']),
620
+ (['x\n\n', 'y'], ['x', 'y']),
621
+ ]:
622
+ assert list(pkg_resources.yield_lines(inp)) == out
623
+
624
+ def testSplitting(self):
625
+ sample = """
626
+ x
627
+ [Y]
628
+ z
629
+
630
+ a
631
+ [b ]
632
+ # foo
633
+ c
634
+ [ d]
635
+ [q]
636
+ v
637
+ """
638
+ assert list(pkg_resources.split_sections(sample)) == [
639
+ (None, ["x"]),
640
+ ("Y", ["z", "a"]),
641
+ ("b", ["c"]),
642
+ ("d", []),
643
+ ("q", ["v"]),
644
+ ]
645
+ with pytest.raises(ValueError):
646
+ list(pkg_resources.split_sections("[foo"))
647
+
648
+ def testSafeName(self):
649
+ assert safe_name("adns-python") == "adns-python"
650
+ assert safe_name("WSGI Utils") == "WSGI-Utils"
651
+ assert safe_name("WSGI Utils") == "WSGI-Utils"
652
+ assert safe_name("Money$$$Maker") == "Money-Maker"
653
+ assert safe_name("peak.web") != "peak-web"
654
+
655
+ def testSafeVersion(self):
656
+ assert safe_version("1.2-1") == "1.2.post1"
657
+ assert safe_version("1.2 alpha") == "1.2.alpha"
658
+ assert safe_version("2.3.4 20050521") == "2.3.4.20050521"
659
+ assert safe_version("Money$$$Maker") == "Money-Maker"
660
+ assert safe_version("peak.web") == "peak.web"
661
+
662
+ def testSimpleRequirements(self):
663
+ assert list(parse_requirements('Twis-Ted>=1.2-1')) == [
664
+ Requirement('Twis-Ted>=1.2-1')
665
+ ]
666
+ assert list(parse_requirements('Twisted >=1.2, \\ # more\n<2.0')) == [
667
+ Requirement('Twisted>=1.2,<2.0')
668
+ ]
669
+ assert Requirement.parse("FooBar==1.99a3") == Requirement("FooBar==1.99a3")
670
+ with pytest.raises(ValueError):
671
+ Requirement.parse(">=2.3")
672
+ with pytest.raises(ValueError):
673
+ Requirement.parse("x\\")
674
+ with pytest.raises(ValueError):
675
+ Requirement.parse("x==2 q")
676
+ with pytest.raises(ValueError):
677
+ Requirement.parse("X==1\nY==2")
678
+ with pytest.raises(ValueError):
679
+ Requirement.parse("#")
680
+
681
+ def test_requirements_with_markers(self):
682
+ assert Requirement.parse("foobar;os_name=='a'") == Requirement.parse(
683
+ "foobar;os_name=='a'"
684
+ )
685
+ assert Requirement.parse(
686
+ "name==1.1;python_version=='2.7'"
687
+ ) != Requirement.parse("name==1.1;python_version=='3.6'")
688
+ assert Requirement.parse(
689
+ "name==1.0;python_version=='2.7'"
690
+ ) != Requirement.parse("name==1.2;python_version=='2.7'")
691
+ assert Requirement.parse(
692
+ "name[foo]==1.0;python_version=='3.6'"
693
+ ) != Requirement.parse("name[foo,bar]==1.0;python_version=='3.6'")
694
+
695
+ def test_local_version(self):
696
+ parse_requirements('foo==1.0+org1')
697
+
698
+ def test_spaces_between_multiple_versions(self):
699
+ parse_requirements('foo>=1.0, <3')
700
+ parse_requirements('foo >= 1.0, < 3')
701
+
702
+ @pytest.mark.parametrize(
703
+ ("lower", "upper"),
704
+ [
705
+ ('1.2-rc1', '1.2rc1'),
706
+ ('0.4', '0.4.0'),
707
+ ('0.4.0.0', '0.4.0'),
708
+ ('0.4.0-0', '0.4-0'),
709
+ ('0post1', '0.0post1'),
710
+ ('0pre1', '0.0c1'),
711
+ ('0.0.0preview1', '0c1'),
712
+ ('0.0c1', '0-rc1'),
713
+ ('1.2a1', '1.2.a.1'),
714
+ ('1.2.a', '1.2a'),
715
+ ],
716
+ )
717
+ def testVersionEquality(self, lower, upper):
718
+ assert parse_version(lower) == parse_version(upper)
719
+
720
+ torture = """
721
+ 0.80.1-3 0.80.1-2 0.80.1-1 0.79.9999+0.80.0pre4-1
722
+ 0.79.9999+0.80.0pre2-3 0.79.9999+0.80.0pre2-2
723
+ 0.77.2-1 0.77.1-1 0.77.0-1
724
+ """
725
+
726
+ @pytest.mark.parametrize(
727
+ ("lower", "upper"),
728
+ [
729
+ ('2.1', '2.1.1'),
730
+ ('2a1', '2b0'),
731
+ ('2a1', '2.1'),
732
+ ('2.3a1', '2.3'),
733
+ ('2.1-1', '2.1-2'),
734
+ ('2.1-1', '2.1.1'),
735
+ ('2.1', '2.1post4'),
736
+ ('2.1a0-20040501', '2.1'),
737
+ ('1.1', '02.1'),
738
+ ('3.2', '3.2.post0'),
739
+ ('3.2post1', '3.2post2'),
740
+ ('0.4', '4.0'),
741
+ ('0.0.4', '0.4.0'),
742
+ ('0post1', '0.4post1'),
743
+ ('2.1.0-rc1', '2.1.0'),
744
+ ('2.1dev', '2.1a0'),
745
+ ]
746
+ + list(pairwise(reversed(torture.split()))),
747
+ )
748
+ def testVersionOrdering(self, lower, upper):
749
+ assert parse_version(lower) < parse_version(upper)
750
+
751
+ def testVersionHashable(self):
752
+ """
753
+ Ensure that our versions stay hashable even though we've subclassed
754
+ them and added some shim code to them.
755
+ """
756
+ assert hash(parse_version("1.0")) == hash(parse_version("1.0"))
757
+
758
+
759
+ class TestNamespaces:
760
+ ns_str = "__import__('pkg_resources').declare_namespace(__name__)\n"
761
+
762
+ @pytest.fixture
763
+ def symlinked_tmpdir(self, tmpdir):
764
+ """
765
+ Where available, return the tempdir as a symlink,
766
+ which as revealed in #231 is more fragile than
767
+ a natural tempdir.
768
+ """
769
+ if not hasattr(os, 'symlink'):
770
+ yield str(tmpdir)
771
+ return
772
+
773
+ link_name = str(tmpdir) + '-linked'
774
+ os.symlink(str(tmpdir), link_name)
775
+ try:
776
+ yield type(tmpdir)(link_name)
777
+ finally:
778
+ os.unlink(link_name)
779
+
780
+ @pytest.fixture(autouse=True)
781
+ def patched_path(self, tmpdir):
782
+ """
783
+ Patch sys.path to include the 'site-pkgs' dir. Also
784
+ restore pkg_resources._namespace_packages to its
785
+ former state.
786
+ """
787
+ saved_ns_pkgs = pkg_resources._namespace_packages.copy()
788
+ saved_sys_path = sys.path[:]
789
+ site_pkgs = tmpdir.mkdir('site-pkgs')
790
+ sys.path.append(str(site_pkgs))
791
+ try:
792
+ yield
793
+ finally:
794
+ pkg_resources._namespace_packages = saved_ns_pkgs
795
+ sys.path = saved_sys_path
796
+
797
+ issue591 = pytest.mark.xfail(platform.system() == 'Windows', reason="#591")
798
+
799
+ @issue591
800
+ def test_two_levels_deep(self, symlinked_tmpdir):
801
+ """
802
+ Test nested namespace packages
803
+ Create namespace packages in the following tree :
804
+ site-packages-1/pkg1/pkg2
805
+ site-packages-2/pkg1/pkg2
806
+ Check both are in the _namespace_packages dict and that their __path__
807
+ is correct
808
+ """
809
+ real_tmpdir = symlinked_tmpdir.realpath()
810
+ tmpdir = symlinked_tmpdir
811
+ sys.path.append(str(tmpdir / 'site-pkgs2'))
812
+ site_dirs = tmpdir / 'site-pkgs', tmpdir / 'site-pkgs2'
813
+ for site in site_dirs:
814
+ pkg1 = site / 'pkg1'
815
+ pkg2 = pkg1 / 'pkg2'
816
+ pkg2.ensure_dir()
817
+ (pkg1 / '__init__.py').write_text(self.ns_str, encoding='utf-8')
818
+ (pkg2 / '__init__.py').write_text(self.ns_str, encoding='utf-8')
819
+ with pytest.warns(DeprecationWarning, match="pkg_resources.declare_namespace"):
820
+ import pkg1 # pyright: ignore[reportMissingImports] # Temporary package for test
821
+ assert "pkg1" in pkg_resources._namespace_packages
822
+ # attempt to import pkg2 from site-pkgs2
823
+ with pytest.warns(DeprecationWarning, match="pkg_resources.declare_namespace"):
824
+ import pkg1.pkg2 # pyright: ignore[reportMissingImports] # Temporary package for test
825
+ # check the _namespace_packages dict
826
+ assert "pkg1.pkg2" in pkg_resources._namespace_packages
827
+ assert pkg_resources._namespace_packages["pkg1"] == ["pkg1.pkg2"]
828
+ # check the __path__ attribute contains both paths
829
+ expected = [
830
+ str(real_tmpdir / "site-pkgs" / "pkg1" / "pkg2"),
831
+ str(real_tmpdir / "site-pkgs2" / "pkg1" / "pkg2"),
832
+ ]
833
+ assert pkg1.pkg2.__path__ == expected
834
+
835
+ @issue591
836
+ def test_path_order(self, symlinked_tmpdir):
837
+ """
838
+ Test that if multiple versions of the same namespace package subpackage
839
+ are on different sys.path entries, that only the one earliest on
840
+ sys.path is imported, and that the namespace package's __path__ is in
841
+ the correct order.
842
+
843
+ Regression test for https://github.com/pypa/setuptools/issues/207
844
+ """
845
+
846
+ tmpdir = symlinked_tmpdir
847
+ site_dirs = (
848
+ tmpdir / "site-pkgs",
849
+ tmpdir / "site-pkgs2",
850
+ tmpdir / "site-pkgs3",
851
+ )
852
+
853
+ vers_str = "__version__ = %r"
854
+
855
+ for number, site in enumerate(site_dirs, 1):
856
+ if number > 1:
857
+ sys.path.append(str(site))
858
+ nspkg = site / 'nspkg'
859
+ subpkg = nspkg / 'subpkg'
860
+ subpkg.ensure_dir()
861
+ (nspkg / '__init__.py').write_text(self.ns_str, encoding='utf-8')
862
+ (subpkg / '__init__.py').write_text(vers_str % number, encoding='utf-8')
863
+
864
+ with pytest.warns(DeprecationWarning, match="pkg_resources.declare_namespace"):
865
+ import nspkg # pyright: ignore[reportMissingImports] # Temporary package for test
866
+ import nspkg.subpkg # pyright: ignore[reportMissingImports] # Temporary package for test
867
+ expected = [str(site.realpath() / 'nspkg') for site in site_dirs]
868
+ assert nspkg.__path__ == expected
869
+ assert nspkg.subpkg.__version__ == 1
tool_server/.venv/lib/python3.12/site-packages/pkg_resources/tests/test_working_set.py ADDED
@@ -0,0 +1,505 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import functools
2
+ import inspect
3
+ import re
4
+ import textwrap
5
+
6
+ import pytest
7
+
8
+ import pkg_resources
9
+
10
+ from .test_resources import Metadata
11
+
12
+
13
+ def strip_comments(s):
14
+ return '\n'.join(
15
+ line
16
+ for line in s.split('\n')
17
+ if line.strip() and not line.strip().startswith('#')
18
+ )
19
+
20
+
21
+ def parse_distributions(s):
22
+ """
23
+ Parse a series of distribution specs of the form:
24
+ {project_name}-{version}
25
+ [optional, indented requirements specification]
26
+
27
+ Example:
28
+
29
+ foo-0.2
30
+ bar-1.0
31
+ foo>=3.0
32
+ [feature]
33
+ baz
34
+
35
+ yield 2 distributions:
36
+ - project_name=foo, version=0.2
37
+ - project_name=bar, version=1.0,
38
+ requires=['foo>=3.0', 'baz; extra=="feature"']
39
+ """
40
+ s = s.strip()
41
+ for spec in re.split(r'\n(?=[^\s])', s):
42
+ if not spec:
43
+ continue
44
+ fields = spec.split('\n', 1)
45
+ assert 1 <= len(fields) <= 2
46
+ name, version = fields.pop(0).rsplit('-', 1)
47
+ if fields:
48
+ requires = textwrap.dedent(fields.pop(0))
49
+ metadata = Metadata(('requires.txt', requires))
50
+ else:
51
+ metadata = None
52
+ dist = pkg_resources.Distribution(
53
+ project_name=name, version=version, metadata=metadata
54
+ )
55
+ yield dist
56
+
57
+
58
+ class FakeInstaller:
59
+ def __init__(self, installable_dists) -> None:
60
+ self._installable_dists = installable_dists
61
+
62
+ def __call__(self, req):
63
+ return next(
64
+ iter(filter(lambda dist: dist in req, self._installable_dists)), None
65
+ )
66
+
67
+
68
+ def parametrize_test_working_set_resolve(*test_list):
69
+ idlist = []
70
+ argvalues = []
71
+ for test in test_list:
72
+ (
73
+ name,
74
+ installed_dists,
75
+ installable_dists,
76
+ requirements,
77
+ expected1,
78
+ expected2,
79
+ ) = (
80
+ strip_comments(s.lstrip())
81
+ for s in textwrap.dedent(test).lstrip().split('\n\n', 5)
82
+ )
83
+ installed_dists = list(parse_distributions(installed_dists))
84
+ installable_dists = list(parse_distributions(installable_dists))
85
+ requirements = list(pkg_resources.parse_requirements(requirements))
86
+ for id_, replace_conflicting, expected in (
87
+ (name, False, expected1),
88
+ (name + '_replace_conflicting', True, expected2),
89
+ ):
90
+ idlist.append(id_)
91
+ expected = strip_comments(expected.strip())
92
+ if re.match(r'\w+$', expected):
93
+ expected = getattr(pkg_resources, expected)
94
+ assert issubclass(expected, Exception)
95
+ else:
96
+ expected = list(parse_distributions(expected))
97
+ argvalues.append(
98
+ pytest.param(
99
+ installed_dists,
100
+ installable_dists,
101
+ requirements,
102
+ replace_conflicting,
103
+ expected,
104
+ )
105
+ )
106
+ return pytest.mark.parametrize(
107
+ (
108
+ "installed_dists",
109
+ "installable_dists",
110
+ "requirements",
111
+ "replace_conflicting",
112
+ "resolved_dists_or_exception",
113
+ ),
114
+ argvalues,
115
+ ids=idlist,
116
+ )
117
+
118
+
119
+ @parametrize_test_working_set_resolve(
120
+ """
121
+ # id
122
+ noop
123
+
124
+ # installed
125
+
126
+ # installable
127
+
128
+ # wanted
129
+
130
+ # resolved
131
+
132
+ # resolved [replace conflicting]
133
+ """,
134
+ """
135
+ # id
136
+ already_installed
137
+
138
+ # installed
139
+ foo-3.0
140
+
141
+ # installable
142
+
143
+ # wanted
144
+ foo>=2.1,!=3.1,<4
145
+
146
+ # resolved
147
+ foo-3.0
148
+
149
+ # resolved [replace conflicting]
150
+ foo-3.0
151
+ """,
152
+ """
153
+ # id
154
+ installable_not_installed
155
+
156
+ # installed
157
+
158
+ # installable
159
+ foo-3.0
160
+ foo-4.0
161
+
162
+ # wanted
163
+ foo>=2.1,!=3.1,<4
164
+
165
+ # resolved
166
+ foo-3.0
167
+
168
+ # resolved [replace conflicting]
169
+ foo-3.0
170
+ """,
171
+ """
172
+ # id
173
+ not_installable
174
+
175
+ # installed
176
+
177
+ # installable
178
+
179
+ # wanted
180
+ foo>=2.1,!=3.1,<4
181
+
182
+ # resolved
183
+ DistributionNotFound
184
+
185
+ # resolved [replace conflicting]
186
+ DistributionNotFound
187
+ """,
188
+ """
189
+ # id
190
+ no_matching_version
191
+
192
+ # installed
193
+
194
+ # installable
195
+ foo-3.1
196
+
197
+ # wanted
198
+ foo>=2.1,!=3.1,<4
199
+
200
+ # resolved
201
+ DistributionNotFound
202
+
203
+ # resolved [replace conflicting]
204
+ DistributionNotFound
205
+ """,
206
+ """
207
+ # id
208
+ installable_with_installed_conflict
209
+
210
+ # installed
211
+ foo-3.1
212
+
213
+ # installable
214
+ foo-3.5
215
+
216
+ # wanted
217
+ foo>=2.1,!=3.1,<4
218
+
219
+ # resolved
220
+ VersionConflict
221
+
222
+ # resolved [replace conflicting]
223
+ foo-3.5
224
+ """,
225
+ """
226
+ # id
227
+ not_installable_with_installed_conflict
228
+
229
+ # installed
230
+ foo-3.1
231
+
232
+ # installable
233
+
234
+ # wanted
235
+ foo>=2.1,!=3.1,<4
236
+
237
+ # resolved
238
+ VersionConflict
239
+
240
+ # resolved [replace conflicting]
241
+ DistributionNotFound
242
+ """,
243
+ """
244
+ # id
245
+ installed_with_installed_require
246
+
247
+ # installed
248
+ foo-3.9
249
+ baz-0.1
250
+ foo>=2.1,!=3.1,<4
251
+
252
+ # installable
253
+
254
+ # wanted
255
+ baz
256
+
257
+ # resolved
258
+ foo-3.9
259
+ baz-0.1
260
+
261
+ # resolved [replace conflicting]
262
+ foo-3.9
263
+ baz-0.1
264
+ """,
265
+ """
266
+ # id
267
+ installed_with_conflicting_installed_require
268
+
269
+ # installed
270
+ foo-5
271
+ baz-0.1
272
+ foo>=2.1,!=3.1,<4
273
+
274
+ # installable
275
+
276
+ # wanted
277
+ baz
278
+
279
+ # resolved
280
+ VersionConflict
281
+
282
+ # resolved [replace conflicting]
283
+ DistributionNotFound
284
+ """,
285
+ """
286
+ # id
287
+ installed_with_installable_conflicting_require
288
+
289
+ # installed
290
+ foo-5
291
+ baz-0.1
292
+ foo>=2.1,!=3.1,<4
293
+
294
+ # installable
295
+ foo-2.9
296
+
297
+ # wanted
298
+ baz
299
+
300
+ # resolved
301
+ VersionConflict
302
+
303
+ # resolved [replace conflicting]
304
+ baz-0.1
305
+ foo-2.9
306
+ """,
307
+ """
308
+ # id
309
+ installed_with_installable_require
310
+
311
+ # installed
312
+ baz-0.1
313
+ foo>=2.1,!=3.1,<4
314
+
315
+ # installable
316
+ foo-3.9
317
+
318
+ # wanted
319
+ baz
320
+
321
+ # resolved
322
+ foo-3.9
323
+ baz-0.1
324
+
325
+ # resolved [replace conflicting]
326
+ foo-3.9
327
+ baz-0.1
328
+ """,
329
+ """
330
+ # id
331
+ installable_with_installed_require
332
+
333
+ # installed
334
+ foo-3.9
335
+
336
+ # installable
337
+ baz-0.1
338
+ foo>=2.1,!=3.1,<4
339
+
340
+ # wanted
341
+ baz
342
+
343
+ # resolved
344
+ foo-3.9
345
+ baz-0.1
346
+
347
+ # resolved [replace conflicting]
348
+ foo-3.9
349
+ baz-0.1
350
+ """,
351
+ """
352
+ # id
353
+ installable_with_installable_require
354
+
355
+ # installed
356
+
357
+ # installable
358
+ foo-3.9
359
+ baz-0.1
360
+ foo>=2.1,!=3.1,<4
361
+
362
+ # wanted
363
+ baz
364
+
365
+ # resolved
366
+ foo-3.9
367
+ baz-0.1
368
+
369
+ # resolved [replace conflicting]
370
+ foo-3.9
371
+ baz-0.1
372
+ """,
373
+ """
374
+ # id
375
+ installable_with_conflicting_installable_require
376
+
377
+ # installed
378
+ foo-5
379
+
380
+ # installable
381
+ foo-2.9
382
+ baz-0.1
383
+ foo>=2.1,!=3.1,<4
384
+
385
+ # wanted
386
+ baz
387
+
388
+ # resolved
389
+ VersionConflict
390
+
391
+ # resolved [replace conflicting]
392
+ baz-0.1
393
+ foo-2.9
394
+ """,
395
+ """
396
+ # id
397
+ conflicting_installables
398
+
399
+ # installed
400
+
401
+ # installable
402
+ foo-2.9
403
+ foo-5.0
404
+
405
+ # wanted
406
+ foo>=2.1,!=3.1,<4
407
+ foo>=4
408
+
409
+ # resolved
410
+ VersionConflict
411
+
412
+ # resolved [replace conflicting]
413
+ VersionConflict
414
+ """,
415
+ """
416
+ # id
417
+ installables_with_conflicting_requires
418
+
419
+ # installed
420
+
421
+ # installable
422
+ foo-2.9
423
+ dep==1.0
424
+ baz-5.0
425
+ dep==2.0
426
+ dep-1.0
427
+ dep-2.0
428
+
429
+ # wanted
430
+ foo
431
+ baz
432
+
433
+ # resolved
434
+ VersionConflict
435
+
436
+ # resolved [replace conflicting]
437
+ VersionConflict
438
+ """,
439
+ """
440
+ # id
441
+ installables_with_conflicting_nested_requires
442
+
443
+ # installed
444
+
445
+ # installable
446
+ foo-2.9
447
+ dep1
448
+ dep1-1.0
449
+ subdep<1.0
450
+ baz-5.0
451
+ dep2
452
+ dep2-1.0
453
+ subdep>1.0
454
+ subdep-0.9
455
+ subdep-1.1
456
+
457
+ # wanted
458
+ foo
459
+ baz
460
+
461
+ # resolved
462
+ VersionConflict
463
+
464
+ # resolved [replace conflicting]
465
+ VersionConflict
466
+ """,
467
+ """
468
+ # id
469
+ wanted_normalized_name_installed_canonical
470
+
471
+ # installed
472
+ foo.bar-3.6
473
+
474
+ # installable
475
+
476
+ # wanted
477
+ foo-bar==3.6
478
+
479
+ # resolved
480
+ foo.bar-3.6
481
+
482
+ # resolved [replace conflicting]
483
+ foo.bar-3.6
484
+ """,
485
+ )
486
+ def test_working_set_resolve(
487
+ installed_dists,
488
+ installable_dists,
489
+ requirements,
490
+ replace_conflicting,
491
+ resolved_dists_or_exception,
492
+ ):
493
+ ws = pkg_resources.WorkingSet([])
494
+ list(map(ws.add, installed_dists))
495
+ resolve_call = functools.partial(
496
+ ws.resolve,
497
+ requirements,
498
+ installer=FakeInstaller(installable_dists),
499
+ replace_conflicting=replace_conflicting,
500
+ )
501
+ if inspect.isclass(resolved_dists_or_exception):
502
+ with pytest.raises(resolved_dists_or_exception):
503
+ resolve_call()
504
+ else:
505
+ assert sorted(resolve_call()) == sorted(resolved_dists_or_exception)
tool_server/.venv/lib/python3.12/site-packages/setuptools/__pycache__/__init__.cpython-312.pyc ADDED
Binary file (13.9 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/setuptools/__pycache__/_core_metadata.cpython-312.pyc ADDED
Binary file (14.9 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/setuptools/__pycache__/_entry_points.cpython-312.pyc ADDED
Binary file (4.68 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/setuptools/__pycache__/_imp.cpython-312.pyc ADDED
Binary file (3.61 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/setuptools/__pycache__/_importlib.cpython-312.pyc ADDED
Binary file (397 Bytes). View file
 
tool_server/.venv/lib/python3.12/site-packages/setuptools/__pycache__/_itertools.cpython-312.pyc ADDED
Binary file (1.06 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/setuptools/__pycache__/_normalization.cpython-312.pyc ADDED
Binary file (7.41 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/setuptools/__pycache__/_path.cpython-312.pyc ADDED
Binary file (4.19 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/setuptools/__pycache__/_reqs.cpython-312.pyc ADDED
Binary file (1.96 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/setuptools/__pycache__/_shutil.cpython-312.pyc ADDED
Binary file (2.35 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/setuptools/__pycache__/_static.cpython-312.pyc ADDED
Binary file (6.06 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/setuptools/__pycache__/archive_util.cpython-312.pyc ADDED
Binary file (9.26 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/setuptools/__pycache__/build_meta.cpython-312.pyc ADDED
Binary file (24.8 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/setuptools/__pycache__/depends.cpython-312.pyc ADDED
Binary file (7.62 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/setuptools/__pycache__/discovery.cpython-312.pyc ADDED
Binary file (28.7 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/setuptools/__pycache__/dist.cpython-312.pyc ADDED
Binary file (52.3 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/setuptools/__pycache__/errors.cpython-312.pyc ADDED
Binary file (3.49 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/setuptools/__pycache__/extension.cpython-312.pyc ADDED
Binary file (6.91 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/setuptools/__pycache__/glob.cpython-312.pyc ADDED
Binary file (7.44 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/setuptools/__pycache__/installer.cpython-312.pyc ADDED
Binary file (6.61 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/setuptools/__pycache__/launch.cpython-312.pyc ADDED
Binary file (1.32 kB). View file
 
tool_server/.venv/lib/python3.12/site-packages/setuptools/__pycache__/logging.cpython-312.pyc ADDED
Binary file (2.1 kB). View file