FaustDerLegende commited on
Commit
f9318c9
·
verified ·
1 Parent(s): 5c1037b

Upload folder using huggingface_hub (part 17)

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 +27 -0
  2. .venv/lib/python3.12/site-packages/setuptools-78.1.0.dist-info/INSTALLER +1 -0
  3. .venv/lib/python3.12/site-packages/setuptools-78.1.0.dist-info/METADATA +141 -0
  4. .venv/lib/python3.12/site-packages/setuptools-78.1.0.dist-info/RECORD +872 -0
  5. .venv/lib/python3.12/site-packages/setuptools-78.1.0.dist-info/WHEEL +5 -0
  6. .venv/lib/python3.12/site-packages/setuptools-78.1.0.dist-info/entry_points.txt +51 -0
  7. .venv/lib/python3.12/site-packages/setuptools-78.1.0.dist-info/licenses/LICENSE +17 -0
  8. .venv/lib/python3.12/site-packages/setuptools-78.1.0.dist-info/top_level.txt +3 -0
  9. .venv/lib/python3.12/site-packages/setuptools/tests/test_core_metadata.py +622 -0
  10. .venv/lib/python3.12/site-packages/setuptools/tests/test_depends.py +15 -0
  11. .venv/lib/python3.12/site-packages/setuptools/tests/test_develop.py +175 -0
  12. .venv/lib/python3.12/site-packages/setuptools/tests/test_dist.py +278 -0
  13. .venv/lib/python3.12/site-packages/setuptools/tests/test_dist_info.py +210 -0
  14. .venv/lib/python3.12/site-packages/setuptools/tests/test_distutils_adoption.py +198 -0
  15. .venv/lib/python3.12/site-packages/setuptools/tests/test_easy_install.py +1476 -0
  16. .venv/lib/python3.12/site-packages/setuptools/tests/test_editable_install.py +1289 -0
  17. .venv/lib/python3.12/site-packages/setuptools/tests/test_egg_info.py +1305 -0
  18. .venv/lib/python3.12/site-packages/setuptools/tests/test_extern.py +15 -0
  19. .venv/lib/python3.12/site-packages/setuptools/tests/test_find_packages.py +218 -0
  20. .venv/lib/python3.12/site-packages/setuptools/tests/test_find_py_modules.py +73 -0
  21. .venv/lib/python3.12/site-packages/setuptools/tests/test_glob.py +45 -0
  22. .venv/lib/python3.12/site-packages/setuptools/tests/test_install_scripts.py +89 -0
  23. .venv/lib/python3.12/site-packages/setuptools/tests/test_logging.py +76 -0
  24. .venv/lib/python3.12/site-packages/setuptools/tests/test_manifest.py +622 -0
  25. .venv/lib/python3.12/site-packages/setuptools/tests/test_namespaces.py +138 -0
  26. .venv/lib/python3.12/site-packages/setuptools/tests/test_packageindex.py +267 -0
  27. .venv/lib/python3.12/site-packages/setuptools/tests/test_sandbox.py +134 -0
  28. .venv/lib/python3.12/site-packages/setuptools/tests/test_sdist.py +984 -0
  29. .venv/lib/python3.12/site-packages/setuptools/tests/test_setopt.py +40 -0
  30. .venv/lib/python3.12/site-packages/setuptools/tests/test_setuptools.py +290 -0
  31. .venv/lib/python3.12/site-packages/setuptools/tests/test_shutil_wrapper.py +23 -0
  32. .venv/lib/python3.12/site-packages/setuptools/tests/test_unicode_utils.py +10 -0
  33. .venv/lib/python3.12/site-packages/setuptools/tests/test_virtualenv.py +113 -0
  34. .venv/lib/python3.12/site-packages/setuptools/tests/test_warnings.py +106 -0
  35. .venv/lib/python3.12/site-packages/setuptools/tests/test_wheel.py +714 -0
  36. .venv/lib/python3.12/site-packages/setuptools/tests/test_windows_wrappers.py +259 -0
  37. .venv/lib/python3.12/site-packages/setuptools/tests/text.py +4 -0
  38. .venv/lib/python3.12/site-packages/setuptools/tests/textwrap.py +6 -0
  39. .venv/lib/python3.12/site-packages/setuptools/unicode_utils.py +102 -0
  40. .venv/lib/python3.12/site-packages/setuptools/version.py +6 -0
  41. .venv/lib/python3.12/site-packages/setuptools/warnings.py +110 -0
  42. .venv/lib/python3.12/site-packages/setuptools/wheel.py +236 -0
  43. .venv/lib/python3.12/site-packages/setuptools/windows_support.py +30 -0
  44. .venv/lib/python3.12/site-packages/six-1.17.0.dist-info/INSTALLER +1 -0
  45. .venv/lib/python3.12/site-packages/six-1.17.0.dist-info/LICENSE +18 -0
  46. .venv/lib/python3.12/site-packages/six-1.17.0.dist-info/METADATA +43 -0
  47. .venv/lib/python3.12/site-packages/six-1.17.0.dist-info/RECORD +8 -0
  48. .venv/lib/python3.12/site-packages/six-1.17.0.dist-info/WHEEL +6 -0
  49. .venv/lib/python3.12/site-packages/six-1.17.0.dist-info/top_level.txt +1 -0
  50. .venv/lib/python3.12/site-packages/six.py +1003 -0
.gitattributes CHANGED
@@ -405,3 +405,30 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
405
  .venv/lib/python3.12/site-packages/setuptools/_vendor/more_itertools/__pycache__/more.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
406
  .venv/lib/python3.12/site-packages/setuptools/command/__pycache__/easy_install.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
407
  .venv/lib/python3.12/site-packages/setuptools/config/_validate_pyproject/__pycache__/fastjsonschema_validations.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
405
  .venv/lib/python3.12/site-packages/setuptools/_vendor/more_itertools/__pycache__/more.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
406
  .venv/lib/python3.12/site-packages/setuptools/command/__pycache__/easy_install.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
407
  .venv/lib/python3.12/site-packages/setuptools/config/_validate_pyproject/__pycache__/fastjsonschema_validations.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
408
+ .venv/lib/python3.12/site-packages/supervision/annotators/__pycache__/core.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
409
+ .venv/lib/python3.12/site-packages/supervision/detection/__pycache__/core.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
410
+ .venv/lib/python3.12/site-packages/sympy/assumptions/tests/__pycache__/test_query.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
411
+ .venv/lib/python3.12/site-packages/sympy/combinatorics/__pycache__/perm_groups.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
412
+ .venv/lib/python3.12/site-packages/sympy/combinatorics/__pycache__/permutations.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
413
+ .venv/lib/python3.12/site-packages/sympy/concrete/tests/__pycache__/test_sums_products.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
414
+ .venv/lib/python3.12/site-packages/sympy/core/__pycache__/expr.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
415
+ .venv/lib/python3.12/site-packages/sympy/core/__pycache__/function.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
416
+ .venv/lib/python3.12/site-packages/sympy/core/__pycache__/numbers.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
417
+ .venv/lib/python3.12/site-packages/sympy/core/tests/__pycache__/test_args.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
418
+ .venv/lib/python3.12/site-packages/sympy/core/tests/__pycache__/test_arit.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
419
+ .venv/lib/python3.12/site-packages/sympy/core/tests/__pycache__/test_expr.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
420
+ .venv/lib/python3.12/site-packages/sympy/core/tests/__pycache__/test_function.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
421
+ .venv/lib/python3.12/site-packages/sympy/core/tests/__pycache__/test_numbers.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
422
+ .venv/lib/python3.12/site-packages/sympy/core/tests/__pycache__/test_relational.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
423
+ .venv/lib/python3.12/site-packages/sympy/crypto/__pycache__/crypto.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
424
+ .venv/lib/python3.12/site-packages/sympy/functions/combinatorial/__pycache__/numbers.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
425
+ .venv/lib/python3.12/site-packages/sympy/functions/combinatorial/tests/__pycache__/test_comb_numbers.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
426
+ .venv/lib/python3.12/site-packages/sympy/functions/elementary/__pycache__/hyperbolic.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
427
+ .venv/lib/python3.12/site-packages/sympy/functions/elementary/__pycache__/trigonometric.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
428
+ .venv/lib/python3.12/site-packages/sympy/functions/elementary/tests/__pycache__/test_hyperbolic.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
429
+ .venv/lib/python3.12/site-packages/sympy/functions/elementary/tests/__pycache__/test_piecewise.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
430
+ .venv/lib/python3.12/site-packages/sympy/functions/elementary/tests/__pycache__/test_trigonometric.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
431
+ .venv/lib/python3.12/site-packages/sympy/functions/special/__pycache__/bessel.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
432
+ .venv/lib/python3.12/site-packages/sympy/functions/special/__pycache__/error_functions.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
433
+ .venv/lib/python3.12/site-packages/sympy/functions/special/tests/__pycache__/test_error_functions.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
434
+ .venv/lib/python3.12/site-packages/sympy/geometry/__pycache__/polygon.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
.venv/lib/python3.12/site-packages/setuptools-78.1.0.dist-info/INSTALLER ADDED
@@ -0,0 +1 @@
 
 
1
+ pip
.venv/lib/python3.12/site-packages/setuptools-78.1.0.dist-info/METADATA ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Metadata-Version: 2.4
2
+ Name: setuptools
3
+ Version: 78.1.0
4
+ Summary: Easily download, build, install, upgrade, and uninstall Python packages
5
+ Author-email: Python Packaging Authority <distutils-sig@python.org>
6
+ Project-URL: Source, https://github.com/pypa/setuptools
7
+ Project-URL: Documentation, https://setuptools.pypa.io/
8
+ Project-URL: Changelog, https://setuptools.pypa.io/en/stable/history.html
9
+ Keywords: CPAN PyPI distutils eggs package management
10
+ Classifier: Development Status :: 5 - Production/Stable
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3 :: Only
15
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
16
+ Classifier: Topic :: System :: Archiving :: Packaging
17
+ Classifier: Topic :: System :: Systems Administration
18
+ Classifier: Topic :: Utilities
19
+ Requires-Python: >=3.9
20
+ Description-Content-Type: text/x-rst
21
+ License-File: LICENSE
22
+ Provides-Extra: test
23
+ Requires-Dist: pytest!=8.1.*,>=6; extra == "test"
24
+ Requires-Dist: virtualenv>=13.0.0; extra == "test"
25
+ Requires-Dist: wheel>=0.44.0; extra == "test"
26
+ Requires-Dist: pip>=19.1; extra == "test"
27
+ Requires-Dist: packaging>=24.2; extra == "test"
28
+ Requires-Dist: jaraco.envs>=2.2; extra == "test"
29
+ Requires-Dist: pytest-xdist>=3; extra == "test"
30
+ Requires-Dist: jaraco.path>=3.7.2; extra == "test"
31
+ Requires-Dist: build[virtualenv]>=1.0.3; extra == "test"
32
+ Requires-Dist: filelock>=3.4.0; extra == "test"
33
+ Requires-Dist: ini2toml[lite]>=0.14; extra == "test"
34
+ Requires-Dist: tomli-w>=1.0.0; extra == "test"
35
+ Requires-Dist: pytest-timeout; extra == "test"
36
+ Requires-Dist: pytest-perf; sys_platform != "cygwin" and extra == "test"
37
+ Requires-Dist: jaraco.develop>=7.21; (python_version >= "3.9" and sys_platform != "cygwin") and extra == "test"
38
+ Requires-Dist: pytest-home>=0.5; extra == "test"
39
+ Requires-Dist: pytest-subprocess; extra == "test"
40
+ Requires-Dist: pyproject-hooks!=1.1; extra == "test"
41
+ Requires-Dist: jaraco.test>=5.5; extra == "test"
42
+ Provides-Extra: doc
43
+ Requires-Dist: sphinx>=3.5; extra == "doc"
44
+ Requires-Dist: jaraco.packaging>=9.3; extra == "doc"
45
+ Requires-Dist: rst.linker>=1.9; extra == "doc"
46
+ Requires-Dist: furo; extra == "doc"
47
+ Requires-Dist: sphinx-lint; extra == "doc"
48
+ Requires-Dist: jaraco.tidelift>=1.4; extra == "doc"
49
+ Requires-Dist: pygments-github-lexers==0.0.5; extra == "doc"
50
+ Requires-Dist: sphinx-favicon; extra == "doc"
51
+ Requires-Dist: sphinx-inline-tabs; extra == "doc"
52
+ Requires-Dist: sphinx-reredirects; extra == "doc"
53
+ Requires-Dist: sphinxcontrib-towncrier; extra == "doc"
54
+ Requires-Dist: sphinx-notfound-page<2,>=1; extra == "doc"
55
+ Requires-Dist: pyproject-hooks!=1.1; extra == "doc"
56
+ Requires-Dist: towncrier<24.7; extra == "doc"
57
+ Provides-Extra: ssl
58
+ Provides-Extra: certs
59
+ Provides-Extra: core
60
+ Requires-Dist: packaging>=24.2; extra == "core"
61
+ Requires-Dist: more_itertools>=8.8; extra == "core"
62
+ Requires-Dist: jaraco.text>=3.7; extra == "core"
63
+ Requires-Dist: importlib_metadata>=6; python_version < "3.10" and extra == "core"
64
+ Requires-Dist: tomli>=2.0.1; python_version < "3.11" and extra == "core"
65
+ Requires-Dist: wheel>=0.43.0; extra == "core"
66
+ Requires-Dist: platformdirs>=4.2.2; extra == "core"
67
+ Requires-Dist: jaraco.functools>=4; extra == "core"
68
+ Requires-Dist: more_itertools; extra == "core"
69
+ Provides-Extra: check
70
+ Requires-Dist: pytest-checkdocs>=2.4; extra == "check"
71
+ Requires-Dist: pytest-ruff>=0.2.1; sys_platform != "cygwin" and extra == "check"
72
+ Requires-Dist: ruff>=0.8.0; sys_platform != "cygwin" and extra == "check"
73
+ Provides-Extra: cover
74
+ Requires-Dist: pytest-cov; extra == "cover"
75
+ Provides-Extra: enabler
76
+ Requires-Dist: pytest-enabler>=2.2; extra == "enabler"
77
+ Provides-Extra: type
78
+ Requires-Dist: pytest-mypy; extra == "type"
79
+ Requires-Dist: mypy==1.14.*; extra == "type"
80
+ Requires-Dist: importlib_metadata>=7.0.2; python_version < "3.10" and extra == "type"
81
+ Requires-Dist: jaraco.develop>=7.21; sys_platform != "cygwin" and extra == "type"
82
+ Dynamic: license-file
83
+
84
+ .. |pypi-version| image:: https://img.shields.io/pypi/v/setuptools.svg
85
+ :target: https://pypi.org/project/setuptools
86
+
87
+ .. |py-version| image:: https://img.shields.io/pypi/pyversions/setuptools.svg
88
+
89
+ .. |test-badge| image:: https://github.com/pypa/setuptools/actions/workflows/main.yml/badge.svg
90
+ :target: https://github.com/pypa/setuptools/actions?query=workflow%3A%22tests%22
91
+ :alt: tests
92
+
93
+ .. |ruff-badge| image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json
94
+ :target: https://github.com/astral-sh/ruff
95
+ :alt: Ruff
96
+
97
+ .. |docs-badge| image:: https://img.shields.io/readthedocs/setuptools/latest.svg
98
+ :target: https://setuptools.pypa.io
99
+
100
+ .. |skeleton-badge| image:: https://img.shields.io/badge/skeleton-2025-informational
101
+ :target: https://blog.jaraco.com/skeleton
102
+
103
+ .. |codecov-badge| image:: https://img.shields.io/codecov/c/github/pypa/setuptools/master.svg?logo=codecov&logoColor=white
104
+ :target: https://codecov.io/gh/pypa/setuptools
105
+
106
+ .. |tidelift-badge| image:: https://tidelift.com/badges/github/pypa/setuptools?style=flat
107
+ :target: https://tidelift.com/subscription/pkg/pypi-setuptools?utm_source=pypi-setuptools&utm_medium=readme
108
+
109
+ .. |discord-badge| image:: https://img.shields.io/discord/803025117553754132
110
+ :target: https://discord.com/channels/803025117553754132/815945031150993468
111
+ :alt: Discord
112
+
113
+ |pypi-version| |py-version| |test-badge| |ruff-badge| |docs-badge| |skeleton-badge| |codecov-badge| |discord-badge|
114
+
115
+ See the `Quickstart <https://setuptools.pypa.io/en/latest/userguide/quickstart.html>`_
116
+ and the `User's Guide <https://setuptools.pypa.io/en/latest/userguide/>`_ for
117
+ instructions on how to use Setuptools.
118
+
119
+ Questions and comments should be directed to `GitHub Discussions
120
+ <https://github.com/pypa/setuptools/discussions>`_.
121
+ Bug reports and especially tested patches may be
122
+ submitted directly to the `bug tracker
123
+ <https://github.com/pypa/setuptools/issues>`_.
124
+
125
+
126
+ Code of Conduct
127
+ ===============
128
+
129
+ Everyone interacting in the setuptools project's codebases, issue trackers,
130
+ chat rooms, and fora is expected to follow the
131
+ `PSF Code of Conduct <https://github.com/pypa/.github/blob/main/CODE_OF_CONDUCT.md>`_.
132
+
133
+
134
+ For Enterprise
135
+ ==============
136
+
137
+ Available as part of the Tidelift Subscription.
138
+
139
+ Setuptools and the maintainers of thousands of other packages are working with Tidelift to deliver one enterprise subscription that covers all of the open source you use.
140
+
141
+ `Learn more <https://tidelift.com/subscription/pkg/pypi-setuptools?utm_source=pypi-setuptools&utm_medium=referral&utm_campaign=github>`_.
.venv/lib/python3.12/site-packages/setuptools-78.1.0.dist-info/RECORD ADDED
@@ -0,0 +1,872 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ _distutils_hack/__init__.py,sha256=34HmvLo07j45Uvd2VR-2aRQ7lJD91sTK6zJgn5fphbQ,6755
2
+ _distutils_hack/__pycache__/__init__.cpython-312.pyc,,
3
+ _distutils_hack/__pycache__/override.cpython-312.pyc,,
4
+ _distutils_hack/override.py,sha256=Eu_s-NF6VIZ4Cqd0tbbA5wtWky2IZPNd8et6GLt1mzo,44
5
+ distutils-precedence.pth,sha256=JjjOniUA5XKl4N5_rtZmHrVp0baW_LoHsN0iPaX10iQ,151
6
+ pkg_resources/__init__.py,sha256=-rh7XOnTxdGuC-_9FAyu5D6s8BL1UsBehxUtj7a-IVo,126203
7
+ pkg_resources/__pycache__/__init__.cpython-312.pyc,,
8
+ pkg_resources/api_tests.txt,sha256=XEdvy4igHHrq2qNHNMHnlfO6XSQKNqOyLHbl6QcpfAI,12595
9
+ pkg_resources/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
+ pkg_resources/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
+ pkg_resources/tests/__pycache__/__init__.cpython-312.pyc,,
12
+ pkg_resources/tests/__pycache__/test_find_distributions.cpython-312.pyc,,
13
+ pkg_resources/tests/__pycache__/test_integration_zope_interface.cpython-312.pyc,,
14
+ pkg_resources/tests/__pycache__/test_markers.cpython-312.pyc,,
15
+ pkg_resources/tests/__pycache__/test_pkg_resources.cpython-312.pyc,,
16
+ pkg_resources/tests/__pycache__/test_resources.cpython-312.pyc,,
17
+ pkg_resources/tests/__pycache__/test_working_set.cpython-312.pyc,,
18
+ pkg_resources/tests/data/my-test-package-source/__pycache__/setup.cpython-312.pyc,,
19
+ pkg_resources/tests/data/my-test-package-source/setup.cfg,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
+ pkg_resources/tests/data/my-test-package-source/setup.py,sha256=1VobhAZbMb7M9mfhb_NE8PwDsvukoWLs9aUAS0pYhe8,105
21
+ pkg_resources/tests/data/my-test-package-zip/my-test-package.zip,sha256=AYRcQ39GVePPnMT8TknP1gdDHyJnXhthESmpAjnzSCI,1809
22
+ pkg_resources/tests/data/my-test-package_unpacked-egg/my_test_package-1.0-py3.7.egg/EGG-INFO/PKG-INFO,sha256=JvWv9Io2PAuYwEEw2fBW4Qc5YvdbkscpKX1kmLzsoHk,187
23
+ pkg_resources/tests/data/my-test-package_unpacked-egg/my_test_package-1.0-py3.7.egg/EGG-INFO/SOURCES.txt,sha256=4ClkH8eTovZrdVrJFsVuxdbMEF--lBVSuKonDAPE5Jc,208
24
+ pkg_resources/tests/data/my-test-package_unpacked-egg/my_test_package-1.0-py3.7.egg/EGG-INFO/dependency_links.txt,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
25
+ pkg_resources/tests/data/my-test-package_unpacked-egg/my_test_package-1.0-py3.7.egg/EGG-INFO/top_level.txt,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
26
+ pkg_resources/tests/data/my-test-package_unpacked-egg/my_test_package-1.0-py3.7.egg/EGG-INFO/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
27
+ pkg_resources/tests/data/my-test-package_zipped-egg/my_test_package-1.0-py3.7.egg,sha256=ZTlMGxjRGiKDNkiA2c75jbQH2TWIteP00irF9gvczbo,843
28
+ pkg_resources/tests/test_find_distributions.py,sha256=U91cov5L1COAIWLNq3Xy4plU7_MnOE1WtXMu6iV2waM,1972
29
+ pkg_resources/tests/test_integration_zope_interface.py,sha256=nzVoK557KZQN0V3DIQ1sVeaCOgt4Kpl-CODAWsO7pmc,1652
30
+ pkg_resources/tests/test_markers.py,sha256=0orKg7UMDf7fnuNQvRMOc-EF9EAP_JTQnk4mtGgbW50,241
31
+ pkg_resources/tests/test_pkg_resources.py,sha256=5Mt4bJQhLCL8j8cC46Uv32Np2Xc1TTxLGawIfET55Fk,17111
32
+ pkg_resources/tests/test_resources.py,sha256=K0LqMAUGpRQ9pUb9K0vyI7GesvtlQvTH074m-E2VQlo,31252
33
+ pkg_resources/tests/test_working_set.py,sha256=lRtGJWIixSwSMSbjHgRxeJEQiLMRXcz3xzJL2qL7eXY,8602
34
+ setuptools-78.1.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
35
+ setuptools-78.1.0.dist-info/METADATA,sha256=RESmtUmo67AuFzn0N1r3dWyEH5bwwxB3oYMnPHRivRA,6599
36
+ setuptools-78.1.0.dist-info/RECORD,,
37
+ setuptools-78.1.0.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
38
+ setuptools-78.1.0.dist-info/entry_points.txt,sha256=zkgthpf_Fa9NVE9p6FKT3Xk9DR1faAcRU4coggsV7jA,2449
39
+ setuptools-78.1.0.dist-info/licenses/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023
40
+ setuptools-78.1.0.dist-info/top_level.txt,sha256=d9yL39v_W7qmKDDSH6sT4bE0j_Ls1M3P161OGgdsm4g,41
41
+ setuptools/__init__.py,sha256=AQsMeRFWz9CQ9aBtcSkbB4Dn8t2w86-GPriklpoAjew,10406
42
+ setuptools/__pycache__/__init__.cpython-312.pyc,,
43
+ setuptools/__pycache__/_core_metadata.cpython-312.pyc,,
44
+ setuptools/__pycache__/_entry_points.cpython-312.pyc,,
45
+ setuptools/__pycache__/_imp.cpython-312.pyc,,
46
+ setuptools/__pycache__/_importlib.cpython-312.pyc,,
47
+ setuptools/__pycache__/_itertools.cpython-312.pyc,,
48
+ setuptools/__pycache__/_normalization.cpython-312.pyc,,
49
+ setuptools/__pycache__/_path.cpython-312.pyc,,
50
+ setuptools/__pycache__/_reqs.cpython-312.pyc,,
51
+ setuptools/__pycache__/_shutil.cpython-312.pyc,,
52
+ setuptools/__pycache__/_static.cpython-312.pyc,,
53
+ setuptools/__pycache__/archive_util.cpython-312.pyc,,
54
+ setuptools/__pycache__/build_meta.cpython-312.pyc,,
55
+ setuptools/__pycache__/depends.cpython-312.pyc,,
56
+ setuptools/__pycache__/discovery.cpython-312.pyc,,
57
+ setuptools/__pycache__/dist.cpython-312.pyc,,
58
+ setuptools/__pycache__/errors.cpython-312.pyc,,
59
+ setuptools/__pycache__/extension.cpython-312.pyc,,
60
+ setuptools/__pycache__/glob.cpython-312.pyc,,
61
+ setuptools/__pycache__/installer.cpython-312.pyc,,
62
+ setuptools/__pycache__/launch.cpython-312.pyc,,
63
+ setuptools/__pycache__/logging.cpython-312.pyc,,
64
+ setuptools/__pycache__/modified.cpython-312.pyc,,
65
+ setuptools/__pycache__/monkey.cpython-312.pyc,,
66
+ setuptools/__pycache__/msvc.cpython-312.pyc,,
67
+ setuptools/__pycache__/namespaces.cpython-312.pyc,,
68
+ setuptools/__pycache__/package_index.cpython-312.pyc,,
69
+ setuptools/__pycache__/sandbox.cpython-312.pyc,,
70
+ setuptools/__pycache__/unicode_utils.cpython-312.pyc,,
71
+ setuptools/__pycache__/version.cpython-312.pyc,,
72
+ setuptools/__pycache__/warnings.cpython-312.pyc,,
73
+ setuptools/__pycache__/wheel.cpython-312.pyc,,
74
+ setuptools/__pycache__/windows_support.cpython-312.pyc,,
75
+ setuptools/_core_metadata.py,sha256=T7Tjp-WSoN881adev3R1wzXCPnkDHqbC2MgylN1yjS8,11978
76
+ setuptools/_distutils/__init__.py,sha256=xGYuhWwLG07J0Q49BVnEjPy6wyDcd6veJMDJX7ljlyM,359
77
+ setuptools/_distutils/__pycache__/__init__.cpython-312.pyc,,
78
+ setuptools/_distutils/__pycache__/_log.cpython-312.pyc,,
79
+ setuptools/_distutils/__pycache__/_macos_compat.cpython-312.pyc,,
80
+ setuptools/_distutils/__pycache__/_modified.cpython-312.pyc,,
81
+ setuptools/_distutils/__pycache__/_msvccompiler.cpython-312.pyc,,
82
+ setuptools/_distutils/__pycache__/archive_util.cpython-312.pyc,,
83
+ setuptools/_distutils/__pycache__/ccompiler.cpython-312.pyc,,
84
+ setuptools/_distutils/__pycache__/cmd.cpython-312.pyc,,
85
+ setuptools/_distutils/__pycache__/core.cpython-312.pyc,,
86
+ setuptools/_distutils/__pycache__/cygwinccompiler.cpython-312.pyc,,
87
+ setuptools/_distutils/__pycache__/debug.cpython-312.pyc,,
88
+ setuptools/_distutils/__pycache__/dep_util.cpython-312.pyc,,
89
+ setuptools/_distutils/__pycache__/dir_util.cpython-312.pyc,,
90
+ setuptools/_distutils/__pycache__/dist.cpython-312.pyc,,
91
+ setuptools/_distutils/__pycache__/errors.cpython-312.pyc,,
92
+ setuptools/_distutils/__pycache__/extension.cpython-312.pyc,,
93
+ setuptools/_distutils/__pycache__/fancy_getopt.cpython-312.pyc,,
94
+ setuptools/_distutils/__pycache__/file_util.cpython-312.pyc,,
95
+ setuptools/_distutils/__pycache__/filelist.cpython-312.pyc,,
96
+ setuptools/_distutils/__pycache__/log.cpython-312.pyc,,
97
+ setuptools/_distutils/__pycache__/spawn.cpython-312.pyc,,
98
+ setuptools/_distutils/__pycache__/sysconfig.cpython-312.pyc,,
99
+ setuptools/_distutils/__pycache__/text_file.cpython-312.pyc,,
100
+ setuptools/_distutils/__pycache__/unixccompiler.cpython-312.pyc,,
101
+ setuptools/_distutils/__pycache__/util.cpython-312.pyc,,
102
+ setuptools/_distutils/__pycache__/version.cpython-312.pyc,,
103
+ setuptools/_distutils/__pycache__/versionpredicate.cpython-312.pyc,,
104
+ setuptools/_distutils/__pycache__/zosccompiler.cpython-312.pyc,,
105
+ setuptools/_distutils/_log.py,sha256=i-lNTTcXS8TmWITJ6DODGvtW5z5tMattJQ76h8rZxQU,42
106
+ setuptools/_distutils/_macos_compat.py,sha256=JzUGhF4E5yIITHbUaPobZEWjGHdrrcNV63z86S4RjBc,239
107
+ setuptools/_distutils/_modified.py,sha256=RF1n1CexyDYV3lvGbeXS0s-XCJVboDOIUbA8wEQqYTY,3211
108
+ setuptools/_distutils/_msvccompiler.py,sha256=9PSfSHxvJnHnQL6Sqz4Xcz7iaBIT62p6BheQzGsSlwo,335
109
+ setuptools/_distutils/archive_util.py,sha256=Qw2z-Pt-NV8lNUQrzjs3XDGWCWHMPnqHLyt8TiD2XEA,8884
110
+ setuptools/_distutils/ccompiler.py,sha256=FKVjqzGJ7c-FtouNjhLiaMPm5LKMZHHAruXf8LU216c,524
111
+ setuptools/_distutils/cmd.py,sha256=hXtaRaH7QBnfNOIqEvCt47iwZzD9MVvBdhhdQctHsxM,22186
112
+ setuptools/_distutils/command/__init__.py,sha256=GfFAzbBqk1qxSH4BdaKioKS4hRRnD44BAmwEN85C4u8,386
113
+ setuptools/_distutils/command/__pycache__/__init__.cpython-312.pyc,,
114
+ setuptools/_distutils/command/__pycache__/_framework_compat.cpython-312.pyc,,
115
+ setuptools/_distutils/command/__pycache__/bdist.cpython-312.pyc,,
116
+ setuptools/_distutils/command/__pycache__/bdist_dumb.cpython-312.pyc,,
117
+ setuptools/_distutils/command/__pycache__/bdist_rpm.cpython-312.pyc,,
118
+ setuptools/_distutils/command/__pycache__/build.cpython-312.pyc,,
119
+ setuptools/_distutils/command/__pycache__/build_clib.cpython-312.pyc,,
120
+ setuptools/_distutils/command/__pycache__/build_ext.cpython-312.pyc,,
121
+ setuptools/_distutils/command/__pycache__/build_py.cpython-312.pyc,,
122
+ setuptools/_distutils/command/__pycache__/build_scripts.cpython-312.pyc,,
123
+ setuptools/_distutils/command/__pycache__/check.cpython-312.pyc,,
124
+ setuptools/_distutils/command/__pycache__/clean.cpython-312.pyc,,
125
+ setuptools/_distutils/command/__pycache__/config.cpython-312.pyc,,
126
+ setuptools/_distutils/command/__pycache__/install.cpython-312.pyc,,
127
+ setuptools/_distutils/command/__pycache__/install_data.cpython-312.pyc,,
128
+ setuptools/_distutils/command/__pycache__/install_egg_info.cpython-312.pyc,,
129
+ setuptools/_distutils/command/__pycache__/install_headers.cpython-312.pyc,,
130
+ setuptools/_distutils/command/__pycache__/install_lib.cpython-312.pyc,,
131
+ setuptools/_distutils/command/__pycache__/install_scripts.cpython-312.pyc,,
132
+ setuptools/_distutils/command/__pycache__/sdist.cpython-312.pyc,,
133
+ setuptools/_distutils/command/_framework_compat.py,sha256=0iZdSJYzGRWCCvzRDKE-R0-_yaAYvFMd1ylXb2eYXug,1609
134
+ setuptools/_distutils/command/bdist.py,sha256=jWtk61R7fWNUUNxJV0thTZzU5n80L3Ay1waSiP9kiLA,5854
135
+ setuptools/_distutils/command/bdist_dumb.py,sha256=Hx1jAqoZNxYIy4N5TLzUp6J5fi8Ls18py7UlLNFhO2E,4631
136
+ setuptools/_distutils/command/bdist_rpm.py,sha256=nxcXXv5a7B-1ntWu4DbGmCtES4EBINrJaBQcRNAYCJI,21785
137
+ setuptools/_distutils/command/build.py,sha256=SpHlagf0iNaKVyIhxDfhPFZ8X1-LAWOCQACy-yt2K0w,5923
138
+ setuptools/_distutils/command/build_clib.py,sha256=aMqZcUfCbOAu_xr-A9iW-Q9YZHzpDGLRTezOgMQJmSQ,7777
139
+ setuptools/_distutils/command/build_ext.py,sha256=zrrsu9HXnzV6bXYbJuZCK4SwVZMjKnl4pG1o3bNcxtc,32710
140
+ setuptools/_distutils/command/build_py.py,sha256=Vfq-INemoMbg6f003BTy_Ufp8bjOZhmFIhpKMcfXLgs,16696
141
+ setuptools/_distutils/command/build_scripts.py,sha256=tUpEzwTsnrP8qrNory3ldPB240QDCFkMp-pdYPs2wTk,5118
142
+ setuptools/_distutils/command/check.py,sha256=yoNe2MPY4JcTM7rwoIQdfZ75q5Ri058I2coi-Gq9CjM,4946
143
+ setuptools/_distutils/command/clean.py,sha256=dQAacOabwBXU9JoZ-1GFusq3eFltDaeXJFSYncqGbvE,2644
144
+ setuptools/_distutils/command/config.py,sha256=BuUdPu91Vo9w44xzD1RQfiyXfSfVcNpeX3aeoKcGAOw,12818
145
+ setuptools/_distutils/command/install.py,sha256=-JenB-mua4hc2RI_-W8F9PnP_J-OaFO7E0PJGKxLo1o,30072
146
+ setuptools/_distutils/command/install_data.py,sha256=GzBlUWWKubTYJlP-L0auUriq9cL-5RKOcoyHTttKj0Q,2875
147
+ setuptools/_distutils/command/install_egg_info.py,sha256=ffiLoU1ivQJ8q2_WL7ZygZbUcOsgdFLKL7otEIJWWkI,2868
148
+ setuptools/_distutils/command/install_headers.py,sha256=5ciKCj8c3XKsYNKdkdMvnypaUCKcoWCDeeZij3fD-Z4,1272
149
+ setuptools/_distutils/command/install_lib.py,sha256=2s9-m5-b1qKm51F28lB5L39Z6vv_GHMlv9dNBSupok0,8588
150
+ setuptools/_distutils/command/install_scripts.py,sha256=M0pPdiaqB7TGmqTMujpGGeiL0Iq_CTeGjMFtrmDmwzM,2002
151
+ setuptools/_distutils/command/sdist.py,sha256=cRIF6Ht1hJ6ayOOFVycMFBUNxjo94e_rFYPx4Hi8Ahc,19151
152
+ setuptools/_distutils/compat/__init__.py,sha256=J20aXGjJ86Rg41xFLIWlcWCgZ9edMdJ9vvdNEQ87vPQ,522
153
+ setuptools/_distutils/compat/__pycache__/__init__.cpython-312.pyc,,
154
+ setuptools/_distutils/compat/__pycache__/numpy.cpython-312.pyc,,
155
+ setuptools/_distutils/compat/__pycache__/py39.cpython-312.pyc,,
156
+ setuptools/_distutils/compat/numpy.py,sha256=UFgneZw9w97g4c-yGoAIOyLxUOWQ-fPRIhhfMs7_Ouc,167
157
+ setuptools/_distutils/compat/py39.py,sha256=hOsD6lwZLqZoMnacNJ3P6nUA-LJQhEpVtYTzVH0o96M,1964
158
+ setuptools/_distutils/compilers/C/__pycache__/base.cpython-312.pyc,,
159
+ setuptools/_distutils/compilers/C/__pycache__/cygwin.cpython-312.pyc,,
160
+ setuptools/_distutils/compilers/C/__pycache__/errors.cpython-312.pyc,,
161
+ setuptools/_distutils/compilers/C/__pycache__/msvc.cpython-312.pyc,,
162
+ setuptools/_distutils/compilers/C/__pycache__/unix.cpython-312.pyc,,
163
+ setuptools/_distutils/compilers/C/__pycache__/zos.cpython-312.pyc,,
164
+ setuptools/_distutils/compilers/C/base.py,sha256=XR1rBCStCquqm7QOYXD41-LfvsFcPpGxrwxeXzJyn_w,54876
165
+ setuptools/_distutils/compilers/C/cygwin.py,sha256=DUlwQSb55aj7OdcmcddrmCmVEjEaxIiJ5hHUO3GBPNs,11844
166
+ setuptools/_distutils/compilers/C/errors.py,sha256=sKOVzJajMUmNdfywo9UM_QQGsKFcclDhtI5TlCiXMLc,573
167
+ setuptools/_distutils/compilers/C/msvc.py,sha256=elzG8v9jN5QytLMwLCdUdSuZ3eZ3R98VUvnm9Y2PBCA,21404
168
+ setuptools/_distutils/compilers/C/tests/__pycache__/test_base.cpython-312.pyc,,
169
+ setuptools/_distutils/compilers/C/tests/__pycache__/test_cygwin.cpython-312.pyc,,
170
+ setuptools/_distutils/compilers/C/tests/__pycache__/test_mingw.cpython-312.pyc,,
171
+ setuptools/_distutils/compilers/C/tests/__pycache__/test_msvc.cpython-312.pyc,,
172
+ setuptools/_distutils/compilers/C/tests/__pycache__/test_unix.cpython-312.pyc,,
173
+ setuptools/_distutils/compilers/C/tests/test_base.py,sha256=rdhHc56bhXtm5NnN9BSHwr6c69UqzMItZQzlw2AsdMc,2706
174
+ setuptools/_distutils/compilers/C/tests/test_cygwin.py,sha256=UgV2VgUXj3VulcbDc0UBWfEyJDx42tgSwS4LzHix3mY,2701
175
+ setuptools/_distutils/compilers/C/tests/test_mingw.py,sha256=hCmwyywISpRoyOySbFHBL4TprWRV0mUWDKmOLO8XBXE,1900
176
+ setuptools/_distutils/compilers/C/tests/test_msvc.py,sha256=DlGjmZ1mBSMXIgmlu80BKc7V-EJOZuYucwJwFh5dn28,4151
177
+ setuptools/_distutils/compilers/C/tests/test_unix.py,sha256=ErbYWio7ejY2ZqQmPk4AwOu1HFW4-_-aZdUvGa1W2Fw,11834
178
+ setuptools/_distutils/compilers/C/unix.py,sha256=l7CxY4rDJAECJo-vcv6io0SBmmPJ9JmN5mSmZcin2VU,16502
179
+ setuptools/_distutils/compilers/C/zos.py,sha256=vnNeWLRZkdIkdZ-YyBnL8idTUfcCOn0tLMW5OBJ0ScU,6586
180
+ setuptools/_distutils/core.py,sha256=GEHKaFC48T3o-_SmH4864GvKyx1IgbVC6ISIPVlx7a4,9364
181
+ setuptools/_distutils/cygwinccompiler.py,sha256=mG_cU8SVZ4amD_VtF5vH6BXP0-kghGsDPbDSXrQ963c,594
182
+ setuptools/_distutils/debug.py,sha256=N6MrTAqK6l9SVk6tWweR108PM8Ol7qNlfyV-nHcLhsY,139
183
+ setuptools/_distutils/dep_util.py,sha256=xN75p6ZpHhMiHEc-rpL2XilJQynHnDNiafHteaZ4tjU,349
184
+ setuptools/_distutils/dir_util.py,sha256=DXPUlfVVGsg9B-Jgg4At_j9T7vM60OgwNXkQHqTo7-I,7236
185
+ setuptools/_distutils/dist.py,sha256=gW598UE0WMkzXQQ31Nr-8L7MPw0oIOz5OSSRzYZlwrM,55794
186
+ setuptools/_distutils/errors.py,sha256=PPE2oDRh5y9Q1beKK9rhdvDaCzQhi4HCXs4KcqfqgZY,3092
187
+ setuptools/_distutils/extension.py,sha256=Foyu4gULcPqm1_U9zrYYHxNk4NqglXv1rbsOk_QrSds,11155
188
+ setuptools/_distutils/fancy_getopt.py,sha256=PjdO-bWCW0imV_UN-MGEw9R2GP2OiE8pHjITgmTAY3Q,17895
189
+ setuptools/_distutils/file_util.py,sha256=YFQL_pD3hLuER9II_H6-hDC_YIGEookdd4wedLuiTW0,7978
190
+ setuptools/_distutils/filelist.py,sha256=MBeSRJmPcKmDv8ooZgSU4BiQPZ0Khwv8l_jhD50XycI,15337
191
+ setuptools/_distutils/log.py,sha256=VyBs5j7z4-K6XTEEBThUc9HyMpoPLGtQpERqbz5ylww,1200
192
+ setuptools/_distutils/spawn.py,sha256=zseCh9sEifyp0I5Vg719JNIASlROJ2ehXqQnHlpt89Q,4086
193
+ setuptools/_distutils/sysconfig.py,sha256=KeI8OHbMuEzHJ8Q0cBez9KZny8iRy6Z6Y0AkMz1jlsU,19728
194
+ setuptools/_distutils/tests/__init__.py,sha256=j-IoPZEtQv3EOPuqNTwalr6GLyRjzCC-OOaNvZzmHsI,1485
195
+ setuptools/_distutils/tests/__pycache__/__init__.cpython-312.pyc,,
196
+ setuptools/_distutils/tests/__pycache__/support.cpython-312.pyc,,
197
+ setuptools/_distutils/tests/__pycache__/test_archive_util.cpython-312.pyc,,
198
+ setuptools/_distutils/tests/__pycache__/test_bdist.cpython-312.pyc,,
199
+ setuptools/_distutils/tests/__pycache__/test_bdist_dumb.cpython-312.pyc,,
200
+ setuptools/_distutils/tests/__pycache__/test_bdist_rpm.cpython-312.pyc,,
201
+ setuptools/_distutils/tests/__pycache__/test_build.cpython-312.pyc,,
202
+ setuptools/_distutils/tests/__pycache__/test_build_clib.cpython-312.pyc,,
203
+ setuptools/_distutils/tests/__pycache__/test_build_ext.cpython-312.pyc,,
204
+ setuptools/_distutils/tests/__pycache__/test_build_py.cpython-312.pyc,,
205
+ setuptools/_distutils/tests/__pycache__/test_build_scripts.cpython-312.pyc,,
206
+ setuptools/_distutils/tests/__pycache__/test_check.cpython-312.pyc,,
207
+ setuptools/_distutils/tests/__pycache__/test_clean.cpython-312.pyc,,
208
+ setuptools/_distutils/tests/__pycache__/test_cmd.cpython-312.pyc,,
209
+ setuptools/_distutils/tests/__pycache__/test_config_cmd.cpython-312.pyc,,
210
+ setuptools/_distutils/tests/__pycache__/test_core.cpython-312.pyc,,
211
+ setuptools/_distutils/tests/__pycache__/test_dir_util.cpython-312.pyc,,
212
+ setuptools/_distutils/tests/__pycache__/test_dist.cpython-312.pyc,,
213
+ setuptools/_distutils/tests/__pycache__/test_extension.cpython-312.pyc,,
214
+ setuptools/_distutils/tests/__pycache__/test_file_util.cpython-312.pyc,,
215
+ setuptools/_distutils/tests/__pycache__/test_filelist.cpython-312.pyc,,
216
+ setuptools/_distutils/tests/__pycache__/test_install.cpython-312.pyc,,
217
+ setuptools/_distutils/tests/__pycache__/test_install_data.cpython-312.pyc,,
218
+ setuptools/_distutils/tests/__pycache__/test_install_headers.cpython-312.pyc,,
219
+ setuptools/_distutils/tests/__pycache__/test_install_lib.cpython-312.pyc,,
220
+ setuptools/_distutils/tests/__pycache__/test_install_scripts.cpython-312.pyc,,
221
+ setuptools/_distutils/tests/__pycache__/test_log.cpython-312.pyc,,
222
+ setuptools/_distutils/tests/__pycache__/test_modified.cpython-312.pyc,,
223
+ setuptools/_distutils/tests/__pycache__/test_sdist.cpython-312.pyc,,
224
+ setuptools/_distutils/tests/__pycache__/test_spawn.cpython-312.pyc,,
225
+ setuptools/_distutils/tests/__pycache__/test_sysconfig.cpython-312.pyc,,
226
+ setuptools/_distutils/tests/__pycache__/test_text_file.cpython-312.pyc,,
227
+ setuptools/_distutils/tests/__pycache__/test_util.cpython-312.pyc,,
228
+ setuptools/_distutils/tests/__pycache__/test_version.cpython-312.pyc,,
229
+ setuptools/_distutils/tests/__pycache__/test_versionpredicate.cpython-312.pyc,,
230
+ setuptools/_distutils/tests/__pycache__/unix_compat.cpython-312.pyc,,
231
+ setuptools/_distutils/tests/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
232
+ setuptools/_distutils/tests/compat/__pycache__/__init__.cpython-312.pyc,,
233
+ setuptools/_distutils/tests/compat/__pycache__/py39.cpython-312.pyc,,
234
+ setuptools/_distutils/tests/compat/py39.py,sha256=t0GBTM-30jX-9zCfkwlNBFtzzabemx6065mJ0d9_VRw,1026
235
+ setuptools/_distutils/tests/support.py,sha256=tjsYsyxvpTK4NrkCseh2ujvDIGV0Mf_b5SI5fP2T0yM,4099
236
+ setuptools/_distutils/tests/test_archive_util.py,sha256=jozimSwPBF-JoJfN_vDaiVGZp66BNcWZGh34FlW57DQ,11787
237
+ setuptools/_distutils/tests/test_bdist.py,sha256=xNHxUsLlHsZQRwkzLb_iSD24s-9Mk-NX2ffBWwOyPyc,1396
238
+ setuptools/_distutils/tests/test_bdist_dumb.py,sha256=QF05MHNhPOdZyh88Xpw8KsO64s7pRFkl8KL-RoV4XK0,2247
239
+ setuptools/_distutils/tests/test_bdist_rpm.py,sha256=Hdm-pwWgyaoGdGbEcGZa8cRhGU45y8gHK8umOanTjik,3932
240
+ setuptools/_distutils/tests/test_build.py,sha256=JJY5XpOZco25ZY0pstxl-iI8mHsWP0ujf5o8aOtuZYY,1742
241
+ setuptools/_distutils/tests/test_build_clib.py,sha256=Mo1ZFb4C1VXBYOGvnallwN7YCnTtr24akLDO8Zi4CsY,4331
242
+ setuptools/_distutils/tests/test_build_ext.py,sha256=QFO9qYVhWWdJu17HXc4x9RMnLZlhk0lAHi9HVppbuX4,22545
243
+ setuptools/_distutils/tests/test_build_py.py,sha256=NsfmRrojOHBXNMqWR_mp5g4PLTgjhD7iZFUffGZFIdw,6882
244
+ setuptools/_distutils/tests/test_build_scripts.py,sha256=cD-FRy-oX55sXRX5Ez5xQCaeHrWajyKc4Xuwv2fe48w,2880
245
+ setuptools/_distutils/tests/test_check.py,sha256=hHSV07qf7YoSxGsTbbsUQ9tssZz5RRNdbrY1s2SwaFI,6226
246
+ setuptools/_distutils/tests/test_clean.py,sha256=hPH6jfIpGFUrvWbF1txkiNVSNaAxt2wq5XjV499zO4E,1240
247
+ setuptools/_distutils/tests/test_cmd.py,sha256=bgRB79mitoOKR1OiyZHnCogvGxt3pWkxeTqIC04lQWQ,3254
248
+ setuptools/_distutils/tests/test_config_cmd.py,sha256=Zs6WX0IfxDvmuC19XzuVNnYCnTr9Y-hl73TAmDSBN4Y,2664
249
+ setuptools/_distutils/tests/test_core.py,sha256=L7XKVAxa-MGoAZeANopnuK9fRKneYhkSQpgw8XQvcF8,3829
250
+ setuptools/_distutils/tests/test_dir_util.py,sha256=E84lC-k4riVUwURyWaQ0Jqx2ui2-io-0RuJa3M7qkJs,4500
251
+ setuptools/_distutils/tests/test_dist.py,sha256=a6wlc5fQJd5qQ6HOndzcupNhjTxvj6-_JLtpuYvaP1M,18793
252
+ setuptools/_distutils/tests/test_extension.py,sha256=-YejLgZCuycFrOBd64pVH0JvwMc9NwhzHvQxvvjXHqk,3670
253
+ setuptools/_distutils/tests/test_file_util.py,sha256=livjnl3FkilQlrB2rFdFQq9nvjEVZHynNya0bfzv_b4,3522
254
+ setuptools/_distutils/tests/test_filelist.py,sha256=rJwkqCUfkGDgWlD22TozsT8ycbupMHB8DXqThzwT1T4,10766
255
+ setuptools/_distutils/tests/test_install.py,sha256=TfCB0ykhIxydIC2Q4SuTAZzSHvteMHgrBL9whoSgK9Q,8618
256
+ setuptools/_distutils/tests/test_install_data.py,sha256=vKq3K97k0hBAnOg38nmwEdf7cEDVr9rTVyCeJolgb4A,2464
257
+ setuptools/_distutils/tests/test_install_headers.py,sha256=PVAYpo_tYl980Qf64DPOmmSvyefIHdU06f7VsJeZykE,936
258
+ setuptools/_distutils/tests/test_install_lib.py,sha256=qri6Rl-maNTQrNDV8DbeXNl0hjsfRIKiI4rfZLrmWBI,3612
259
+ setuptools/_distutils/tests/test_install_scripts.py,sha256=KE3v0cDkFW-90IOID-OmZZGM2mhy-ZkEuuW7UXS2SHw,1600
260
+ setuptools/_distutils/tests/test_log.py,sha256=isFtOufloCyEdZaQOV7cVUr46GwtdVMj43mGBB5XH7k,323
261
+ setuptools/_distutils/tests/test_modified.py,sha256=h1--bOWmtJo1bpVV6uRhdnS9br71CBiNDM1MDwSGpug,4221
262
+ setuptools/_distutils/tests/test_sdist.py,sha256=cfzUhlCA418-1vH9ta3IBs26c_jUBbkJoFOK5GnAyNk,15062
263
+ setuptools/_distutils/tests/test_spawn.py,sha256=eS8w9D7bTxyFLSyRahJWeuh8Kc1F8RWWiY_dSG5B5Bc,4803
264
+ setuptools/_distutils/tests/test_sysconfig.py,sha256=lxM8LsUi1TomjDV4HoYK8u5nUoBkeNL60Uq8PY1DcwU,11986
265
+ setuptools/_distutils/tests/test_text_file.py,sha256=WQWSB5AfdBDZaMA8BFgipJPnsJb_2SKMfL90fSkRVtw,3460
266
+ setuptools/_distutils/tests/test_util.py,sha256=H9zlZ4z4Vh4TfjNYDBsxP7wguQLpxCfJYyOcm1yZU3c,7988
267
+ setuptools/_distutils/tests/test_version.py,sha256=ahfg_mP8wRy1sgwY-_Px5hrjgf6_upTIpnCgpR4yWRk,2750
268
+ setuptools/_distutils/tests/test_versionpredicate.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
269
+ setuptools/_distutils/tests/unix_compat.py,sha256=z-op6C2iVdX1aq5BIBR7cqOxijKE97alNwJqHNdLpoI,386
270
+ setuptools/_distutils/text_file.py,sha256=z4dkOJBr9Bo2LG0TNqm8sD63LEEaKSSP0J0bWBrFG3c,12101
271
+ setuptools/_distutils/unixccompiler.py,sha256=1bXJWH4fiu_A2WfriHzf88xjllQTXnnjUkZdRKs9cWU,212
272
+ setuptools/_distutils/util.py,sha256=Njfnqk60zMdkiAjRnGcTWX3t49-obHapOlbNvyIl02I,18094
273
+ setuptools/_distutils/version.py,sha256=vImT5-ECXkQ21oKL0XYFiTqK6NyM09cpzBNoA_34CQU,12619
274
+ setuptools/_distutils/versionpredicate.py,sha256=qBWQ6wTj12ODytoTmIydefIY2jb4uY1sdbgbuLn-IJM,5205
275
+ setuptools/_distutils/zosccompiler.py,sha256=svdiXZ2kdcwKrJKfhUhib03y8gz7aGZKukXH3I7YkBc,58
276
+ setuptools/_entry_points.py,sha256=Y3QUE9JKFW_YyquDnpffNWSs6f3jKEt1e-dnx--9-Kw,2310
277
+ setuptools/_imp.py,sha256=YY1EjZEN-0zYci1cxO10B_adAEOr7i8eK8JoCc9Ierc,2435
278
+ setuptools/_importlib.py,sha256=aKIjcK0HKXNz2D-XTrxaixGn_juTkONwmu3dcheMOF0,223
279
+ setuptools/_itertools.py,sha256=jWRfsIrpC7myooz3hDURj9GtvpswZeKXg2HakmEhNjo,657
280
+ setuptools/_normalization.py,sha256=kAmGfrwjF5djydEfLLyKgjkXCbL_0_ZxUPO-DlLlmIY,5824
281
+ setuptools/_path.py,sha256=cPv41v03HD7uEYqCIo-E_cGRfpPVr4lywBCiK-HSrCg,2685
282
+ setuptools/_reqs.py,sha256=QI3C9uOBSNRccu208qPnixHx51nxCry7_nPTIJaSYxM,1438
283
+ setuptools/_shutil.py,sha256=cAOllcoyMTXs5JLoybQi29yI5gABk82hepJyOBv2bMw,1496
284
+ setuptools/_static.py,sha256=GTR79gESF1_JaK4trLkpDrEuCeEtPlwQW0MRv7VNQX4,4855
285
+ setuptools/_vendor/__pycache__/typing_extensions.cpython-312.pyc,,
286
+ setuptools/_vendor/autocommand-2.2.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
287
+ setuptools/_vendor/autocommand-2.2.2.dist-info/LICENSE,sha256=reeNBJgtaZctREqOFKlPh6IzTdOFXMgDSOqOJAqg3y0,7634
288
+ setuptools/_vendor/autocommand-2.2.2.dist-info/METADATA,sha256=OADZuR3O6iBlpu1ieTgzYul6w4uOVrk0P0BO5TGGAJk,15006
289
+ setuptools/_vendor/autocommand-2.2.2.dist-info/RECORD,sha256=giu6ZrQVJvpUcYa4AiH4XaUNZSvuVJPb_l0UCFES8MM,1308
290
+ setuptools/_vendor/autocommand-2.2.2.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
291
+ setuptools/_vendor/autocommand-2.2.2.dist-info/top_level.txt,sha256=AzfhgKKS8EdAwWUTSF8mgeVQbXOY9kokHB6kSqwwqu0,12
292
+ setuptools/_vendor/autocommand/__init__.py,sha256=zko5Rnvolvb-UXjCx_2ArPTGBWwUK5QY4LIQIKYR7As,1037
293
+ setuptools/_vendor/autocommand/__pycache__/__init__.cpython-312.pyc,,
294
+ setuptools/_vendor/autocommand/__pycache__/autoasync.cpython-312.pyc,,
295
+ setuptools/_vendor/autocommand/__pycache__/autocommand.cpython-312.pyc,,
296
+ setuptools/_vendor/autocommand/__pycache__/automain.cpython-312.pyc,,
297
+ setuptools/_vendor/autocommand/__pycache__/autoparse.cpython-312.pyc,,
298
+ setuptools/_vendor/autocommand/__pycache__/errors.cpython-312.pyc,,
299
+ setuptools/_vendor/autocommand/autoasync.py,sha256=AMdyrxNS4pqWJfP_xuoOcImOHWD-qT7x06wmKN1Vp-U,5680
300
+ setuptools/_vendor/autocommand/autocommand.py,sha256=hmkEmQ72HtL55gnURVjDOnsfYlGd5lLXbvT4KG496Qw,2505
301
+ setuptools/_vendor/autocommand/automain.py,sha256=A2b8i754Mxc_DjU9WFr6vqYDWlhz0cn8miu8d8EsxV8,2076
302
+ setuptools/_vendor/autocommand/autoparse.py,sha256=WVWmZJPcbzUKXP40raQw_0HD8qPJ2V9VG1eFFmmnFxw,11642
303
+ setuptools/_vendor/autocommand/errors.py,sha256=7aa3roh9Herd6nIKpQHNWEslWE8oq7GiHYVUuRqORnA,886
304
+ setuptools/_vendor/backports.tarfile-1.2.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
305
+ setuptools/_vendor/backports.tarfile-1.2.0.dist-info/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023
306
+ setuptools/_vendor/backports.tarfile-1.2.0.dist-info/METADATA,sha256=ghXFTq132dxaEIolxr3HK1mZqm9iyUmaRANZQSr6WlE,2020
307
+ setuptools/_vendor/backports.tarfile-1.2.0.dist-info/RECORD,sha256=JYofHISeEXUGmlWl1s41ev3QTjTNXeJwk-Ss7HqdLOE,1360
308
+ setuptools/_vendor/backports.tarfile-1.2.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
309
+ setuptools/_vendor/backports.tarfile-1.2.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
310
+ setuptools/_vendor/backports.tarfile-1.2.0.dist-info/top_level.txt,sha256=cGjaLMOoBR1FK0ApojtzWVmViTtJ7JGIK_HwXiEsvtU,10
311
+ setuptools/_vendor/backports/__init__.py,sha256=iOEMwnlORWezdO8-2vxBIPSR37D7JGjluZ8f55vzxls,81
312
+ setuptools/_vendor/backports/__pycache__/__init__.cpython-312.pyc,,
313
+ setuptools/_vendor/backports/tarfile/__init__.py,sha256=Pwf2qUIfB0SolJPCKcx3vz3UEu_aids4g4sAfxy94qg,108491
314
+ setuptools/_vendor/backports/tarfile/__main__.py,sha256=Yw2oGT1afrz2eBskzdPYL8ReB_3liApmhFkN2EbDmc4,59
315
+ setuptools/_vendor/backports/tarfile/__pycache__/__init__.cpython-312.pyc,,
316
+ setuptools/_vendor/backports/tarfile/__pycache__/__main__.cpython-312.pyc,,
317
+ setuptools/_vendor/backports/tarfile/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
318
+ setuptools/_vendor/backports/tarfile/compat/__pycache__/__init__.cpython-312.pyc,,
319
+ setuptools/_vendor/backports/tarfile/compat/__pycache__/py38.cpython-312.pyc,,
320
+ setuptools/_vendor/backports/tarfile/compat/py38.py,sha256=iYkyt_gvWjLzGUTJD9TuTfMMjOk-ersXZmRlvQYN2qE,568
321
+ setuptools/_vendor/importlib_metadata-8.0.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
322
+ setuptools/_vendor/importlib_metadata-8.0.0.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
323
+ setuptools/_vendor/importlib_metadata-8.0.0.dist-info/METADATA,sha256=anuQ7_7h4J1bSEzfcjIBakPi2cyVQ7y7jklLHsBeH1k,4648
324
+ setuptools/_vendor/importlib_metadata-8.0.0.dist-info/RECORD,sha256=DY08buueu-hsrH1ghhVSQzwynanqUSSLYdAr4uXmQDA,2518
325
+ setuptools/_vendor/importlib_metadata-8.0.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
326
+ setuptools/_vendor/importlib_metadata-8.0.0.dist-info/WHEEL,sha256=mguMlWGMX-VHnMpKOjjQidIo1ssRlCFu4a4mBpz1s2M,91
327
+ setuptools/_vendor/importlib_metadata-8.0.0.dist-info/top_level.txt,sha256=CO3fD9yylANiXkrMo4qHLV_mqXL2sC5JFKgt1yWAT-A,19
328
+ setuptools/_vendor/importlib_metadata/__init__.py,sha256=tZNB-23h8Bixi9uCrQqj9Yf0aeC--Josdy3IZRIQeB0,33798
329
+ setuptools/_vendor/importlib_metadata/__pycache__/__init__.cpython-312.pyc,,
330
+ setuptools/_vendor/importlib_metadata/__pycache__/_adapters.cpython-312.pyc,,
331
+ setuptools/_vendor/importlib_metadata/__pycache__/_collections.cpython-312.pyc,,
332
+ setuptools/_vendor/importlib_metadata/__pycache__/_compat.cpython-312.pyc,,
333
+ setuptools/_vendor/importlib_metadata/__pycache__/_functools.cpython-312.pyc,,
334
+ setuptools/_vendor/importlib_metadata/__pycache__/_itertools.cpython-312.pyc,,
335
+ setuptools/_vendor/importlib_metadata/__pycache__/_meta.cpython-312.pyc,,
336
+ setuptools/_vendor/importlib_metadata/__pycache__/_text.cpython-312.pyc,,
337
+ setuptools/_vendor/importlib_metadata/__pycache__/diagnose.cpython-312.pyc,,
338
+ setuptools/_vendor/importlib_metadata/_adapters.py,sha256=rIhWTwBvYA1bV7i-5FfVX38qEXDTXFeS5cb5xJtP3ks,2317
339
+ setuptools/_vendor/importlib_metadata/_collections.py,sha256=CJ0OTCHIjWA0ZIVS4voORAsn2R4R2cQBEtPsZEJpASY,743
340
+ setuptools/_vendor/importlib_metadata/_compat.py,sha256=73QKrN9KNoaZzhbX5yPCCZa-FaALwXe8TPlDR72JgBU,1314
341
+ setuptools/_vendor/importlib_metadata/_functools.py,sha256=PsY2-4rrKX4RVeRC1oGp1lB1pmC9eKN88_f-bD9uOoA,2895
342
+ setuptools/_vendor/importlib_metadata/_itertools.py,sha256=cvr_2v8BRbxcIl5x5ldfqdHjhI8Yi8s8yk50G_nm6jQ,2068
343
+ setuptools/_vendor/importlib_metadata/_meta.py,sha256=nxZ7C8GVlcBFAKWyVOn_dn7ot_twBcbm1NmvjIetBHI,1801
344
+ setuptools/_vendor/importlib_metadata/_text.py,sha256=HCsFksZpJLeTP3NEk_ngrAeXVRRtTrtyh9eOABoRP4A,2166
345
+ setuptools/_vendor/importlib_metadata/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
346
+ setuptools/_vendor/importlib_metadata/compat/__pycache__/__init__.cpython-312.pyc,,
347
+ setuptools/_vendor/importlib_metadata/compat/__pycache__/py311.cpython-312.pyc,,
348
+ setuptools/_vendor/importlib_metadata/compat/__pycache__/py39.cpython-312.pyc,,
349
+ setuptools/_vendor/importlib_metadata/compat/py311.py,sha256=uqm-K-uohyj1042TH4a9Er_I5o7667DvulcD-gC_fSA,608
350
+ setuptools/_vendor/importlib_metadata/compat/py39.py,sha256=cPkMv6-0ilK-0Jw_Tkn0xYbOKJZc4WJKQHow0c2T44w,1102
351
+ setuptools/_vendor/importlib_metadata/diagnose.py,sha256=nkSRMiowlmkhLYhKhvCg9glmt_11Cox-EmLzEbqYTa8,379
352
+ setuptools/_vendor/importlib_metadata/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
353
+ setuptools/_vendor/inflect-7.3.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
354
+ setuptools/_vendor/inflect-7.3.1.dist-info/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023
355
+ setuptools/_vendor/inflect-7.3.1.dist-info/METADATA,sha256=ZgMNY0WAZRs-U8wZiV2SMfjSKqBrMngXyDMs_CAwMwg,21079
356
+ setuptools/_vendor/inflect-7.3.1.dist-info/RECORD,sha256=XXg0rBuiYSxoAQUP3lenuYsPNqz4jDwtTzdv2JEbMJE,943
357
+ setuptools/_vendor/inflect-7.3.1.dist-info/WHEEL,sha256=y4mX-SOX4fYIkonsAGA5N0Oy-8_gI4FXw5HNI1xqvWg,91
358
+ setuptools/_vendor/inflect-7.3.1.dist-info/top_level.txt,sha256=m52ujdp10CqT6jh1XQxZT6kEntcnv-7Tl7UiGNTzWZA,8
359
+ setuptools/_vendor/inflect/__init__.py,sha256=Jxy1HJXZiZ85kHeLAhkmvz6EMTdFqBe-duvt34R6IOc,103796
360
+ setuptools/_vendor/inflect/__pycache__/__init__.cpython-312.pyc,,
361
+ setuptools/_vendor/inflect/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
362
+ setuptools/_vendor/inflect/compat/__pycache__/__init__.cpython-312.pyc,,
363
+ setuptools/_vendor/inflect/compat/__pycache__/py38.cpython-312.pyc,,
364
+ setuptools/_vendor/inflect/compat/py38.py,sha256=oObVfVnWX9_OpnOuEJn1mFbJxVhwyR5epbiTNXDDaso,160
365
+ setuptools/_vendor/inflect/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
366
+ setuptools/_vendor/jaraco.collections-5.1.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
367
+ setuptools/_vendor/jaraco.collections-5.1.0.dist-info/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023
368
+ setuptools/_vendor/jaraco.collections-5.1.0.dist-info/METADATA,sha256=IMUaliNsA5X1Ox9MXUWOagch5R4Wwb_3M7erp29dBtg,3933
369
+ setuptools/_vendor/jaraco.collections-5.1.0.dist-info/RECORD,sha256=HptivXDkpfom6VlMu4CGD_7KPev-6Hc9rvp3TNJZygY,873
370
+ setuptools/_vendor/jaraco.collections-5.1.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
371
+ setuptools/_vendor/jaraco.collections-5.1.0.dist-info/WHEEL,sha256=Mdi9PDNwEZptOjTlUcAth7XJDFtKrHYaQMPulZeBCiQ,91
372
+ setuptools/_vendor/jaraco.collections-5.1.0.dist-info/top_level.txt,sha256=0JnN3LfXH4LIRfXL-QFOGCJzQWZO3ELx4R1d_louoQM,7
373
+ setuptools/_vendor/jaraco.context-5.3.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
374
+ setuptools/_vendor/jaraco.context-5.3.0.dist-info/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023
375
+ setuptools/_vendor/jaraco.context-5.3.0.dist-info/METADATA,sha256=xDtguJej0tN9iEXCUvxEJh2a7xceIRVBEakBLSr__tY,4020
376
+ setuptools/_vendor/jaraco.context-5.3.0.dist-info/RECORD,sha256=VRl7iKeEQyl7stgnp1uq50CzOJYlHYcoNdS0x17C9X4,641
377
+ setuptools/_vendor/jaraco.context-5.3.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
378
+ setuptools/_vendor/jaraco.context-5.3.0.dist-info/top_level.txt,sha256=0JnN3LfXH4LIRfXL-QFOGCJzQWZO3ELx4R1d_louoQM,7
379
+ setuptools/_vendor/jaraco.functools-4.0.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
380
+ setuptools/_vendor/jaraco.functools-4.0.1.dist-info/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023
381
+ setuptools/_vendor/jaraco.functools-4.0.1.dist-info/METADATA,sha256=i4aUaQDX-jjdEQK5wevhegyx8JyLfin2HyvaSk3FHso,2891
382
+ setuptools/_vendor/jaraco.functools-4.0.1.dist-info/RECORD,sha256=YyqnwE98S8wBwCevW5vHb-iVj0oYEDW5V6O9MBS6JIs,843
383
+ setuptools/_vendor/jaraco.functools-4.0.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
384
+ setuptools/_vendor/jaraco.functools-4.0.1.dist-info/top_level.txt,sha256=0JnN3LfXH4LIRfXL-QFOGCJzQWZO3ELx4R1d_louoQM,7
385
+ setuptools/_vendor/jaraco.text-3.12.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
386
+ setuptools/_vendor/jaraco.text-3.12.1.dist-info/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023
387
+ setuptools/_vendor/jaraco.text-3.12.1.dist-info/METADATA,sha256=AzWdm6ViMfDOPoQMfLWn2zgBQSGJScyqeN29TcuWXVI,3658
388
+ setuptools/_vendor/jaraco.text-3.12.1.dist-info/RECORD,sha256=gW2UV0HcokYJk4jKPu10_AZnrLqjb3C1WbJJTDl5sfY,1500
389
+ setuptools/_vendor/jaraco.text-3.12.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
390
+ setuptools/_vendor/jaraco.text-3.12.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
391
+ setuptools/_vendor/jaraco.text-3.12.1.dist-info/top_level.txt,sha256=0JnN3LfXH4LIRfXL-QFOGCJzQWZO3ELx4R1d_louoQM,7
392
+ setuptools/_vendor/jaraco/__pycache__/context.cpython-312.pyc,,
393
+ setuptools/_vendor/jaraco/collections/__init__.py,sha256=Pc1-SqjWm81ad1P0-GttpkwO_LWlnaY6gUq8gcKh2v0,26640
394
+ setuptools/_vendor/jaraco/collections/__pycache__/__init__.cpython-312.pyc,,
395
+ setuptools/_vendor/jaraco/collections/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
396
+ setuptools/_vendor/jaraco/context.py,sha256=REoLIxDkO5MfEYowt_WoupNCRoxBS5v7YX2PbW8lIcs,9552
397
+ setuptools/_vendor/jaraco/functools/__init__.py,sha256=hEAJaS2uSZRuF_JY4CxCHIYh79ZpxaPp9OiHyr9EJ1w,16642
398
+ setuptools/_vendor/jaraco/functools/__init__.pyi,sha256=gk3dsgHzo5F_U74HzAvpNivFAPCkPJ1b2-yCd62dfnw,3878
399
+ setuptools/_vendor/jaraco/functools/__pycache__/__init__.cpython-312.pyc,,
400
+ setuptools/_vendor/jaraco/functools/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
401
+ setuptools/_vendor/jaraco/text/Lorem ipsum.txt,sha256=N_7c_79zxOufBY9HZ3yzMgOkNv-TkOTTio4BydrSjgs,1335
402
+ setuptools/_vendor/jaraco/text/__init__.py,sha256=Y2YUqXR_orUoDaY4SkPRe6ZZhb5HUHB_Ah9RCNsVyho,16250
403
+ setuptools/_vendor/jaraco/text/__pycache__/__init__.cpython-312.pyc,,
404
+ setuptools/_vendor/jaraco/text/__pycache__/layouts.cpython-312.pyc,,
405
+ setuptools/_vendor/jaraco/text/__pycache__/show-newlines.cpython-312.pyc,,
406
+ setuptools/_vendor/jaraco/text/__pycache__/strip-prefix.cpython-312.pyc,,
407
+ setuptools/_vendor/jaraco/text/__pycache__/to-dvorak.cpython-312.pyc,,
408
+ setuptools/_vendor/jaraco/text/__pycache__/to-qwerty.cpython-312.pyc,,
409
+ setuptools/_vendor/jaraco/text/layouts.py,sha256=HTC8aSTLZ7uXipyOXapRMC158juecjK6RVwitfmZ9_w,643
410
+ setuptools/_vendor/jaraco/text/show-newlines.py,sha256=WGQa65e8lyhb92LUOLqVn6KaCtoeVgVws6WtSRmLk6w,904
411
+ setuptools/_vendor/jaraco/text/strip-prefix.py,sha256=NfVXV8JVNo6nqcuYASfMV7_y4Eo8zMQqlCOGvAnRIVw,412
412
+ setuptools/_vendor/jaraco/text/to-dvorak.py,sha256=1SNcbSsvISpXXg-LnybIHHY-RUFOQr36zcHkY1pWFqw,119
413
+ setuptools/_vendor/jaraco/text/to-qwerty.py,sha256=s4UMQUnPwFn_dB5uZC27BurHOQcYondBfzIpVL5pEzw,119
414
+ setuptools/_vendor/more_itertools-10.3.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
415
+ setuptools/_vendor/more_itertools-10.3.0.dist-info/LICENSE,sha256=CfHIyelBrz5YTVlkHqm4fYPAyw_QB-te85Gn4mQ8GkY,1053
416
+ setuptools/_vendor/more_itertools-10.3.0.dist-info/METADATA,sha256=BFO90O-fLNiVQMpj7oIS5ztzgJUUQZ3TA32P5HH3N-A,36293
417
+ setuptools/_vendor/more_itertools-10.3.0.dist-info/RECORD,sha256=d8jnPgGNwP1-ntbICwWkQEVF9kH7CFIgzkKzaLWao9M,1259
418
+ setuptools/_vendor/more_itertools-10.3.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
419
+ setuptools/_vendor/more_itertools-10.3.0.dist-info/WHEEL,sha256=rSgq_JpHF9fHR1lx53qwg_1-2LypZE_qmcuXbVUq948,81
420
+ setuptools/_vendor/more_itertools/__init__.py,sha256=dtAbGjTDmn_ghiU5YXfhyDy0phAlXVdt5klZA5fUa-Q,149
421
+ setuptools/_vendor/more_itertools/__init__.pyi,sha256=5B3eTzON1BBuOLob1vCflyEb2lSd6usXQQ-Cv-hXkeA,43
422
+ setuptools/_vendor/more_itertools/__pycache__/__init__.cpython-312.pyc,,
423
+ setuptools/_vendor/more_itertools/__pycache__/more.cpython-312.pyc,,
424
+ setuptools/_vendor/more_itertools/__pycache__/recipes.cpython-312.pyc,,
425
+ setuptools/_vendor/more_itertools/more.py,sha256=1E5kzFncRKTDw0cYv1yRXMgDdunstLQd1QStcnL6U90,148370
426
+ setuptools/_vendor/more_itertools/more.pyi,sha256=iXXeqt48Nxe8VGmIWpkVXuKpR2FYNuu2DU8nQLWCCu0,21484
427
+ setuptools/_vendor/more_itertools/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
428
+ setuptools/_vendor/more_itertools/recipes.py,sha256=WedhhfhGVgr6zii8fIbGJVmRTw0ZKRiLKnYBDGJv4nY,28591
429
+ setuptools/_vendor/more_itertools/recipes.pyi,sha256=T_mdGpcFdfrP3JSWbwzYP9JyNV-Go-7RPfpxfftAWlA,4617
430
+ setuptools/_vendor/packaging-24.2.dist-info/INSTALLER,sha256=5hhM4Q4mYTT9z6QB6PGpUAW81PGNFrYrdXMj4oM_6ak,2
431
+ setuptools/_vendor/packaging-24.2.dist-info/LICENSE,sha256=ytHvW9NA1z4HS6YU0m996spceUDD2MNIUuZcSQlobEg,197
432
+ setuptools/_vendor/packaging-24.2.dist-info/LICENSE.APACHE,sha256=DVQuDIgE45qn836wDaWnYhSdxoLXgpRRKH4RuTjpRZQ,10174
433
+ setuptools/_vendor/packaging-24.2.dist-info/LICENSE.BSD,sha256=tw5-m3QvHMb5SLNMFqo5_-zpQZY2S8iP8NIYDwAo-sU,1344
434
+ setuptools/_vendor/packaging-24.2.dist-info/METADATA,sha256=ohH86s6k5mIfQxY2TS0LcSfADeOFa4BiCC-bxZV-pNs,3204
435
+ setuptools/_vendor/packaging-24.2.dist-info/RECORD,sha256=Y4DrXM0KY0ArfzhbAEa1LYFPwW3WEgEeL4iCqXe-A-M,2009
436
+ setuptools/_vendor/packaging-24.2.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
437
+ setuptools/_vendor/packaging-24.2.dist-info/WHEEL,sha256=CpUCUxeHQbRN5UGRQHYRJorO5Af-Qy_fHMctcQ8DSGI,82
438
+ setuptools/_vendor/packaging/__init__.py,sha256=dk4Ta_vmdVJxYHDcfyhvQNw8V3PgSBomKNXqg-D2JDY,494
439
+ setuptools/_vendor/packaging/__pycache__/__init__.cpython-312.pyc,,
440
+ setuptools/_vendor/packaging/__pycache__/_elffile.cpython-312.pyc,,
441
+ setuptools/_vendor/packaging/__pycache__/_manylinux.cpython-312.pyc,,
442
+ setuptools/_vendor/packaging/__pycache__/_musllinux.cpython-312.pyc,,
443
+ setuptools/_vendor/packaging/__pycache__/_parser.cpython-312.pyc,,
444
+ setuptools/_vendor/packaging/__pycache__/_structures.cpython-312.pyc,,
445
+ setuptools/_vendor/packaging/__pycache__/_tokenizer.cpython-312.pyc,,
446
+ setuptools/_vendor/packaging/__pycache__/markers.cpython-312.pyc,,
447
+ setuptools/_vendor/packaging/__pycache__/metadata.cpython-312.pyc,,
448
+ setuptools/_vendor/packaging/__pycache__/requirements.cpython-312.pyc,,
449
+ setuptools/_vendor/packaging/__pycache__/specifiers.cpython-312.pyc,,
450
+ setuptools/_vendor/packaging/__pycache__/tags.cpython-312.pyc,,
451
+ setuptools/_vendor/packaging/__pycache__/utils.cpython-312.pyc,,
452
+ setuptools/_vendor/packaging/__pycache__/version.cpython-312.pyc,,
453
+ setuptools/_vendor/packaging/_elffile.py,sha256=cflAQAkE25tzhYmq_aCi72QfbT_tn891tPzfpbeHOwE,3306
454
+ setuptools/_vendor/packaging/_manylinux.py,sha256=vl5OCoz4kx80H5rwXKeXWjl9WNISGmr4ZgTpTP9lU9c,9612
455
+ setuptools/_vendor/packaging/_musllinux.py,sha256=p9ZqNYiOItGee8KcZFeHF_YcdhVwGHdK6r-8lgixvGQ,2694
456
+ setuptools/_vendor/packaging/_parser.py,sha256=s_TvTvDNK0NrM2QB3VKThdWFM4Nc0P6JnkObkl3MjpM,10236
457
+ setuptools/_vendor/packaging/_structures.py,sha256=q3eVNmbWJGG_S0Dit_S3Ao8qQqz_5PYTXFAKBZe5yr4,1431
458
+ setuptools/_vendor/packaging/_tokenizer.py,sha256=J6v5H7Jzvb-g81xp_2QACKwO7LxHQA6ikryMU7zXwN8,5273
459
+ setuptools/_vendor/packaging/licenses/__init__.py,sha256=1x5M1nEYjcgwEbLt0dXwz2ukjr18DiCzC0sraQqJ-Ww,5715
460
+ setuptools/_vendor/packaging/licenses/__pycache__/__init__.cpython-312.pyc,,
461
+ setuptools/_vendor/packaging/licenses/__pycache__/_spdx.cpython-312.pyc,,
462
+ setuptools/_vendor/packaging/licenses/_spdx.py,sha256=oAm1ztPFwlsmCKe7lAAsv_OIOfS1cWDu9bNBkeu-2ns,48398
463
+ setuptools/_vendor/packaging/markers.py,sha256=c89TNzB7ZdGYhkovm6PYmqGyHxXlYVaLW591PHUNKD8,10561
464
+ setuptools/_vendor/packaging/metadata.py,sha256=YJibM7GYe4re8-0a3OlXmGS-XDgTEoO4tlBt2q25Bng,34762
465
+ setuptools/_vendor/packaging/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
466
+ setuptools/_vendor/packaging/requirements.py,sha256=gYyRSAdbrIyKDY66ugIDUQjRMvxkH2ALioTmX3tnL6o,2947
467
+ setuptools/_vendor/packaging/specifiers.py,sha256=GG1wPNMcL0fMJO68vF53wKMdwnfehDcaI-r9NpTfilA,40074
468
+ setuptools/_vendor/packaging/tags.py,sha256=CFqrJzAzc2XNGexerH__T-Y5Iwq7WbsYXsiLERLWxY0,21014
469
+ setuptools/_vendor/packaging/utils.py,sha256=0F3Hh9OFuRgrhTgGZUl5K22Fv1YP2tZl1z_2gO6kJiA,5050
470
+ setuptools/_vendor/packaging/version.py,sha256=olfyuk_DPbflNkJ4wBWetXQ17c74x3DB501degUv7DY,16676
471
+ setuptools/_vendor/platformdirs-4.2.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
472
+ setuptools/_vendor/platformdirs-4.2.2.dist-info/METADATA,sha256=zmsie01G1MtXR0wgIv5XpVeTO7idr0WWvfmxKsKWuGk,11429
473
+ setuptools/_vendor/platformdirs-4.2.2.dist-info/RECORD,sha256=TCEddtQu1A78Os_Mhm2JEqcYr7yit-UYSUQjZtbpn-g,1642
474
+ setuptools/_vendor/platformdirs-4.2.2.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
475
+ setuptools/_vendor/platformdirs-4.2.2.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
476
+ setuptools/_vendor/platformdirs-4.2.2.dist-info/licenses/LICENSE,sha256=KeD9YukphQ6G6yjD_czwzv30-pSHkBHP-z0NS-1tTbY,1089
477
+ setuptools/_vendor/platformdirs/__init__.py,sha256=EMGE8qeHRR9CzDFr8kL3tA8hdZZniYjXBVZd0UGTWK0,22225
478
+ setuptools/_vendor/platformdirs/__main__.py,sha256=HnsUQHpiBaiTxwcmwVw-nFaPdVNZtQIdi1eWDtI-MzI,1493
479
+ setuptools/_vendor/platformdirs/__pycache__/__init__.cpython-312.pyc,,
480
+ setuptools/_vendor/platformdirs/__pycache__/__main__.cpython-312.pyc,,
481
+ setuptools/_vendor/platformdirs/__pycache__/android.cpython-312.pyc,,
482
+ setuptools/_vendor/platformdirs/__pycache__/api.cpython-312.pyc,,
483
+ setuptools/_vendor/platformdirs/__pycache__/macos.cpython-312.pyc,,
484
+ setuptools/_vendor/platformdirs/__pycache__/unix.cpython-312.pyc,,
485
+ setuptools/_vendor/platformdirs/__pycache__/version.cpython-312.pyc,,
486
+ setuptools/_vendor/platformdirs/__pycache__/windows.cpython-312.pyc,,
487
+ setuptools/_vendor/platformdirs/android.py,sha256=xZXY9Jd46WOsxT2U6-5HsNtDZ-IQqxcEUrBLl3hYk4o,9016
488
+ setuptools/_vendor/platformdirs/api.py,sha256=QBYdUac2eC521ek_y53uD1Dcq-lJX8IgSRVd4InC6uc,8996
489
+ setuptools/_vendor/platformdirs/macos.py,sha256=wftsbsvq6nZ0WORXSiCrZNkRHz_WKuktl0a6mC7MFkI,5580
490
+ setuptools/_vendor/platformdirs/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
491
+ setuptools/_vendor/platformdirs/unix.py,sha256=Cci9Wqt35dAMsg6HT9nRGHSBW5obb0pR3AE1JJnsCXg,10643
492
+ setuptools/_vendor/platformdirs/version.py,sha256=r7F76tZRjgQKzrpx_I0_ZMQOMU-PS7eGnHD7zEK3KB0,411
493
+ setuptools/_vendor/platformdirs/windows.py,sha256=IFpiohUBwxPtCzlyKwNtxyW4Jk8haa6W8o59mfrDXVo,10125
494
+ setuptools/_vendor/tomli-2.0.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
495
+ setuptools/_vendor/tomli-2.0.1.dist-info/LICENSE,sha256=uAgWsNUwuKzLTCIReDeQmEpuO2GSLCte6S8zcqsnQv4,1072
496
+ setuptools/_vendor/tomli-2.0.1.dist-info/METADATA,sha256=zPDceKmPwJGLWtZykrHixL7WVXWmJGzZ1jyRT5lCoPI,8875
497
+ setuptools/_vendor/tomli-2.0.1.dist-info/RECORD,sha256=DLn5pFGh42WsVLTIhmLh2gy1SnLRalJY-wq_-dPhwCI,999
498
+ setuptools/_vendor/tomli-2.0.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
499
+ setuptools/_vendor/tomli-2.0.1.dist-info/WHEEL,sha256=jPMR_Dzkc4X4icQtmz81lnNY_kAsfog7ry7qoRvYLXw,81
500
+ setuptools/_vendor/tomli/__init__.py,sha256=JhUwV66DB1g4Hvt1UQCVMdfCu-IgAV8FXmvDU9onxd4,396
501
+ setuptools/_vendor/tomli/__pycache__/__init__.cpython-312.pyc,,
502
+ setuptools/_vendor/tomli/__pycache__/_parser.cpython-312.pyc,,
503
+ setuptools/_vendor/tomli/__pycache__/_re.cpython-312.pyc,,
504
+ setuptools/_vendor/tomli/__pycache__/_types.cpython-312.pyc,,
505
+ setuptools/_vendor/tomli/_parser.py,sha256=g9-ENaALS-B8dokYpCuzUFalWlog7T-SIYMjLZSWrtM,22633
506
+ setuptools/_vendor/tomli/_re.py,sha256=dbjg5ChZT23Ka9z9DHOXfdtSpPwUfdgMXnj8NOoly-w,2943
507
+ setuptools/_vendor/tomli/_types.py,sha256=-GTG2VUqkpxwMqzmVO4F7ybKddIbAnuAHXfmWQcTi3Q,254
508
+ setuptools/_vendor/tomli/py.typed,sha256=8PjyZ1aVoQpRVvt71muvuq5qE-jTFZkK-GLHkhdebmc,26
509
+ setuptools/_vendor/typeguard-4.3.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
510
+ setuptools/_vendor/typeguard-4.3.0.dist-info/LICENSE,sha256=YWP3mH37ONa8MgzitwsvArhivEESZRbVUu8c1DJH51g,1130
511
+ setuptools/_vendor/typeguard-4.3.0.dist-info/METADATA,sha256=z2dcHAp0TwhYCFU5Deh8x31nazElgujUz9tbuP0pjSE,3717
512
+ setuptools/_vendor/typeguard-4.3.0.dist-info/RECORD,sha256=SKUZWVgkeDUidUKM7s1473fXmsna55bjmi6vJUAoJVI,2402
513
+ setuptools/_vendor/typeguard-4.3.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
514
+ setuptools/_vendor/typeguard-4.3.0.dist-info/entry_points.txt,sha256=qp7NQ1aLtiSgMQqo6gWlfGpy0IIXzoMJmeQTLpzqFZQ,48
515
+ setuptools/_vendor/typeguard-4.3.0.dist-info/top_level.txt,sha256=4z28AhuDodwRS_c1J_l8H51t5QuwfTseskYzlxp6grs,10
516
+ setuptools/_vendor/typeguard/__init__.py,sha256=Onh4w38elPCjtlcU3JY9k3h70NjsxXIkAflmQn-Z0FY,2071
517
+ setuptools/_vendor/typeguard/__pycache__/__init__.cpython-312.pyc,,
518
+ setuptools/_vendor/typeguard/__pycache__/_checkers.cpython-312.pyc,,
519
+ setuptools/_vendor/typeguard/__pycache__/_config.cpython-312.pyc,,
520
+ setuptools/_vendor/typeguard/__pycache__/_decorators.cpython-312.pyc,,
521
+ setuptools/_vendor/typeguard/__pycache__/_exceptions.cpython-312.pyc,,
522
+ setuptools/_vendor/typeguard/__pycache__/_functions.cpython-312.pyc,,
523
+ setuptools/_vendor/typeguard/__pycache__/_importhook.cpython-312.pyc,,
524
+ setuptools/_vendor/typeguard/__pycache__/_memo.cpython-312.pyc,,
525
+ setuptools/_vendor/typeguard/__pycache__/_pytest_plugin.cpython-312.pyc,,
526
+ setuptools/_vendor/typeguard/__pycache__/_suppression.cpython-312.pyc,,
527
+ setuptools/_vendor/typeguard/__pycache__/_transformer.cpython-312.pyc,,
528
+ setuptools/_vendor/typeguard/__pycache__/_union_transformer.cpython-312.pyc,,
529
+ setuptools/_vendor/typeguard/__pycache__/_utils.cpython-312.pyc,,
530
+ setuptools/_vendor/typeguard/_checkers.py,sha256=JRrgKicdOEfIBoNEtegYCEIlhpad-a1u1Em7GCj0WCI,31360
531
+ setuptools/_vendor/typeguard/_config.py,sha256=nIz8QwDa-oFO3L9O8_6srzlmd99pSby2wOM4Wb7F_B0,2846
532
+ setuptools/_vendor/typeguard/_decorators.py,sha256=v6dsIeWvPhExGLP_wXF-RmDUyjZf_Ak28g7gBJ_v0-0,9033
533
+ setuptools/_vendor/typeguard/_exceptions.py,sha256=ZIPeiV-FBd5Emw2EaWd2Fvlsrwi4ocwT2fVGBIAtHcQ,1121
534
+ setuptools/_vendor/typeguard/_functions.py,sha256=ibgSAKa5ptIm1eR9ARG0BSozAFJPFNASZqhPVyQeqig,10393
535
+ setuptools/_vendor/typeguard/_importhook.py,sha256=ugjCDvFcdWMU7UugqlJG91IpVNpEIxtRr-99s0h1k7M,6389
536
+ setuptools/_vendor/typeguard/_memo.py,sha256=1juQV_vxnD2JYKbSrebiQuj4oKHz6n67v9pYA-CCISg,1303
537
+ setuptools/_vendor/typeguard/_pytest_plugin.py,sha256=-fcSqkv54rIfIF8pDavY5YQPkj4OX8GMt_lL7CQSD4I,4416
538
+ setuptools/_vendor/typeguard/_suppression.py,sha256=VQfzxcwIbu3if0f7VBkKM7hkYOA7tNFw9a7jMBsmMg4,2266
539
+ setuptools/_vendor/typeguard/_transformer.py,sha256=9Ha7_QhdwoUni_6hvdY-hZbuEergowHrNL2vzHIakFY,44937
540
+ setuptools/_vendor/typeguard/_union_transformer.py,sha256=v_42r7-6HuRX2SoFwnyJ-E5PlxXpVeUJPJR1-HU9qSo,1354
541
+ setuptools/_vendor/typeguard/_utils.py,sha256=5HhO1rPn5f1M6ymkVAEv7Xmlz1cX-j0OnTMlyHqqrR8,5270
542
+ setuptools/_vendor/typeguard/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
543
+ setuptools/_vendor/typing_extensions-4.12.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
544
+ setuptools/_vendor/typing_extensions-4.12.2.dist-info/LICENSE,sha256=Oy-B_iHRgcSZxZolbI4ZaEVdZonSaaqFNzv7avQdo78,13936
545
+ setuptools/_vendor/typing_extensions-4.12.2.dist-info/METADATA,sha256=BeUQIa8cnYbrjWx-N8TOznM9UGW5Gm2DicVpDtRA8W0,3018
546
+ setuptools/_vendor/typing_extensions-4.12.2.dist-info/RECORD,sha256=dxAALYGXHmMqpqL8M9xddKr118quIgQKZdPjFQOwXuk,571
547
+ setuptools/_vendor/typing_extensions-4.12.2.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
548
+ setuptools/_vendor/typing_extensions.py,sha256=gwekpyG9DVG3lxWKX4ni8u7nk3We5slG98mA9F3DJQw,134451
549
+ setuptools/_vendor/wheel-0.45.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
550
+ setuptools/_vendor/wheel-0.45.1.dist-info/LICENSE.txt,sha256=MMI2GGeRCPPo6h0qZYx8pBe9_IkcmO8aifpP8MmChlQ,1107
551
+ setuptools/_vendor/wheel-0.45.1.dist-info/METADATA,sha256=mKz84H7m7jsxJyzeIcTVORiTb0NPMV39KvOIYhGgmjA,2313
552
+ setuptools/_vendor/wheel-0.45.1.dist-info/RECORD,sha256=1jnxrHyZPDcVvULyfGFhiba4Z5L9_RsXr9dxcNbhaYQ,4900
553
+ setuptools/_vendor/wheel-0.45.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
554
+ setuptools/_vendor/wheel-0.45.1.dist-info/WHEEL,sha256=CpUCUxeHQbRN5UGRQHYRJorO5Af-Qy_fHMctcQ8DSGI,82
555
+ setuptools/_vendor/wheel-0.45.1.dist-info/entry_points.txt,sha256=rTY1BbkPHhkGMm4Q3F0pIzJBzW2kMxoG1oriffvGdA0,104
556
+ setuptools/_vendor/wheel/__init__.py,sha256=mrxMnvdXACur_LWegbUfh5g5ysWZrd63UJn890wvGNk,59
557
+ setuptools/_vendor/wheel/__main__.py,sha256=NkMUnuTCGcOkgY0IBLgBCVC_BGGcWORx2K8jYGS12UE,455
558
+ setuptools/_vendor/wheel/__pycache__/__init__.cpython-312.pyc,,
559
+ setuptools/_vendor/wheel/__pycache__/__main__.cpython-312.pyc,,
560
+ setuptools/_vendor/wheel/__pycache__/_bdist_wheel.cpython-312.pyc,,
561
+ setuptools/_vendor/wheel/__pycache__/_setuptools_logging.cpython-312.pyc,,
562
+ setuptools/_vendor/wheel/__pycache__/bdist_wheel.cpython-312.pyc,,
563
+ setuptools/_vendor/wheel/__pycache__/macosx_libfile.cpython-312.pyc,,
564
+ setuptools/_vendor/wheel/__pycache__/metadata.cpython-312.pyc,,
565
+ setuptools/_vendor/wheel/__pycache__/util.cpython-312.pyc,,
566
+ setuptools/_vendor/wheel/__pycache__/wheelfile.cpython-312.pyc,,
567
+ setuptools/_vendor/wheel/_bdist_wheel.py,sha256=UghCQjSH_pVfcZh6oRjzSw_TQhcf3anSx1OkiLSL82M,21694
568
+ setuptools/_vendor/wheel/_setuptools_logging.py,sha256=-5KC-lne0ilOUWIDfOkqapUWGMFZhuKYDIavIZiB5kM,781
569
+ setuptools/_vendor/wheel/bdist_wheel.py,sha256=tpf9WufiSO1RuEMg5oPhIfSG8DMziCZ_4muCKF69Cqo,1107
570
+ setuptools/_vendor/wheel/cli/__init__.py,sha256=Npq6_jKi03dhIcRnmbuFhwviVJxwO0tYEnEhWMv9cJo,4402
571
+ setuptools/_vendor/wheel/cli/__pycache__/__init__.cpython-312.pyc,,
572
+ setuptools/_vendor/wheel/cli/__pycache__/convert.cpython-312.pyc,,
573
+ setuptools/_vendor/wheel/cli/__pycache__/pack.cpython-312.pyc,,
574
+ setuptools/_vendor/wheel/cli/__pycache__/tags.cpython-312.pyc,,
575
+ setuptools/_vendor/wheel/cli/__pycache__/unpack.cpython-312.pyc,,
576
+ setuptools/_vendor/wheel/cli/convert.py,sha256=Bi0ntEXb9nTllCxWeTRQ4j-nPs3szWSEKipG_GgnMkQ,12634
577
+ setuptools/_vendor/wheel/cli/pack.py,sha256=CAFcHdBVulvsHYJlndKVO7KMI9JqBTZz5ii0PKxxCOs,3103
578
+ setuptools/_vendor/wheel/cli/tags.py,sha256=lHw-LaWrkS5Jy_qWcw-6pSjeNM6yAjDnqKI3E5JTTCU,4760
579
+ setuptools/_vendor/wheel/cli/unpack.py,sha256=Y_J7ynxPSoFFTT7H0fMgbBlVErwyDGcObgme5MBuz58,1021
580
+ setuptools/_vendor/wheel/macosx_libfile.py,sha256=k1x7CE3LPtOVGqj6NXQ1nTGYVPaeRrhVzUG_KPq3zDs,16572
581
+ setuptools/_vendor/wheel/metadata.py,sha256=JC4p7jlQZu2bUTAQ2fevkqLjg_X6gnNyRhLn6OUO1tc,6171
582
+ setuptools/_vendor/wheel/util.py,sha256=aL7aibHwYUgfc8WlolL5tXdkV4DatbJxZHb1kwHFJAU,423
583
+ setuptools/_vendor/wheel/vendored/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
584
+ setuptools/_vendor/wheel/vendored/__pycache__/__init__.cpython-312.pyc,,
585
+ setuptools/_vendor/wheel/vendored/packaging/LICENSE,sha256=ytHvW9NA1z4HS6YU0m996spceUDD2MNIUuZcSQlobEg,197
586
+ setuptools/_vendor/wheel/vendored/packaging/LICENSE.APACHE,sha256=DVQuDIgE45qn836wDaWnYhSdxoLXgpRRKH4RuTjpRZQ,10174
587
+ setuptools/_vendor/wheel/vendored/packaging/LICENSE.BSD,sha256=tw5-m3QvHMb5SLNMFqo5_-zpQZY2S8iP8NIYDwAo-sU,1344
588
+ setuptools/_vendor/wheel/vendored/packaging/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
589
+ setuptools/_vendor/wheel/vendored/packaging/__pycache__/__init__.cpython-312.pyc,,
590
+ setuptools/_vendor/wheel/vendored/packaging/__pycache__/_elffile.cpython-312.pyc,,
591
+ setuptools/_vendor/wheel/vendored/packaging/__pycache__/_manylinux.cpython-312.pyc,,
592
+ setuptools/_vendor/wheel/vendored/packaging/__pycache__/_musllinux.cpython-312.pyc,,
593
+ setuptools/_vendor/wheel/vendored/packaging/__pycache__/_parser.cpython-312.pyc,,
594
+ setuptools/_vendor/wheel/vendored/packaging/__pycache__/_structures.cpython-312.pyc,,
595
+ setuptools/_vendor/wheel/vendored/packaging/__pycache__/_tokenizer.cpython-312.pyc,,
596
+ setuptools/_vendor/wheel/vendored/packaging/__pycache__/markers.cpython-312.pyc,,
597
+ setuptools/_vendor/wheel/vendored/packaging/__pycache__/requirements.cpython-312.pyc,,
598
+ setuptools/_vendor/wheel/vendored/packaging/__pycache__/specifiers.cpython-312.pyc,,
599
+ setuptools/_vendor/wheel/vendored/packaging/__pycache__/tags.cpython-312.pyc,,
600
+ setuptools/_vendor/wheel/vendored/packaging/__pycache__/utils.cpython-312.pyc,,
601
+ setuptools/_vendor/wheel/vendored/packaging/__pycache__/version.cpython-312.pyc,,
602
+ setuptools/_vendor/wheel/vendored/packaging/_elffile.py,sha256=hbmK8OD6Z7fY6hwinHEUcD1by7czkGiNYu7ShnFEk2k,3266
603
+ setuptools/_vendor/wheel/vendored/packaging/_manylinux.py,sha256=P7sdR5_7XBY09LVYYPhHmydMJIIwPXWsh4olk74Uuj4,9588
604
+ setuptools/_vendor/wheel/vendored/packaging/_musllinux.py,sha256=z1s8To2hQ0vpn_d-O2i5qxGwEK8WmGlLt3d_26V7NeY,2674
605
+ setuptools/_vendor/wheel/vendored/packaging/_parser.py,sha256=4tT4emSl2qTaU7VTQE1Xa9o1jMPCsBezsYBxyNMUN-s,10347
606
+ setuptools/_vendor/wheel/vendored/packaging/_structures.py,sha256=q3eVNmbWJGG_S0Dit_S3Ao8qQqz_5PYTXFAKBZe5yr4,1431
607
+ setuptools/_vendor/wheel/vendored/packaging/_tokenizer.py,sha256=alCtbwXhOFAmFGZ6BQ-wCTSFoRAJ2z-ysIf7__MTJ_k,5292
608
+ setuptools/_vendor/wheel/vendored/packaging/markers.py,sha256=_TSPI1BhJYO7Bp9AzTmHQxIqHEVXaTjmDh9G-w8qzPA,8232
609
+ setuptools/_vendor/wheel/vendored/packaging/requirements.py,sha256=dgoBeVprPu2YE6Q8nGfwOPTjATHbRa_ZGLyXhFEln6Q,2933
610
+ setuptools/_vendor/wheel/vendored/packaging/specifiers.py,sha256=IWSt0SrLSP72heWhAC8UL0eGvas7XIQHjqiViVfmPKE,39778
611
+ setuptools/_vendor/wheel/vendored/packaging/tags.py,sha256=fedHXiOHkBxNZTXotXv8uXPmMFU9ae-TKBujgYHigcA,18950
612
+ setuptools/_vendor/wheel/vendored/packaging/utils.py,sha256=XgdmP3yx9-wQEFjO7OvMj9RjEf5JlR5HFFR69v7SQ9E,5268
613
+ setuptools/_vendor/wheel/vendored/packaging/version.py,sha256=PFJaYZDxBgyxkfYhH3SQw4qfE9ICCWrTmitvq14y3bs,16234
614
+ setuptools/_vendor/wheel/vendored/vendor.txt,sha256=Z2ENjB1i5prfez8CdM1Sdr3c6Zxv2rRRolMpLmBncAE,16
615
+ setuptools/_vendor/wheel/wheelfile.py,sha256=USCttNlJwafxt51YYFFKG7jnxz8dfhbyqAZL6jMTA9s,8411
616
+ setuptools/_vendor/zipp-3.19.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
617
+ setuptools/_vendor/zipp-3.19.2.dist-info/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023
618
+ setuptools/_vendor/zipp-3.19.2.dist-info/METADATA,sha256=UIrk_kMIHGSwsKKChYizqMw0MMZpPRZ2ZiVpQAsN_bE,3575
619
+ setuptools/_vendor/zipp-3.19.2.dist-info/RECORD,sha256=8xby4D_ZrefrvAsVRwaEjiu4_VaLkJNRCfDY484rm_4,1039
620
+ setuptools/_vendor/zipp-3.19.2.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
621
+ setuptools/_vendor/zipp-3.19.2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
622
+ setuptools/_vendor/zipp-3.19.2.dist-info/top_level.txt,sha256=iAbdoSHfaGqBfVb2XuR9JqSQHCoOsOtG6y9C_LSpqFw,5
623
+ setuptools/_vendor/zipp/__init__.py,sha256=QuI1g00G4fRAcGt-HqbV0oWIkmSgedCGGYsHHYzNa8A,13412
624
+ setuptools/_vendor/zipp/__pycache__/__init__.cpython-312.pyc,,
625
+ setuptools/_vendor/zipp/__pycache__/glob.cpython-312.pyc,,
626
+ setuptools/_vendor/zipp/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
627
+ setuptools/_vendor/zipp/compat/__pycache__/__init__.cpython-312.pyc,,
628
+ setuptools/_vendor/zipp/compat/__pycache__/py310.cpython-312.pyc,,
629
+ setuptools/_vendor/zipp/compat/py310.py,sha256=eZpkW0zRtunkhEh8jjX3gCGe22emoKCBJw72Zt4RkhA,219
630
+ setuptools/_vendor/zipp/glob.py,sha256=etWpnfEoRyfUvrUsi6sTiGmErvPwe6HzY6pT8jg_lUI,3082
631
+ setuptools/archive_util.py,sha256=Tl_64hSTtc4y8x7xa98rFVUbG24oArpjzLAYGYP2_sI,7356
632
+ setuptools/build_meta.py,sha256=rry-LowqvWFsxG6Qm5QWetHJGeETzRdiQ5-bs4bOkjo,20446
633
+ setuptools/cli-32.exe,sha256=MqzBvFQxFsviz_EMuGd3LfLyVP8mNMhwrvC0bEtpb9s,11776
634
+ setuptools/cli-64.exe,sha256=u7PeVwdinmpgoMI4zUd7KPB_AGaYL9qVP6b87DkHOko,14336
635
+ setuptools/cli-arm64.exe,sha256=uafQjaiA36yLz1SOuksG-1m28JsX0zFIoPZhgyiSbGE,13824
636
+ setuptools/cli.exe,sha256=MqzBvFQxFsviz_EMuGd3LfLyVP8mNMhwrvC0bEtpb9s,11776
637
+ setuptools/command/__init__.py,sha256=wdSrlNR0P6nCz9_oFtCAiAkeFJMsZa1jPcpXT53f0SM,803
638
+ setuptools/command/__pycache__/__init__.cpython-312.pyc,,
639
+ setuptools/command/__pycache__/_requirestxt.cpython-312.pyc,,
640
+ setuptools/command/__pycache__/alias.cpython-312.pyc,,
641
+ setuptools/command/__pycache__/bdist_egg.cpython-312.pyc,,
642
+ setuptools/command/__pycache__/bdist_rpm.cpython-312.pyc,,
643
+ setuptools/command/__pycache__/bdist_wheel.cpython-312.pyc,,
644
+ setuptools/command/__pycache__/build.cpython-312.pyc,,
645
+ setuptools/command/__pycache__/build_clib.cpython-312.pyc,,
646
+ setuptools/command/__pycache__/build_ext.cpython-312.pyc,,
647
+ setuptools/command/__pycache__/build_py.cpython-312.pyc,,
648
+ setuptools/command/__pycache__/develop.cpython-312.pyc,,
649
+ setuptools/command/__pycache__/dist_info.cpython-312.pyc,,
650
+ setuptools/command/__pycache__/easy_install.cpython-312.pyc,,
651
+ setuptools/command/__pycache__/editable_wheel.cpython-312.pyc,,
652
+ setuptools/command/__pycache__/egg_info.cpython-312.pyc,,
653
+ setuptools/command/__pycache__/install.cpython-312.pyc,,
654
+ setuptools/command/__pycache__/install_egg_info.cpython-312.pyc,,
655
+ setuptools/command/__pycache__/install_lib.cpython-312.pyc,,
656
+ setuptools/command/__pycache__/install_scripts.cpython-312.pyc,,
657
+ setuptools/command/__pycache__/rotate.cpython-312.pyc,,
658
+ setuptools/command/__pycache__/saveopts.cpython-312.pyc,,
659
+ setuptools/command/__pycache__/sdist.cpython-312.pyc,,
660
+ setuptools/command/__pycache__/setopt.cpython-312.pyc,,
661
+ setuptools/command/__pycache__/test.cpython-312.pyc,,
662
+ setuptools/command/_requirestxt.py,sha256=ItYMTJGh_i5TlQstX_nFopqEhkC4PJFadBL2Zd3V670,4228
663
+ setuptools/command/alias.py,sha256=rDdrMt32DS6qf3K7tjZZyHD_dMKrm77AXcAtx-nBQ0I,2380
664
+ setuptools/command/bdist_egg.py,sha256=3eDucQ4fdeYMsLO9PhBfY1JkcMLhZXgnAI_9FdFNsEE,16972
665
+ setuptools/command/bdist_rpm.py,sha256=LyqI49w48SKk0FmuHsE9MLzX1SuXjL7YMNbZMFZqFII,1435
666
+ setuptools/command/bdist_wheel.py,sha256=_LfGHB7CV_uyncqlOTSETEi2gjVCoPKuAXcyRFoq7Cs,22246
667
+ setuptools/command/build.py,sha256=eI7STMERGGZEpzk1tvJN8p9IOjAAXMcGLzljv2mwI3M,6052
668
+ setuptools/command/build_clib.py,sha256=AbgpPIF_3qL8fZr3JIebI-WHTMTBiMfrFkVQz8K40G4,4528
669
+ setuptools/command/build_ext.py,sha256=bUH4M0NizaJJrv10wK-ZD3uY0TxCSZlYQDhiwwzHslM,18377
670
+ setuptools/command/build_py.py,sha256=DCbjvB18kkL-xUK5rvlzm0C6twTeOxNhyvJDxxa7fII,15539
671
+ setuptools/command/develop.py,sha256=zX22119sI1G1gfJ1gNCE4hkg2zbLKx0uUwvNmC5bIu8,6886
672
+ setuptools/command/dist_info.py,sha256=HU752iLLmmYMHbsDBgz2ubRjkgJobugOp8H71LzzDys,3450
673
+ setuptools/command/easy_install.py,sha256=0Z4kFlE78Ae2AfHXYTxZFUa2t3qlNqXCtQu4J1Nx8iA,87870
674
+ setuptools/command/editable_wheel.py,sha256=3bBipRZA3E4poQ8LEWhMYEjHjCzqU_pIdO86C3t7oNY,35624
675
+ setuptools/command/egg_info.py,sha256=WWUozR3DZCrWsTQhHXOygMiEUcrjLWphET0-Zsocsm4,25982
676
+ setuptools/command/install.py,sha256=MmTGb8m1R8fJ0cc5FTWCF6uq-s1ZJmvpYm-N_CtqEaI,7046
677
+ setuptools/command/install_egg_info.py,sha256=3I9IPCH7D59Sh-6aVYz-h6wwyxq-wkxrKwKg3nDdJqs,2075
678
+ setuptools/command/install_lib.py,sha256=9n1_U83eHcERL_a_rv_LhHCkhXlLdqyZ4SdBow-9qcE,4319
679
+ setuptools/command/install_scripts.py,sha256=tVOCj3e8OTIrkoL_bGbT5pOksdxZfQblH_bdI4DtVV4,2637
680
+ setuptools/command/launcher manifest.xml,sha256=xlLbjWrB01tKC0-hlVkOKkiSPbzMml2eOPtJ_ucCnbE,628
681
+ setuptools/command/rotate.py,sha256=XNd_BEEOWAJHW1FcLTMUWWl4QB6zAuk7b8VWQg3FHos,2187
682
+ setuptools/command/saveopts.py,sha256=Np0PVb7SD7oTbu9Z9sosS7D-CkkIkU7x4glu5Es1tjA,692
683
+ setuptools/command/sdist.py,sha256=JaQm2-ebXI2kvyrBjJKP8yNLPa5eMbMeis88CXBMYlk,7374
684
+ setuptools/command/setopt.py,sha256=xZF2RCc4ABvE9eHHAzF50-fkQg3au8fcRUVVGd58k3U,5100
685
+ setuptools/command/test.py,sha256=k7xcq7D7bEehgxarbw-dW3AtmGZORqz8HjKR6FGJ3jk,1343
686
+ setuptools/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
687
+ setuptools/compat/__pycache__/__init__.cpython-312.pyc,,
688
+ setuptools/compat/__pycache__/py310.cpython-312.pyc,,
689
+ setuptools/compat/__pycache__/py311.cpython-312.pyc,,
690
+ setuptools/compat/__pycache__/py312.cpython-312.pyc,,
691
+ setuptools/compat/__pycache__/py39.cpython-312.pyc,,
692
+ setuptools/compat/py310.py,sha256=8sqwWczIcrkzeAbhaim4pKVd4tXZdcqmebgdvzji0rc,141
693
+ setuptools/compat/py311.py,sha256=e6tJAFwZEP82hmMBl10HYeSypelo_Ti2wTjKZVKLwOE,790
694
+ setuptools/compat/py312.py,sha256=vYKVtdrdOTsO_R90dJkEXsFwfMJFuIFJflhIgHrjJ-Y,366
695
+ setuptools/compat/py39.py,sha256=BJMtnkfcqyTfccqjYQxfoRtU2nTnWaEESBVkshTiXqY,493
696
+ setuptools/config/NOTICE,sha256=Ld3wiBgpejuJ1D2V_2WdjahXQRCMkTbfo6TYVsBiO9g,493
697
+ setuptools/config/__init__.py,sha256=aiPnL9BJn1O6MfmuNXyn8W2Lp8u9qizRVqwPiOdPIjY,1499
698
+ setuptools/config/__pycache__/__init__.cpython-312.pyc,,
699
+ setuptools/config/__pycache__/_apply_pyprojecttoml.cpython-312.pyc,,
700
+ setuptools/config/__pycache__/expand.cpython-312.pyc,,
701
+ setuptools/config/__pycache__/pyprojecttoml.cpython-312.pyc,,
702
+ setuptools/config/__pycache__/setupcfg.cpython-312.pyc,,
703
+ setuptools/config/_apply_pyprojecttoml.py,sha256=SUyTw7A2btZ1lBuWKN5o42-Diyv95eGTiYJ3rZOnGSc,19120
704
+ setuptools/config/_validate_pyproject/NOTICE,sha256=XTANv6ZDE4sBO3WsnK7uWR-VG4sO4kKIw0zNkmxHgMg,18737
705
+ setuptools/config/_validate_pyproject/__init__.py,sha256=dnp6T7ePP1R5z4OuC7Fd2dkFlIrtIfizUfvpGJP6nz0,1042
706
+ setuptools/config/_validate_pyproject/__pycache__/__init__.cpython-312.pyc,,
707
+ setuptools/config/_validate_pyproject/__pycache__/error_reporting.cpython-312.pyc,,
708
+ setuptools/config/_validate_pyproject/__pycache__/extra_validations.cpython-312.pyc,,
709
+ setuptools/config/_validate_pyproject/__pycache__/fastjsonschema_exceptions.cpython-312.pyc,,
710
+ setuptools/config/_validate_pyproject/__pycache__/fastjsonschema_validations.cpython-312.pyc,,
711
+ setuptools/config/_validate_pyproject/__pycache__/formats.cpython-312.pyc,,
712
+ setuptools/config/_validate_pyproject/error_reporting.py,sha256=meldD7nBQdolQhvG-43r1Ue-gU1n7ORAJR86vh3Rrvk,11813
713
+ setuptools/config/_validate_pyproject/extra_validations.py,sha256=-GUG5S--ijY8WfXbdXPoHl6ywGsyEF9dtDpenSoJPHg,2858
714
+ setuptools/config/_validate_pyproject/fastjsonschema_exceptions.py,sha256=w749JgqKi8clBFcObdcbZVqsmF4oJ_QByhZ1SGbUFNw,1612
715
+ setuptools/config/_validate_pyproject/fastjsonschema_validations.py,sha256=FihD5ZcM6p77BPZ04CGqh3BEwVNoPMKJZJAyuJpkAU0,354682
716
+ setuptools/config/_validate_pyproject/formats.py,sha256=TETokJBK9hjl-cVg1olsojkJwLxfP7_chgJQNmzAB98,13564
717
+ setuptools/config/distutils.schema.json,sha256=Tcp32kRnhwORGw_9p6GEi08lj2h15tQRzOYBbzGmcBU,972
718
+ setuptools/config/expand.py,sha256=JNAktRCsyyRB-rQodbPnCucmLWqcYvzCDC8Ebn2Z7xM,16041
719
+ setuptools/config/pyprojecttoml.py,sha256=YMu5PdbJJI5azp6kR_boM1mflf5nqOA-InF4s6LnLgw,18320
720
+ setuptools/config/setupcfg.py,sha256=VZDkwE7DYv45SbadJD8CwKrDtiXvjgllL8PYSvoRCyg,26575
721
+ setuptools/config/setuptools.schema.json,sha256=dZBRuSEnZkatoVlt1kVwG8ocTeRdO7BD0xvOWKH54PY,16071
722
+ setuptools/depends.py,sha256=jKYfjmt_2ZQYVghb8L9bU7LJ6erHJ5ze-K_fKV1BMXk,5965
723
+ setuptools/discovery.py,sha256=-42c3XhwzkfodDKKP50C2YBzr11fncAgmUzBdBRb0-Q,21258
724
+ setuptools/dist.py,sha256=RZz7aj9RxqSYriqgFoZOu-7KIV82cmlaMFx9owZrApQ,44897
725
+ setuptools/errors.py,sha256=gY2x2PIaIgy01yRANRC-zcCwxDCqCScgJoCOZFe0yio,3024
726
+ setuptools/extension.py,sha256=KCnv9p3tgm0ZVqtgE451fyILsm4hCyvOiUtOu787D-4,6683
727
+ setuptools/glob.py,sha256=AC_B33DY8g-CHELxDsJrtwFrpiucSAZsakPFdSOQzhc,6062
728
+ setuptools/gui-32.exe,sha256=hdrh6V13hF8stZvKw9Sv50u-TJGpvMW_SnHNQxBNvnw,11776
729
+ setuptools/gui-64.exe,sha256=NHG2FA6txkEid9u-_j_vjDRaDxpZd2CGuAo2GMOoPjs,14336
730
+ setuptools/gui-arm64.exe,sha256=5pT0dDQFyLWSb_RX22_n8aEt7HwWqcOGR4TT9OB64Jc,13824
731
+ setuptools/gui.exe,sha256=hdrh6V13hF8stZvKw9Sv50u-TJGpvMW_SnHNQxBNvnw,11776
732
+ setuptools/installer.py,sha256=_4Wegx4r3L05sMo3-IlqFp-OuxnWyBqjyMZ7LWQXmh8,5110
733
+ setuptools/launch.py,sha256=IBb5lEv69CyuZ9ewIrmKlXh154kdLmP29LKfTMkximE,820
734
+ setuptools/logging.py,sha256=W16iHJ1HcCXYQ0RxyrEfJ83FT4175tCtoYg-E6uSpVI,1261
735
+ setuptools/modified.py,sha256=ZwbfBfCFP88ltvbv_dJDz-t1LsQjnM-JUpgZnnQZjjM,568
736
+ setuptools/monkey.py,sha256=FwMWl2n1v2bHbeqBy-o9g8yUNaAkYFbszCbXe9d5Za8,3717
737
+ setuptools/msvc.py,sha256=vmM0qL4rIzrtD9pia9ZEwtqZ4LbbrgL0dU0EANVYRm8,41631
738
+ setuptools/namespaces.py,sha256=2GGqYY1BNDEhMtBc1rHTv7klgmNVRdksJeW-L1f--ys,3171
739
+ setuptools/package_index.py,sha256=yHXj4Z_QaUeh8W6rwq08I5LxnyHrSkNf01uXHwdE8K0,39095
740
+ setuptools/sandbox.py,sha256=fMqtcOuipHO6RKPh1YB5o7d985dLKo76Whp3vrIei2E,14906
741
+ setuptools/script (dev).tmpl,sha256=RUzQzCQUaXtwdLtYHWYbIQmOaES5Brqq1FvUA_tu-5I,218
742
+ setuptools/script.tmpl,sha256=WGTt5piezO27c-Dbx6l5Q4T3Ff20A5z7872hv3aAhYY,138
743
+ setuptools/tests/__init__.py,sha256=AnBfls2iJbTDQzmMKeLRt-9lxhaOHUVOZEgXv89Uwvs,335
744
+ setuptools/tests/__pycache__/__init__.cpython-312.pyc,,
745
+ setuptools/tests/__pycache__/contexts.cpython-312.pyc,,
746
+ setuptools/tests/__pycache__/environment.cpython-312.pyc,,
747
+ setuptools/tests/__pycache__/fixtures.cpython-312.pyc,,
748
+ setuptools/tests/__pycache__/mod_with_constant.cpython-312.pyc,,
749
+ setuptools/tests/__pycache__/namespaces.cpython-312.pyc,,
750
+ setuptools/tests/__pycache__/script-with-bom.cpython-312.pyc,,
751
+ setuptools/tests/__pycache__/server.cpython-312.pyc,,
752
+ setuptools/tests/__pycache__/test_archive_util.cpython-312.pyc,,
753
+ setuptools/tests/__pycache__/test_bdist_deprecations.cpython-312.pyc,,
754
+ setuptools/tests/__pycache__/test_bdist_egg.cpython-312.pyc,,
755
+ setuptools/tests/__pycache__/test_bdist_wheel.cpython-312.pyc,,
756
+ setuptools/tests/__pycache__/test_build.cpython-312.pyc,,
757
+ setuptools/tests/__pycache__/test_build_clib.cpython-312.pyc,,
758
+ setuptools/tests/__pycache__/test_build_ext.cpython-312.pyc,,
759
+ setuptools/tests/__pycache__/test_build_meta.cpython-312.pyc,,
760
+ setuptools/tests/__pycache__/test_build_py.cpython-312.pyc,,
761
+ setuptools/tests/__pycache__/test_config_discovery.cpython-312.pyc,,
762
+ setuptools/tests/__pycache__/test_core_metadata.cpython-312.pyc,,
763
+ setuptools/tests/__pycache__/test_depends.cpython-312.pyc,,
764
+ setuptools/tests/__pycache__/test_develop.cpython-312.pyc,,
765
+ setuptools/tests/__pycache__/test_dist.cpython-312.pyc,,
766
+ setuptools/tests/__pycache__/test_dist_info.cpython-312.pyc,,
767
+ setuptools/tests/__pycache__/test_distutils_adoption.cpython-312.pyc,,
768
+ setuptools/tests/__pycache__/test_easy_install.cpython-312.pyc,,
769
+ setuptools/tests/__pycache__/test_editable_install.cpython-312.pyc,,
770
+ setuptools/tests/__pycache__/test_egg_info.cpython-312.pyc,,
771
+ setuptools/tests/__pycache__/test_extern.cpython-312.pyc,,
772
+ setuptools/tests/__pycache__/test_find_packages.cpython-312.pyc,,
773
+ setuptools/tests/__pycache__/test_find_py_modules.cpython-312.pyc,,
774
+ setuptools/tests/__pycache__/test_glob.cpython-312.pyc,,
775
+ setuptools/tests/__pycache__/test_install_scripts.cpython-312.pyc,,
776
+ setuptools/tests/__pycache__/test_logging.cpython-312.pyc,,
777
+ setuptools/tests/__pycache__/test_manifest.cpython-312.pyc,,
778
+ setuptools/tests/__pycache__/test_namespaces.cpython-312.pyc,,
779
+ setuptools/tests/__pycache__/test_packageindex.cpython-312.pyc,,
780
+ setuptools/tests/__pycache__/test_sandbox.cpython-312.pyc,,
781
+ setuptools/tests/__pycache__/test_sdist.cpython-312.pyc,,
782
+ setuptools/tests/__pycache__/test_setopt.cpython-312.pyc,,
783
+ setuptools/tests/__pycache__/test_setuptools.cpython-312.pyc,,
784
+ setuptools/tests/__pycache__/test_shutil_wrapper.cpython-312.pyc,,
785
+ setuptools/tests/__pycache__/test_unicode_utils.cpython-312.pyc,,
786
+ setuptools/tests/__pycache__/test_virtualenv.cpython-312.pyc,,
787
+ setuptools/tests/__pycache__/test_warnings.cpython-312.pyc,,
788
+ setuptools/tests/__pycache__/test_wheel.cpython-312.pyc,,
789
+ setuptools/tests/__pycache__/test_windows_wrappers.cpython-312.pyc,,
790
+ setuptools/tests/__pycache__/text.cpython-312.pyc,,
791
+ setuptools/tests/__pycache__/textwrap.cpython-312.pyc,,
792
+ setuptools/tests/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
793
+ setuptools/tests/compat/__pycache__/__init__.cpython-312.pyc,,
794
+ setuptools/tests/compat/__pycache__/py39.cpython-312.pyc,,
795
+ setuptools/tests/compat/py39.py,sha256=eUy7_F-6KRTOIKl-veshUu6I0EdTSdBZMh0EV0lZ1-g,135
796
+ setuptools/tests/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
797
+ setuptools/tests/config/__pycache__/__init__.cpython-312.pyc,,
798
+ setuptools/tests/config/__pycache__/test_apply_pyprojecttoml.cpython-312.pyc,,
799
+ setuptools/tests/config/__pycache__/test_expand.cpython-312.pyc,,
800
+ setuptools/tests/config/__pycache__/test_pyprojecttoml.cpython-312.pyc,,
801
+ setuptools/tests/config/__pycache__/test_pyprojecttoml_dynamic_deps.cpython-312.pyc,,
802
+ setuptools/tests/config/__pycache__/test_setupcfg.cpython-312.pyc,,
803
+ setuptools/tests/config/downloads/__init__.py,sha256=9ixnDEdyL_arKbUzfuiJftAj9bGxKz8M9alOFZMjx9Y,1827
804
+ setuptools/tests/config/downloads/__pycache__/__init__.cpython-312.pyc,,
805
+ setuptools/tests/config/downloads/__pycache__/preload.cpython-312.pyc,,
806
+ setuptools/tests/config/downloads/preload.py,sha256=sIGGZpY3cmMpMwiJYYYYHG2ifZJkvJgEotRFtiulV1I,450
807
+ setuptools/tests/config/setupcfg_examples.txt,sha256=cAbVvCbkFZuTUL6xRRzRgqyB0rLvJTfvw3D30glo2OE,1912
808
+ setuptools/tests/config/test_apply_pyprojecttoml.py,sha256=l6nE4d8WLU_eSWRic7VSoqeKv9Bi7CZGHcEuB2ehk2w,28807
809
+ setuptools/tests/config/test_expand.py,sha256=S0oT6JvgA_oujR4YS4RUuf5gmOt1CTQV66RQDzV8xd4,8933
810
+ setuptools/tests/config/test_pyprojecttoml.py,sha256=0LefSljUhA6MqtJ5AVzLhomqZcYiFKdu_1ckDeMT1LY,12406
811
+ setuptools/tests/config/test_pyprojecttoml_dynamic_deps.py,sha256=9W73-yLhZJmvCiO4rTiQoBpZT5wNA90Xbd5n2HCshd4,3271
812
+ setuptools/tests/config/test_setupcfg.py,sha256=ZvN-O-2Dgon1adp6oM6il8JWdgT9y196fRvqESU5ELI,33427
813
+ setuptools/tests/contexts.py,sha256=TAdZKxmmodx1ExMVo01o4QpRjpIpo4X3IWKq_BnjxpU,3480
814
+ setuptools/tests/environment.py,sha256=95_UtTaRiuvwYC9eXKEHbn02kDtZysvZq3UZJmPUj1I,3102
815
+ setuptools/tests/fixtures.py,sha256=-V7iD6BeE2E0Rw6dVvTOCm36JG8ZTTnrXhN0GISlgrg,5197
816
+ setuptools/tests/indexes/test_links_priority/external.html,sha256=eL9euOuE93JKZdqlXxBOlHbKwIuNuIdq7GBRpsaPMcU,92
817
+ setuptools/tests/indexes/test_links_priority/simple/foobar/index.html,sha256=DD-TKr7UU4zAjHHz4VexYDNSAzR27levSh1c-k3ZdLE,174
818
+ setuptools/tests/integration/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
819
+ setuptools/tests/integration/__pycache__/__init__.cpython-312.pyc,,
820
+ setuptools/tests/integration/__pycache__/helpers.cpython-312.pyc,,
821
+ setuptools/tests/integration/__pycache__/test_pip_install_sdist.cpython-312.pyc,,
822
+ setuptools/tests/integration/helpers.py,sha256=3PHcS9SCA-fwVJmUP2ad5NQOttJAETI5Nnoc_xroO5k,2522
823
+ setuptools/tests/integration/test_pip_install_sdist.py,sha256=SFbvuYF_hDzt6OtsQ5GjFNnxmoJ_eElfvpYsiyyGJ-g,8256
824
+ setuptools/tests/mod_with_constant.py,sha256=X_Kj80M55w1tmQ4f7uZY91ZTALo4hKVT6EHxgYocUMQ,22
825
+ setuptools/tests/namespaces.py,sha256=HPcI3nR5MCFWXpaADIJ1fwKxymcQgBkuw87Ic5PUSAQ,2774
826
+ setuptools/tests/script-with-bom.py,sha256=hRRgIizEULGiG_ZTNoMY46HhKhxpWfy5FGcD6Qbh5fc,18
827
+ setuptools/tests/server.py,sha256=0FDZf0cSInCP5n1haK7AxHo3jD261RK7D3-RjP-F53k,2397
828
+ setuptools/tests/test_archive_util.py,sha256=buuKdY8XkW26Pe3IKAoBRGHG0MDumnuNoPg2WsAQzIg,845
829
+ setuptools/tests/test_bdist_deprecations.py,sha256=75Xq3gYn79LIIyusEltbHan0bEgAt2e_CaL7KLS8-KQ,775
830
+ setuptools/tests/test_bdist_egg.py,sha256=6PaYN1F3JDbIh1uK0urv7yJFcx98z5dn9SOJ8Mv91l8,1957
831
+ setuptools/tests/test_bdist_wheel.py,sha256=dZ9a7OT_UyRvLnoCi2KGEIbtzhEQjM3YutYMA6ZCezs,23083
832
+ setuptools/tests/test_build.py,sha256=wJgMz2hwHADcLFg-nXrwRVhus7hjmAeEGgrpIQwCGnA,798
833
+ setuptools/tests/test_build_clib.py,sha256=bX51XRAf4uO7IuHFpjePnoK8mE74N2gsoeEqF-ofgws,3123
834
+ setuptools/tests/test_build_ext.py,sha256=e4ZSxsYPB5zq1KSqGEuATZ0t0PJQzMhjjkKJ-hIjcgc,10099
835
+ setuptools/tests/test_build_meta.py,sha256=Iakpp9Micvhxi9_F2RPyY2NnCB1G90a38s4O5A3CuiE,34118
836
+ setuptools/tests/test_build_py.py,sha256=gobME_Cvzf6Ugxq70iWfXekb_xyyT61khwjFq8zkwfw,14186
837
+ setuptools/tests/test_config_discovery.py,sha256=FqV-lOtkqaI-ayzU2zocSdD5TaRAgCZnixNDilKA6FQ,22580
838
+ setuptools/tests/test_core_metadata.py,sha256=vbVJ5_Lsx_hsO_GdB6nQEXJRjA2ydx6_qSbr5LpheAA,20881
839
+ setuptools/tests/test_depends.py,sha256=yQBXoQbNQlJit6mbRVoz6Bb553f3sNrq02lZimNz5XY,424
840
+ setuptools/tests/test_develop.py,sha256=CLzXZ8-b5-VFTuau4P4yXEdLx1UdyTFcOfrV0qyUIdE,5142
841
+ setuptools/tests/test_dist.py,sha256=GFjyL2etAxvVM3q7NhFEGcXS5gyKj8VzbqcbKzpqbOk,8901
842
+ setuptools/tests/test_dist_info.py,sha256=5kBRj9tuBsVreBsY22H2feMO_JQZsSoOZMU_MJfUevY,7077
843
+ setuptools/tests/test_distutils_adoption.py,sha256=_eynrOfyEqXFEmjUJhzpe8GXPyTUPvNSObs4qAAmBy8,5987
844
+ setuptools/tests/test_easy_install.py,sha256=jx4lpFyee0G432cdnwBow3AkL4ibw-0QILwldwv5SCI,53534
845
+ setuptools/tests/test_editable_install.py,sha256=7eTEtpT0k7QeVyZg64eh3kZn-SjckuB9LcokOuV37DI,43383
846
+ setuptools/tests/test_egg_info.py,sha256=QCzoUOkFocmbkwS6XU7F8WNzKE8CGEMRxYBqKLgfUrc,44866
847
+ setuptools/tests/test_extern.py,sha256=rpKU6oCcksumLwf5TeKlDluFQ0TUfbPwTLQbpxcFrCU,296
848
+ setuptools/tests/test_find_packages.py,sha256=CTLAcTzWGWBLCcd2aAsUVkvO3ibrlqexFBdDKOWPoq8,7819
849
+ setuptools/tests/test_find_py_modules.py,sha256=zQjuhIG5TQN2SJPix9ARo4DL_w84Ln8QsHDUjjbrtAQ,2404
850
+ setuptools/tests/test_glob.py,sha256=P3JvpH-kXQ4BZ3zvRF-zKxOgwyWzwIaQIz0WHdxS0kk,887
851
+ setuptools/tests/test_install_scripts.py,sha256=scIrJ6a_ssKqg4vIBNaUjmAKHEYLUUZ9WKnPeKnE6gc,3433
852
+ setuptools/tests/test_logging.py,sha256=zlE5DlldukC7Jc54FNvDV_7ux3ErAkrfrN5CSsnNOUQ,2099
853
+ setuptools/tests/test_manifest.py,sha256=eMg65pIA52DizB6mpktSU-b8CjwaNCS5MSgL_V1LrFI,18562
854
+ setuptools/tests/test_namespaces.py,sha256=Y6utoe5PHHqL_DlgawqB9F8XpsUDPvvw1sQMenK04e0,4515
855
+ setuptools/tests/test_packageindex.py,sha256=qEjLHpSu2gAkegwEstzHQT-Om1uQIYjA8zeNzEX79uo,8775
856
+ setuptools/tests/test_sandbox.py,sha256=shUWE7fLTWe7Jzdfi6NheBWauG3oUukbUV46cArD0u0,4330
857
+ setuptools/tests/test_sdist.py,sha256=RYLvPa_nfyC1ZmoinzqMzJynTDG4RtPYC19_0LU6pvs,32872
858
+ setuptools/tests/test_setopt.py,sha256=3VxxM4ATfP-P4AGnDjoWCnHr5-i9CSEQTFYU1-FTnvI,1365
859
+ setuptools/tests/test_setuptools.py,sha256=_eIhqKf45-OtHqxRf20KndOZJlJdS0PuFLXBO3M-LN8,9008
860
+ setuptools/tests/test_shutil_wrapper.py,sha256=g15E11PtZxG-InB2BWNFyH-svObXx2XcMhgMLJPuFnc,641
861
+ setuptools/tests/test_unicode_utils.py,sha256=xWfEEl8jkQCt9othUTXJfFmdyATAFggJs2tTxjbumbw,316
862
+ setuptools/tests/test_virtualenv.py,sha256=g-njC_9JTAs1YVx_1dGJ_Q6RlInO4qKVu9-XAgNb6TY,3730
863
+ setuptools/tests/test_warnings.py,sha256=zwR2zcnCeCeDqILZlJOPAcuyPHoDvGu1OtOVYiLMk74,3347
864
+ setuptools/tests/test_wheel.py,sha256=J-83W1KdXTgAjFZE3H-ytohhvDE1iqdbE5YF5jLQlGQ,19370
865
+ setuptools/tests/test_windows_wrappers.py,sha256=aF6UTowN3yzCgdBh9nDQVvYIfSYogrTK776TEyXEBqg,7881
866
+ setuptools/tests/text.py,sha256=a12197pMVTvB6FAWQ0ujT8fIQiLIWJlFAl1UCaDUDfg,123
867
+ setuptools/tests/textwrap.py,sha256=FNNNq_MiaEJx88PnsbJQIRxmj1qmgcAOCXXRsODPJN4,98
868
+ setuptools/unicode_utils.py,sha256=ukMGh8pEAw6F_Ezb-K5D3c-078RgA_GcF0oW6lg4lSs,3189
869
+ setuptools/version.py,sha256=WJCeUuyq74Aok2TeK9-OexZOu8XrlQy7-y0BEuWNovQ,161
870
+ setuptools/warnings.py,sha256=oY0Se5eOqje_FEyjTgonUc0XGwgsrI5cgm1kkwulz_w,3796
871
+ setuptools/wheel.py,sha256=xkAtvgm7uPTyYV2zqVmQ0wA8kLwOyRT2Jes1zAy07Ks,8624
872
+ setuptools/windows_support.py,sha256=wW4IYLM1Bv7Z1MaauP2xmPjyy-wkmQnXdyvXscAf9fw,726
.venv/lib/python3.12/site-packages/setuptools-78.1.0.dist-info/WHEEL ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (78.1.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
.venv/lib/python3.12/site-packages/setuptools-78.1.0.dist-info/entry_points.txt ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [distutils.commands]
2
+ alias = setuptools.command.alias:alias
3
+ bdist_egg = setuptools.command.bdist_egg:bdist_egg
4
+ bdist_rpm = setuptools.command.bdist_rpm:bdist_rpm
5
+ bdist_wheel = setuptools.command.bdist_wheel:bdist_wheel
6
+ build = setuptools.command.build:build
7
+ build_clib = setuptools.command.build_clib:build_clib
8
+ build_ext = setuptools.command.build_ext:build_ext
9
+ build_py = setuptools.command.build_py:build_py
10
+ develop = setuptools.command.develop:develop
11
+ dist_info = setuptools.command.dist_info:dist_info
12
+ easy_install = setuptools.command.easy_install:easy_install
13
+ editable_wheel = setuptools.command.editable_wheel:editable_wheel
14
+ egg_info = setuptools.command.egg_info:egg_info
15
+ install = setuptools.command.install:install
16
+ install_egg_info = setuptools.command.install_egg_info:install_egg_info
17
+ install_lib = setuptools.command.install_lib:install_lib
18
+ install_scripts = setuptools.command.install_scripts:install_scripts
19
+ rotate = setuptools.command.rotate:rotate
20
+ saveopts = setuptools.command.saveopts:saveopts
21
+ sdist = setuptools.command.sdist:sdist
22
+ setopt = setuptools.command.setopt:setopt
23
+
24
+ [distutils.setup_keywords]
25
+ dependency_links = setuptools.dist:assert_string_list
26
+ eager_resources = setuptools.dist:assert_string_list
27
+ entry_points = setuptools.dist:check_entry_points
28
+ exclude_package_data = setuptools.dist:check_package_data
29
+ extras_require = setuptools.dist:check_extras
30
+ include_package_data = setuptools.dist:assert_bool
31
+ install_requires = setuptools.dist:check_requirements
32
+ namespace_packages = setuptools.dist:check_nsp
33
+ package_data = setuptools.dist:check_package_data
34
+ packages = setuptools.dist:check_packages
35
+ python_requires = setuptools.dist:check_specifier
36
+ setup_requires = setuptools.dist:check_requirements
37
+ use_2to3 = setuptools.dist:invalid_unless_false
38
+ zip_safe = setuptools.dist:assert_bool
39
+
40
+ [egg_info.writers]
41
+ PKG-INFO = setuptools.command.egg_info:write_pkg_info
42
+ dependency_links.txt = setuptools.command.egg_info:overwrite_arg
43
+ eager_resources.txt = setuptools.command.egg_info:overwrite_arg
44
+ entry_points.txt = setuptools.command.egg_info:write_entries
45
+ namespace_packages.txt = setuptools.command.egg_info:overwrite_arg
46
+ requires.txt = setuptools.command.egg_info:write_requirements
47
+ top_level.txt = setuptools.command.egg_info:write_toplevel_names
48
+
49
+ [setuptools.finalize_distribution_options]
50
+ keywords = setuptools.dist:Distribution._finalize_setup_keywords
51
+ parent_finalize = setuptools.dist:_Distribution.finalize_options
.venv/lib/python3.12/site-packages/setuptools-78.1.0.dist-info/licenses/LICENSE ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Permission is hereby granted, free of charge, to any person obtaining a copy
2
+ of this software and associated documentation files (the "Software"), to
3
+ deal in the Software without restriction, including without limitation the
4
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
5
+ sell copies of the Software, and to permit persons to whom the Software is
6
+ furnished to do so, subject to the following conditions:
7
+
8
+ The above copyright notice and this permission notice shall be included in
9
+ all copies or substantial portions of the Software.
10
+
11
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
16
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
17
+ IN THE SOFTWARE.
.venv/lib/python3.12/site-packages/setuptools-78.1.0.dist-info/top_level.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ _distutils_hack
2
+ pkg_resources
3
+ setuptools
.venv/lib/python3.12/site-packages/setuptools/tests/test_core_metadata.py ADDED
@@ -0,0 +1,622 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import functools
4
+ import importlib
5
+ import io
6
+ from email import message_from_string
7
+ from email.generator import Generator
8
+ from email.message import EmailMessage, Message
9
+ from email.parser import Parser
10
+ from email.policy import EmailPolicy
11
+ from inspect import cleandoc
12
+ from pathlib import Path
13
+ from unittest.mock import Mock
14
+
15
+ import jaraco.path
16
+ import pytest
17
+ from packaging.metadata import Metadata
18
+ from packaging.requirements import Requirement
19
+
20
+ from setuptools import _reqs, sic
21
+ from setuptools._core_metadata import rfc822_escape, rfc822_unescape
22
+ from setuptools.command.egg_info import egg_info, write_requirements
23
+ from setuptools.config import expand, setupcfg
24
+ from setuptools.dist import Distribution
25
+
26
+ from .config.downloads import retrieve_file, urls_from_file
27
+
28
+ EXAMPLE_BASE_INFO = dict(
29
+ name="package",
30
+ version="0.0.1",
31
+ author="Foo Bar",
32
+ author_email="foo@bar.net",
33
+ long_description="Long\ndescription",
34
+ description="Short description",
35
+ keywords=["one", "two"],
36
+ )
37
+
38
+
39
+ @pytest.mark.parametrize(
40
+ ("content", "result"),
41
+ (
42
+ pytest.param(
43
+ "Just a single line",
44
+ None,
45
+ id="single_line",
46
+ ),
47
+ pytest.param(
48
+ "Multiline\nText\nwithout\nextra indents\n",
49
+ None,
50
+ id="multiline",
51
+ ),
52
+ pytest.param(
53
+ "Multiline\n With\n\nadditional\n indentation",
54
+ None,
55
+ id="multiline_with_indentation",
56
+ ),
57
+ pytest.param(
58
+ " Leading whitespace",
59
+ "Leading whitespace",
60
+ id="remove_leading_whitespace",
61
+ ),
62
+ pytest.param(
63
+ " Leading whitespace\nIn\n Multiline comment",
64
+ "Leading whitespace\nIn\n Multiline comment",
65
+ id="remove_leading_whitespace_multiline",
66
+ ),
67
+ ),
68
+ )
69
+ def test_rfc822_unescape(content, result):
70
+ assert (result or content) == rfc822_unescape(rfc822_escape(content))
71
+
72
+
73
+ def __read_test_cases():
74
+ base = EXAMPLE_BASE_INFO
75
+
76
+ params = functools.partial(dict, base)
77
+
78
+ return [
79
+ ('Metadata version 1.0', params()),
80
+ (
81
+ 'Metadata Version 1.0: Short long description',
82
+ params(
83
+ long_description='Short long description',
84
+ ),
85
+ ),
86
+ (
87
+ 'Metadata version 1.1: Classifiers',
88
+ params(
89
+ classifiers=[
90
+ 'Programming Language :: Python :: 3',
91
+ 'Programming Language :: Python :: 3.7',
92
+ 'License :: OSI Approved :: MIT License',
93
+ ],
94
+ ),
95
+ ),
96
+ (
97
+ 'Metadata version 1.1: Download URL',
98
+ params(
99
+ download_url='https://example.com',
100
+ ),
101
+ ),
102
+ (
103
+ 'Metadata Version 1.2: Requires-Python',
104
+ params(
105
+ python_requires='>=3.7',
106
+ ),
107
+ ),
108
+ pytest.param(
109
+ 'Metadata Version 1.2: Project-Url',
110
+ params(project_urls=dict(Foo='https://example.bar')),
111
+ marks=pytest.mark.xfail(
112
+ reason="Issue #1578: project_urls not read",
113
+ ),
114
+ ),
115
+ (
116
+ 'Metadata Version 2.1: Long Description Content Type',
117
+ params(
118
+ long_description_content_type='text/x-rst; charset=UTF-8',
119
+ ),
120
+ ),
121
+ (
122
+ 'License',
123
+ params(
124
+ license='MIT',
125
+ ),
126
+ ),
127
+ (
128
+ 'License multiline',
129
+ params(
130
+ license='This is a long license \nover multiple lines',
131
+ ),
132
+ ),
133
+ pytest.param(
134
+ 'Metadata Version 2.1: Provides Extra',
135
+ params(provides_extras=['foo', 'bar']),
136
+ marks=pytest.mark.xfail(reason="provides_extras not read"),
137
+ ),
138
+ (
139
+ 'Missing author',
140
+ dict(
141
+ name='foo',
142
+ version='1.0.0',
143
+ author_email='snorri@sturluson.name',
144
+ ),
145
+ ),
146
+ (
147
+ 'Missing author e-mail',
148
+ dict(
149
+ name='foo',
150
+ version='1.0.0',
151
+ author='Snorri Sturluson',
152
+ ),
153
+ ),
154
+ (
155
+ 'Missing author and e-mail',
156
+ dict(
157
+ name='foo',
158
+ version='1.0.0',
159
+ ),
160
+ ),
161
+ (
162
+ 'Bypass normalized version',
163
+ dict(
164
+ name='foo',
165
+ version=sic('1.0.0a'),
166
+ ),
167
+ ),
168
+ ]
169
+
170
+
171
+ @pytest.mark.parametrize(("name", "attrs"), __read_test_cases())
172
+ def test_read_metadata(name, attrs):
173
+ dist = Distribution(attrs)
174
+ metadata_out = dist.metadata
175
+ dist_class = metadata_out.__class__
176
+
177
+ # Write to PKG_INFO and then load into a new metadata object
178
+ PKG_INFO = io.StringIO()
179
+
180
+ metadata_out.write_pkg_file(PKG_INFO)
181
+ PKG_INFO.seek(0)
182
+ pkg_info = PKG_INFO.read()
183
+ assert _valid_metadata(pkg_info)
184
+
185
+ PKG_INFO.seek(0)
186
+ metadata_in = dist_class()
187
+ metadata_in.read_pkg_file(PKG_INFO)
188
+
189
+ tested_attrs = [
190
+ ('name', dist_class.get_name),
191
+ ('version', dist_class.get_version),
192
+ ('author', dist_class.get_contact),
193
+ ('author_email', dist_class.get_contact_email),
194
+ ('metadata_version', dist_class.get_metadata_version),
195
+ ('provides', dist_class.get_provides),
196
+ ('description', dist_class.get_description),
197
+ ('long_description', dist_class.get_long_description),
198
+ ('download_url', dist_class.get_download_url),
199
+ ('keywords', dist_class.get_keywords),
200
+ ('platforms', dist_class.get_platforms),
201
+ ('obsoletes', dist_class.get_obsoletes),
202
+ ('requires', dist_class.get_requires),
203
+ ('classifiers', dist_class.get_classifiers),
204
+ ('project_urls', lambda s: getattr(s, 'project_urls', {})),
205
+ ('provides_extras', lambda s: getattr(s, 'provides_extras', {})),
206
+ ]
207
+
208
+ for attr, getter in tested_attrs:
209
+ assert getter(metadata_in) == getter(metadata_out)
210
+
211
+
212
+ def __maintainer_test_cases():
213
+ attrs = {"name": "package", "version": "1.0", "description": "xxx"}
214
+
215
+ def merge_dicts(d1, d2):
216
+ d1 = d1.copy()
217
+ d1.update(d2)
218
+
219
+ return d1
220
+
221
+ return [
222
+ ('No author, no maintainer', attrs.copy()),
223
+ (
224
+ 'Author (no e-mail), no maintainer',
225
+ merge_dicts(attrs, {'author': 'Author Name'}),
226
+ ),
227
+ (
228
+ 'Author (e-mail), no maintainer',
229
+ merge_dicts(
230
+ attrs, {'author': 'Author Name', 'author_email': 'author@name.com'}
231
+ ),
232
+ ),
233
+ (
234
+ 'No author, maintainer (no e-mail)',
235
+ merge_dicts(attrs, {'maintainer': 'Maintainer Name'}),
236
+ ),
237
+ (
238
+ 'No author, maintainer (e-mail)',
239
+ merge_dicts(
240
+ attrs,
241
+ {
242
+ 'maintainer': 'Maintainer Name',
243
+ 'maintainer_email': 'maintainer@name.com',
244
+ },
245
+ ),
246
+ ),
247
+ (
248
+ 'Author (no e-mail), Maintainer (no-email)',
249
+ merge_dicts(
250
+ attrs, {'author': 'Author Name', 'maintainer': 'Maintainer Name'}
251
+ ),
252
+ ),
253
+ (
254
+ 'Author (e-mail), Maintainer (e-mail)',
255
+ merge_dicts(
256
+ attrs,
257
+ {
258
+ 'author': 'Author Name',
259
+ 'author_email': 'author@name.com',
260
+ 'maintainer': 'Maintainer Name',
261
+ 'maintainer_email': 'maintainer@name.com',
262
+ },
263
+ ),
264
+ ),
265
+ (
266
+ 'No author (e-mail), no maintainer (e-mail)',
267
+ merge_dicts(
268
+ attrs,
269
+ {
270
+ 'author_email': 'author@name.com',
271
+ 'maintainer_email': 'maintainer@name.com',
272
+ },
273
+ ),
274
+ ),
275
+ ('Author unicode', merge_dicts(attrs, {'author': '鉄沢寛'})),
276
+ ('Maintainer unicode', merge_dicts(attrs, {'maintainer': 'Jan Łukasiewicz'})),
277
+ ]
278
+
279
+
280
+ @pytest.mark.parametrize(("name", "attrs"), __maintainer_test_cases())
281
+ def test_maintainer_author(name, attrs, tmpdir):
282
+ tested_keys = {
283
+ 'author': 'Author',
284
+ 'author_email': 'Author-email',
285
+ 'maintainer': 'Maintainer',
286
+ 'maintainer_email': 'Maintainer-email',
287
+ }
288
+
289
+ # Generate a PKG-INFO file
290
+ dist = Distribution(attrs)
291
+ fn = tmpdir.mkdir('pkg_info')
292
+ fn_s = str(fn)
293
+
294
+ dist.metadata.write_pkg_info(fn_s)
295
+
296
+ with open(str(fn.join('PKG-INFO')), 'r', encoding='utf-8') as f:
297
+ pkg_info = f.read()
298
+
299
+ assert _valid_metadata(pkg_info)
300
+
301
+ # Drop blank lines and strip lines from default description
302
+ raw_pkg_lines = pkg_info.splitlines()
303
+ pkg_lines = list(filter(None, raw_pkg_lines[:-2]))
304
+
305
+ pkg_lines_set = set(pkg_lines)
306
+
307
+ # Duplicate lines should not be generated
308
+ assert len(pkg_lines) == len(pkg_lines_set)
309
+
310
+ for fkey, dkey in tested_keys.items():
311
+ val = attrs.get(dkey, None)
312
+ if val is None:
313
+ for line in pkg_lines:
314
+ assert not line.startswith(fkey + ':')
315
+ else:
316
+ line = f'{fkey}: {val}'
317
+ assert line in pkg_lines_set
318
+
319
+
320
+ class TestParityWithMetadataFromPyPaWheel:
321
+ def base_example(self):
322
+ attrs = dict(
323
+ **EXAMPLE_BASE_INFO,
324
+ # Example with complex requirement definition
325
+ python_requires=">=3.8",
326
+ install_requires="""
327
+ packaging==23.2
328
+ more-itertools==8.8.0; extra == "other"
329
+ jaraco.text==3.7.0
330
+ importlib-resources==5.10.2; python_version<"3.8"
331
+ importlib-metadata==6.0.0 ; python_version<"3.8"
332
+ colorama>=0.4.4; sys_platform == "win32"
333
+ """,
334
+ extras_require={
335
+ "testing": """
336
+ pytest >= 6
337
+ pytest-checkdocs >= 2.4
338
+ tomli ; \\
339
+ # Using stdlib when possible
340
+ python_version < "3.11"
341
+ ini2toml[lite]>=0.9
342
+ """,
343
+ "other": [],
344
+ },
345
+ )
346
+ # Generate a PKG-INFO file using setuptools
347
+ return Distribution(attrs)
348
+
349
+ def test_requires_dist(self, tmp_path):
350
+ dist = self.base_example()
351
+ pkg_info = _get_pkginfo(dist)
352
+ assert _valid_metadata(pkg_info)
353
+
354
+ # Ensure Requires-Dist is present
355
+ expected = [
356
+ 'Metadata-Version:',
357
+ 'Requires-Python: >=3.8',
358
+ 'Provides-Extra: other',
359
+ 'Provides-Extra: testing',
360
+ 'Requires-Dist: tomli; python_version < "3.11" and extra == "testing"',
361
+ 'Requires-Dist: more-itertools==8.8.0; extra == "other"',
362
+ 'Requires-Dist: ini2toml[lite]>=0.9; extra == "testing"',
363
+ ]
364
+ for line in expected:
365
+ assert line in pkg_info
366
+
367
+ HERE = Path(__file__).parent
368
+ EXAMPLES_FILE = HERE / "config/setupcfg_examples.txt"
369
+
370
+ @pytest.fixture(params=[None, *urls_from_file(EXAMPLES_FILE)])
371
+ def dist(self, request, monkeypatch, tmp_path):
372
+ """Example of distribution with arbitrary configuration"""
373
+ monkeypatch.chdir(tmp_path)
374
+ monkeypatch.setattr(expand, "read_attr", Mock(return_value="0.42"))
375
+ monkeypatch.setattr(expand, "read_files", Mock(return_value="hello world"))
376
+ monkeypatch.setattr(
377
+ Distribution, "_finalize_license_files", Mock(return_value=None)
378
+ )
379
+ if request.param is None:
380
+ yield self.base_example()
381
+ else:
382
+ # Real-world usage
383
+ config = retrieve_file(request.param)
384
+ yield setupcfg.apply_configuration(Distribution({}), config)
385
+
386
+ @pytest.mark.uses_network
387
+ def test_equivalent_output(self, tmp_path, dist):
388
+ """Ensure output from setuptools is equivalent to the one from `pypa/wheel`"""
389
+ # Generate a METADATA file using pypa/wheel for comparison
390
+ wheel_metadata = importlib.import_module("wheel.metadata")
391
+ pkginfo_to_metadata = getattr(wheel_metadata, "pkginfo_to_metadata", None)
392
+
393
+ if pkginfo_to_metadata is None: # pragma: nocover
394
+ pytest.xfail(
395
+ "wheel.metadata.pkginfo_to_metadata is undefined, "
396
+ "(this is likely to be caused by API changes in pypa/wheel"
397
+ )
398
+
399
+ # Generate an simplified "egg-info" dir for pypa/wheel to convert
400
+ pkg_info = _get_pkginfo(dist)
401
+ egg_info_dir = tmp_path / "pkg.egg-info"
402
+ egg_info_dir.mkdir(parents=True)
403
+ (egg_info_dir / "PKG-INFO").write_text(pkg_info, encoding="utf-8")
404
+ write_requirements(egg_info(dist), egg_info_dir, egg_info_dir / "requires.txt")
405
+
406
+ # Get pypa/wheel generated METADATA but normalize requirements formatting
407
+ metadata_msg = pkginfo_to_metadata(egg_info_dir, egg_info_dir / "PKG-INFO")
408
+ metadata_str = _normalize_metadata(metadata_msg)
409
+ pkg_info_msg = message_from_string(pkg_info)
410
+ pkg_info_str = _normalize_metadata(pkg_info_msg)
411
+
412
+ # Compare setuptools PKG-INFO x pypa/wheel METADATA
413
+ assert metadata_str == pkg_info_str
414
+
415
+ # Make sure it parses/serializes well in pypa/wheel
416
+ _assert_roundtrip_message(pkg_info)
417
+
418
+
419
+ class TestPEP643:
420
+ STATIC_CONFIG = {
421
+ "setup.cfg": cleandoc(
422
+ """
423
+ [metadata]
424
+ name = package
425
+ version = 0.0.1
426
+ author = Foo Bar
427
+ author_email = foo@bar.net
428
+ long_description = Long
429
+ description
430
+ description = Short description
431
+ keywords = one, two
432
+ platforms = abcd
433
+ [options]
434
+ install_requires = requests
435
+ """
436
+ ),
437
+ "pyproject.toml": cleandoc(
438
+ """
439
+ [project]
440
+ name = "package"
441
+ version = "0.0.1"
442
+ authors = [
443
+ {name = "Foo Bar", email = "foo@bar.net"}
444
+ ]
445
+ description = "Short description"
446
+ readme = {text = "Long\\ndescription", content-type = "text/plain"}
447
+ keywords = ["one", "two"]
448
+ dependencies = ["requests"]
449
+ license = "AGPL-3.0-or-later"
450
+ [tool.setuptools]
451
+ provides = ["abcd"]
452
+ obsoletes = ["abcd"]
453
+ """
454
+ ),
455
+ }
456
+
457
+ @pytest.mark.parametrize("file", STATIC_CONFIG.keys())
458
+ def test_static_config_has_no_dynamic(self, file, tmpdir_cwd):
459
+ Path(file).write_text(self.STATIC_CONFIG[file], encoding="utf-8")
460
+ metadata = _get_metadata()
461
+ assert metadata.get_all("Dynamic") is None
462
+ assert metadata.get_all("dynamic") is None
463
+
464
+ @pytest.mark.parametrize("file", STATIC_CONFIG.keys())
465
+ @pytest.mark.parametrize(
466
+ "fields",
467
+ [
468
+ # Single dynamic field
469
+ {"requires-python": ("python_requires", ">=3.12")},
470
+ {"author-email": ("author_email", "snoopy@peanuts.com")},
471
+ {"keywords": ("keywords", ["hello", "world"])},
472
+ {"platform": ("platforms", ["abcd"])},
473
+ # Multiple dynamic fields
474
+ {
475
+ "summary": ("description", "hello world"),
476
+ "description": ("long_description", "bla bla bla bla"),
477
+ "requires-dist": ("install_requires", ["hello-world"]),
478
+ },
479
+ ],
480
+ )
481
+ def test_modified_fields_marked_as_dynamic(self, file, fields, tmpdir_cwd):
482
+ # We start with a static config
483
+ Path(file).write_text(self.STATIC_CONFIG[file], encoding="utf-8")
484
+ dist = _makedist()
485
+
486
+ # ... but then we simulate the effects of a plugin modifying the distribution
487
+ for attr, value in fields.values():
488
+ # `dist` and `dist.metadata` are complicated...
489
+ # Some attributes work when set on `dist`, others on `dist.metadata`...
490
+ # Here we set in both just in case (this also avoids calling `_finalize_*`)
491
+ setattr(dist, attr, value)
492
+ setattr(dist.metadata, attr, value)
493
+
494
+ # Then we should be able to list the modified fields as Dynamic
495
+ metadata = _get_metadata(dist)
496
+ assert set(metadata.get_all("Dynamic")) == set(fields)
497
+
498
+ @pytest.mark.parametrize(
499
+ "extra_toml",
500
+ [
501
+ "# Let setuptools autofill license-files",
502
+ "license-files = ['LICENSE*', 'AUTHORS*', 'NOTICE']",
503
+ ],
504
+ )
505
+ def test_license_files_dynamic(self, extra_toml, tmpdir_cwd):
506
+ # For simplicity (and for the time being) setuptools is not making
507
+ # any special handling to guarantee `License-File` is considered static.
508
+ # Instead we rely in the fact that, although suboptimal, it is OK to have
509
+ # it as dynamics, as per:
510
+ # https://github.com/pypa/setuptools/issues/4629#issuecomment-2331233677
511
+ files = {
512
+ "pyproject.toml": self.STATIC_CONFIG["pyproject.toml"].replace(
513
+ 'license = "AGPL-3.0-or-later"',
514
+ f"dynamic = ['license']\n{extra_toml}",
515
+ ),
516
+ "LICENSE.md": "--- mock license ---",
517
+ "NOTICE": "--- mock notice ---",
518
+ "AUTHORS.txt": "--- me ---",
519
+ }
520
+ # Sanity checks:
521
+ assert extra_toml in files["pyproject.toml"]
522
+ assert 'license = "AGPL-3.0-or-later"' not in extra_toml
523
+
524
+ jaraco.path.build(files)
525
+ dist = _makedist(license_expression="AGPL-3.0-or-later")
526
+ metadata = _get_metadata(dist)
527
+ assert set(metadata.get_all("Dynamic")) == {
528
+ 'license-file',
529
+ 'license-expression',
530
+ }
531
+ assert metadata.get("License-Expression") == "AGPL-3.0-or-later"
532
+ assert set(metadata.get_all("License-File")) == {
533
+ "NOTICE",
534
+ "AUTHORS.txt",
535
+ "LICENSE.md",
536
+ }
537
+
538
+
539
+ def _makedist(**attrs):
540
+ dist = Distribution(attrs)
541
+ dist.parse_config_files()
542
+ return dist
543
+
544
+
545
+ def _assert_roundtrip_message(metadata: str) -> None:
546
+ """Emulate the way wheel.bdist_wheel parses and regenerates the message,
547
+ then ensures the metadata generated by setuptools is compatible.
548
+ """
549
+ with io.StringIO(metadata) as buffer:
550
+ msg = Parser(EmailMessage).parse(buffer)
551
+
552
+ serialization_policy = EmailPolicy(
553
+ utf8=True,
554
+ mangle_from_=False,
555
+ max_line_length=0,
556
+ )
557
+ with io.BytesIO() as buffer:
558
+ out = io.TextIOWrapper(buffer, encoding="utf-8")
559
+ Generator(out, policy=serialization_policy).flatten(msg)
560
+ out.flush()
561
+ regenerated = buffer.getvalue()
562
+
563
+ raw_metadata = bytes(metadata, "utf-8")
564
+ # Normalise newlines to avoid test errors on Windows:
565
+ raw_metadata = b"\n".join(raw_metadata.splitlines())
566
+ regenerated = b"\n".join(regenerated.splitlines())
567
+ assert regenerated == raw_metadata
568
+
569
+
570
+ def _normalize_metadata(msg: Message) -> str:
571
+ """Allow equivalent metadata to be compared directly"""
572
+ # The main challenge regards the requirements and extras.
573
+ # Both setuptools and wheel already apply some level of normalization
574
+ # but they differ regarding which character is chosen, according to the
575
+ # following spec it should be "-":
576
+ # https://packaging.python.org/en/latest/specifications/name-normalization/
577
+
578
+ # Related issues:
579
+ # https://github.com/pypa/packaging/issues/845
580
+ # https://github.com/pypa/packaging/issues/644#issuecomment-2429813968
581
+
582
+ extras = {x.replace("_", "-"): x for x in msg.get_all("Provides-Extra", [])}
583
+ reqs = [
584
+ _normalize_req(req, extras)
585
+ for req in _reqs.parse(msg.get_all("Requires-Dist", []))
586
+ ]
587
+ del msg["Requires-Dist"]
588
+ del msg["Provides-Extra"]
589
+
590
+ # Ensure consistent ord
591
+ for req in sorted(reqs):
592
+ msg["Requires-Dist"] = req
593
+ for extra in sorted(extras):
594
+ msg["Provides-Extra"] = extra
595
+
596
+ # TODO: Handle lack of PEP 643 implementation in pypa/wheel?
597
+ del msg["Metadata-Version"]
598
+
599
+ return msg.as_string()
600
+
601
+
602
+ def _normalize_req(req: Requirement, extras: dict[str, str]) -> str:
603
+ """Allow equivalent requirement objects to be compared directly"""
604
+ as_str = str(req).replace(req.name, req.name.replace("_", "-"))
605
+ for norm, orig in extras.items():
606
+ as_str = as_str.replace(orig, norm)
607
+ return as_str
608
+
609
+
610
+ def _get_pkginfo(dist: Distribution):
611
+ with io.StringIO() as fp:
612
+ dist.metadata.write_pkg_file(fp)
613
+ return fp.getvalue()
614
+
615
+
616
+ def _get_metadata(dist: Distribution | None = None):
617
+ return message_from_string(_get_pkginfo(dist or _makedist()))
618
+
619
+
620
+ def _valid_metadata(text: str) -> bool:
621
+ metadata = Metadata.from_email(text, validate=True) # can raise exceptions
622
+ return metadata is not None
.venv/lib/python3.12/site-packages/setuptools/tests/test_depends.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import sys
2
+
3
+ from setuptools import depends
4
+
5
+
6
+ class TestGetModuleConstant:
7
+ def test_basic(self):
8
+ """
9
+ Invoke get_module_constant on a module in
10
+ the test package.
11
+ """
12
+ mod_name = 'setuptools.tests.mod_with_constant'
13
+ val = depends.get_module_constant(mod_name, 'value')
14
+ assert val == 'three, sir!'
15
+ assert 'setuptools.tests.mod_with_constant' not in sys.modules
.venv/lib/python3.12/site-packages/setuptools/tests/test_develop.py ADDED
@@ -0,0 +1,175 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """develop tests"""
2
+
3
+ import os
4
+ import pathlib
5
+ import platform
6
+ import subprocess
7
+ import sys
8
+
9
+ import pytest
10
+
11
+ from setuptools._path import paths_on_pythonpath
12
+ from setuptools.command.develop import develop
13
+ from setuptools.dist import Distribution
14
+
15
+ from . import contexts, namespaces
16
+
17
+ SETUP_PY = """\
18
+ from setuptools import setup
19
+
20
+ setup(name='foo',
21
+ packages=['foo'],
22
+ )
23
+ """
24
+
25
+ INIT_PY = """print "foo"
26
+ """
27
+
28
+
29
+ @pytest.fixture
30
+ def temp_user(monkeypatch):
31
+ with contexts.tempdir() as user_base:
32
+ with contexts.tempdir() as user_site:
33
+ monkeypatch.setattr('site.USER_BASE', user_base)
34
+ monkeypatch.setattr('site.USER_SITE', user_site)
35
+ yield
36
+
37
+
38
+ @pytest.fixture
39
+ def test_env(tmpdir, temp_user):
40
+ target = tmpdir
41
+ foo = target.mkdir('foo')
42
+ setup = target / 'setup.py'
43
+ if setup.isfile():
44
+ raise ValueError(dir(target))
45
+ with setup.open('w') as f:
46
+ f.write(SETUP_PY)
47
+ init = foo / '__init__.py'
48
+ with init.open('w') as f:
49
+ f.write(INIT_PY)
50
+ with target.as_cwd():
51
+ yield target
52
+
53
+
54
+ class TestDevelop:
55
+ in_virtualenv = hasattr(sys, 'real_prefix')
56
+ in_venv = hasattr(sys, 'base_prefix') and sys.base_prefix != sys.prefix
57
+
58
+ def test_console_scripts(self, tmpdir):
59
+ """
60
+ Test that console scripts are installed and that they reference
61
+ only the project by name and not the current version.
62
+ """
63
+ pytest.skip(
64
+ "TODO: needs a fixture to cause 'develop' "
65
+ "to be invoked without mutating environment."
66
+ )
67
+ settings = dict(
68
+ name='foo',
69
+ packages=['foo'],
70
+ version='0.0',
71
+ entry_points={
72
+ 'console_scripts': [
73
+ 'foocmd = foo:foo',
74
+ ],
75
+ },
76
+ )
77
+ dist = Distribution(settings)
78
+ dist.script_name = 'setup.py'
79
+ cmd = develop(dist)
80
+ cmd.ensure_finalized()
81
+ cmd.install_dir = tmpdir
82
+ cmd.run()
83
+ # assert '0.0' not in foocmd_text
84
+
85
+ @pytest.mark.xfail(reason="legacy behavior retained for compatibility #4167")
86
+ def test_egg_link_filename(self):
87
+ settings = dict(
88
+ name='Foo $$$ Bar_baz-bing',
89
+ )
90
+ dist = Distribution(settings)
91
+ cmd = develop(dist)
92
+ cmd.ensure_finalized()
93
+ link = pathlib.Path(cmd.egg_link)
94
+ assert link.suffix == '.egg-link'
95
+ assert link.stem == 'Foo_Bar_baz_bing'
96
+
97
+
98
+ class TestResolver:
99
+ """
100
+ TODO: These tests were written with a minimal understanding
101
+ of what _resolve_setup_path is intending to do. Come up with
102
+ more meaningful cases that look like real-world scenarios.
103
+ """
104
+
105
+ def test_resolve_setup_path_cwd(self):
106
+ assert develop._resolve_setup_path('.', '.', '.') == '.'
107
+
108
+ def test_resolve_setup_path_one_dir(self):
109
+ assert develop._resolve_setup_path('pkgs', '.', 'pkgs') == '../'
110
+
111
+ def test_resolve_setup_path_one_dir_trailing_slash(self):
112
+ assert develop._resolve_setup_path('pkgs/', '.', 'pkgs') == '../'
113
+
114
+
115
+ class TestNamespaces:
116
+ @staticmethod
117
+ def install_develop(src_dir, target):
118
+ develop_cmd = [
119
+ sys.executable,
120
+ 'setup.py',
121
+ 'develop',
122
+ '--install-dir',
123
+ str(target),
124
+ ]
125
+ with src_dir.as_cwd():
126
+ with paths_on_pythonpath([str(target)]):
127
+ subprocess.check_call(develop_cmd)
128
+
129
+ @pytest.mark.skipif(
130
+ bool(os.environ.get("APPVEYOR")),
131
+ reason="https://github.com/pypa/setuptools/issues/851",
132
+ )
133
+ @pytest.mark.skipif(
134
+ platform.python_implementation() == 'PyPy',
135
+ reason="https://github.com/pypa/setuptools/issues/1202",
136
+ )
137
+ def test_namespace_package_importable(self, tmpdir):
138
+ """
139
+ Installing two packages sharing the same namespace, one installed
140
+ naturally using pip or `--single-version-externally-managed`
141
+ and the other installed using `develop` should leave the namespace
142
+ in tact and both packages reachable by import.
143
+ """
144
+ pkg_A = namespaces.build_namespace_package(tmpdir, 'myns.pkgA')
145
+ pkg_B = namespaces.build_namespace_package(tmpdir, 'myns.pkgB')
146
+ target = tmpdir / 'packages'
147
+ # use pip to install to the target directory
148
+ install_cmd = [
149
+ sys.executable,
150
+ '-m',
151
+ 'pip',
152
+ 'install',
153
+ str(pkg_A),
154
+ '-t',
155
+ str(target),
156
+ ]
157
+ subprocess.check_call(install_cmd)
158
+ self.install_develop(pkg_B, target)
159
+ namespaces.make_site_dir(target)
160
+ try_import = [
161
+ sys.executable,
162
+ '-c',
163
+ 'import myns.pkgA; import myns.pkgB',
164
+ ]
165
+ with paths_on_pythonpath([str(target)]):
166
+ subprocess.check_call(try_import)
167
+
168
+ # additionally ensure that pkg_resources import works
169
+ pkg_resources_imp = [
170
+ sys.executable,
171
+ '-c',
172
+ 'import pkg_resources',
173
+ ]
174
+ with paths_on_pythonpath([str(target)]):
175
+ subprocess.check_call(pkg_resources_imp)
.venv/lib/python3.12/site-packages/setuptools/tests/test_dist.py ADDED
@@ -0,0 +1,278 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import re
3
+ import urllib.parse
4
+ import urllib.request
5
+
6
+ import pytest
7
+
8
+ from setuptools import Distribution
9
+ from setuptools.dist import check_package_data, check_specifier
10
+
11
+ from .test_easy_install import make_trivial_sdist
12
+ from .test_find_packages import ensure_files
13
+ from .textwrap import DALS
14
+
15
+ from distutils.errors import DistutilsSetupError
16
+
17
+
18
+ def test_dist_fetch_build_egg(tmpdir):
19
+ """
20
+ Check multiple calls to `Distribution.fetch_build_egg` work as expected.
21
+ """
22
+ index = tmpdir.mkdir('index')
23
+ index_url = urllib.parse.urljoin('file://', urllib.request.pathname2url(str(index)))
24
+
25
+ def sdist_with_index(distname, version):
26
+ dist_dir = index.mkdir(distname)
27
+ dist_sdist = f'{distname}-{version}.tar.gz'
28
+ make_trivial_sdist(str(dist_dir.join(dist_sdist)), distname, version)
29
+ with dist_dir.join('index.html').open('w') as fp:
30
+ fp.write(
31
+ DALS(
32
+ """
33
+ <!DOCTYPE html><html><body>
34
+ <a href="{dist_sdist}" rel="internal">{dist_sdist}</a><br/>
35
+ </body></html>
36
+ """
37
+ ).format(dist_sdist=dist_sdist)
38
+ )
39
+
40
+ sdist_with_index('barbazquux', '3.2.0')
41
+ sdist_with_index('barbazquux-runner', '2.11.1')
42
+ with tmpdir.join('setup.cfg').open('w') as fp:
43
+ fp.write(
44
+ DALS(
45
+ """
46
+ [easy_install]
47
+ index_url = {index_url}
48
+ """
49
+ ).format(index_url=index_url)
50
+ )
51
+ reqs = """
52
+ barbazquux-runner
53
+ barbazquux
54
+ """.split()
55
+ with tmpdir.as_cwd():
56
+ dist = Distribution()
57
+ dist.parse_config_files()
58
+ resolved_dists = [dist.fetch_build_egg(r) for r in reqs]
59
+ assert [dist.key for dist in resolved_dists if dist] == reqs
60
+
61
+
62
+ EXAMPLE_BASE_INFO = dict(
63
+ name="package",
64
+ version="0.0.1",
65
+ author="Foo Bar",
66
+ author_email="foo@bar.net",
67
+ long_description="Long\ndescription",
68
+ description="Short description",
69
+ keywords=["one", "two"],
70
+ )
71
+
72
+
73
+ def test_provides_extras_deterministic_order():
74
+ attrs = dict(extras_require=dict(a=['foo'], b=['bar']))
75
+ dist = Distribution(attrs)
76
+ assert list(dist.metadata.provides_extras) == ['a', 'b']
77
+ attrs['extras_require'] = dict(reversed(attrs['extras_require'].items()))
78
+ dist = Distribution(attrs)
79
+ assert list(dist.metadata.provides_extras) == ['b', 'a']
80
+
81
+
82
+ CHECK_PACKAGE_DATA_TESTS = (
83
+ # Valid.
84
+ (
85
+ {
86
+ '': ['*.txt', '*.rst'],
87
+ 'hello': ['*.msg'],
88
+ },
89
+ None,
90
+ ),
91
+ # Not a dictionary.
92
+ (
93
+ (
94
+ ('', ['*.txt', '*.rst']),
95
+ ('hello', ['*.msg']),
96
+ ),
97
+ (
98
+ "'package_data' must be a dictionary mapping package"
99
+ " names to lists of string wildcard patterns"
100
+ ),
101
+ ),
102
+ # Invalid key type.
103
+ (
104
+ {
105
+ 400: ['*.txt', '*.rst'],
106
+ },
107
+ ("keys of 'package_data' dict must be strings (got 400)"),
108
+ ),
109
+ # Invalid value type.
110
+ (
111
+ {
112
+ 'hello': '*.msg',
113
+ },
114
+ (
115
+ "\"values of 'package_data' dict\" must be of type <tuple[str, ...] | list[str]>"
116
+ " (got '*.msg')"
117
+ ),
118
+ ),
119
+ # Invalid value type (generators are single use)
120
+ (
121
+ {
122
+ 'hello': (x for x in "generator"),
123
+ },
124
+ (
125
+ "\"values of 'package_data' dict\" must be of type <tuple[str, ...] | list[str]>"
126
+ " (got <generator object"
127
+ ),
128
+ ),
129
+ )
130
+
131
+
132
+ @pytest.mark.parametrize(('package_data', 'expected_message'), CHECK_PACKAGE_DATA_TESTS)
133
+ def test_check_package_data(package_data, expected_message):
134
+ if expected_message is None:
135
+ assert check_package_data(None, 'package_data', package_data) is None
136
+ else:
137
+ with pytest.raises(DistutilsSetupError, match=re.escape(expected_message)):
138
+ check_package_data(None, 'package_data', package_data)
139
+
140
+
141
+ def test_check_specifier():
142
+ # valid specifier value
143
+ attrs = {'name': 'foo', 'python_requires': '>=3.0, !=3.1'}
144
+ dist = Distribution(attrs)
145
+ check_specifier(dist, attrs, attrs['python_requires'])
146
+
147
+ attrs = {'name': 'foo', 'python_requires': ['>=3.0', '!=3.1']}
148
+ dist = Distribution(attrs)
149
+ check_specifier(dist, attrs, attrs['python_requires'])
150
+
151
+ # invalid specifier value
152
+ attrs = {'name': 'foo', 'python_requires': '>=invalid-version'}
153
+ with pytest.raises(DistutilsSetupError):
154
+ dist = Distribution(attrs)
155
+
156
+
157
+ def test_metadata_name():
158
+ with pytest.raises(DistutilsSetupError, match='missing.*name'):
159
+ Distribution()._validate_metadata()
160
+
161
+
162
+ @pytest.mark.parametrize(
163
+ ('dist_name', 'py_module'),
164
+ [
165
+ ("my.pkg", "my_pkg"),
166
+ ("my-pkg", "my_pkg"),
167
+ ("my_pkg", "my_pkg"),
168
+ ("pkg", "pkg"),
169
+ ],
170
+ )
171
+ def test_dist_default_py_modules(tmp_path, dist_name, py_module):
172
+ (tmp_path / f"{py_module}.py").touch()
173
+
174
+ (tmp_path / "setup.py").touch()
175
+ (tmp_path / "noxfile.py").touch()
176
+ # ^-- make sure common tool files are ignored
177
+
178
+ attrs = {**EXAMPLE_BASE_INFO, "name": dist_name, "src_root": str(tmp_path)}
179
+ # Find `py_modules` corresponding to dist_name if not given
180
+ dist = Distribution(attrs)
181
+ dist.set_defaults()
182
+ assert dist.py_modules == [py_module]
183
+ # When `py_modules` is given, don't do anything
184
+ dist = Distribution({**attrs, "py_modules": ["explicity_py_module"]})
185
+ dist.set_defaults()
186
+ assert dist.py_modules == ["explicity_py_module"]
187
+ # When `packages` is given, don't do anything
188
+ dist = Distribution({**attrs, "packages": ["explicity_package"]})
189
+ dist.set_defaults()
190
+ assert not dist.py_modules
191
+
192
+
193
+ @pytest.mark.parametrize(
194
+ ('dist_name', 'package_dir', 'package_files', 'packages'),
195
+ [
196
+ ("my.pkg", None, ["my_pkg/__init__.py", "my_pkg/mod.py"], ["my_pkg"]),
197
+ ("my-pkg", None, ["my_pkg/__init__.py", "my_pkg/mod.py"], ["my_pkg"]),
198
+ ("my_pkg", None, ["my_pkg/__init__.py", "my_pkg/mod.py"], ["my_pkg"]),
199
+ ("my.pkg", None, ["my/pkg/__init__.py"], ["my", "my.pkg"]),
200
+ (
201
+ "my_pkg",
202
+ None,
203
+ ["src/my_pkg/__init__.py", "src/my_pkg2/__init__.py"],
204
+ ["my_pkg", "my_pkg2"],
205
+ ),
206
+ (
207
+ "my_pkg",
208
+ {"pkg": "lib", "pkg2": "lib2"},
209
+ ["lib/__init__.py", "lib/nested/__init__.pyt", "lib2/__init__.py"],
210
+ ["pkg", "pkg.nested", "pkg2"],
211
+ ),
212
+ ],
213
+ )
214
+ def test_dist_default_packages(
215
+ tmp_path, dist_name, package_dir, package_files, packages
216
+ ):
217
+ ensure_files(tmp_path, package_files)
218
+
219
+ (tmp_path / "setup.py").touch()
220
+ (tmp_path / "noxfile.py").touch()
221
+ # ^-- should not be included by default
222
+
223
+ attrs = {
224
+ **EXAMPLE_BASE_INFO,
225
+ "name": dist_name,
226
+ "src_root": str(tmp_path),
227
+ "package_dir": package_dir,
228
+ }
229
+ # Find `packages` either corresponding to dist_name or inside src
230
+ dist = Distribution(attrs)
231
+ dist.set_defaults()
232
+ assert not dist.py_modules
233
+ assert not dist.py_modules
234
+ assert set(dist.packages) == set(packages)
235
+ # When `py_modules` is given, don't do anything
236
+ dist = Distribution({**attrs, "py_modules": ["explicit_py_module"]})
237
+ dist.set_defaults()
238
+ assert not dist.packages
239
+ assert set(dist.py_modules) == {"explicit_py_module"}
240
+ # When `packages` is given, don't do anything
241
+ dist = Distribution({**attrs, "packages": ["explicit_package"]})
242
+ dist.set_defaults()
243
+ assert not dist.py_modules
244
+ assert set(dist.packages) == {"explicit_package"}
245
+
246
+
247
+ @pytest.mark.parametrize(
248
+ ('dist_name', 'package_dir', 'package_files'),
249
+ [
250
+ ("my.pkg.nested", None, ["my/pkg/nested/__init__.py"]),
251
+ ("my.pkg", None, ["my/pkg/__init__.py", "my/pkg/file.py"]),
252
+ ("my_pkg", None, ["my_pkg.py"]),
253
+ ("my_pkg", None, ["my_pkg/__init__.py", "my_pkg/nested/__init__.py"]),
254
+ ("my_pkg", None, ["src/my_pkg/__init__.py", "src/my_pkg/nested/__init__.py"]),
255
+ (
256
+ "my_pkg",
257
+ {"my_pkg": "lib", "my_pkg.lib2": "lib2"},
258
+ ["lib/__init__.py", "lib/nested/__init__.pyt", "lib2/__init__.py"],
259
+ ),
260
+ # Should not try to guess a name from multiple py_modules/packages
261
+ ("UNKNOWN", None, ["src/mod1.py", "src/mod2.py"]),
262
+ ("UNKNOWN", None, ["src/pkg1/__ini__.py", "src/pkg2/__init__.py"]),
263
+ ],
264
+ )
265
+ def test_dist_default_name(tmp_path, dist_name, package_dir, package_files):
266
+ """Make sure dist.name is discovered from packages/py_modules"""
267
+ ensure_files(tmp_path, package_files)
268
+ attrs = {
269
+ **EXAMPLE_BASE_INFO,
270
+ "src_root": "/".join(os.path.split(tmp_path)), # POSIX-style
271
+ "package_dir": package_dir,
272
+ }
273
+ del attrs["name"]
274
+
275
+ dist = Distribution(attrs)
276
+ dist.set_defaults()
277
+ assert dist.py_modules or dist.packages
278
+ assert dist.get_name() == dist_name
.venv/lib/python3.12/site-packages/setuptools/tests/test_dist_info.py ADDED
@@ -0,0 +1,210 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Test .dist-info style distributions."""
2
+
3
+ import pathlib
4
+ import re
5
+ import shutil
6
+ import subprocess
7
+ import sys
8
+ from functools import partial
9
+
10
+ import pytest
11
+
12
+ import pkg_resources
13
+ from setuptools.archive_util import unpack_archive
14
+
15
+ from .textwrap import DALS
16
+
17
+ read = partial(pathlib.Path.read_text, encoding="utf-8")
18
+
19
+
20
+ class TestDistInfo:
21
+ metadata_base = DALS(
22
+ """
23
+ Metadata-Version: 1.2
24
+ Requires-Dist: splort (==4)
25
+ Provides-Extra: baz
26
+ Requires-Dist: quux (>=1.1); extra == 'baz'
27
+ """
28
+ )
29
+
30
+ @classmethod
31
+ def build_metadata(cls, **kwargs):
32
+ lines = ('{key}: {value}\n'.format(**locals()) for key, value in kwargs.items())
33
+ return cls.metadata_base + ''.join(lines)
34
+
35
+ @pytest.fixture
36
+ def metadata(self, tmpdir):
37
+ dist_info_name = 'VersionedDistribution-2.718.dist-info'
38
+ versioned = tmpdir / dist_info_name
39
+ versioned.mkdir()
40
+ filename = versioned / 'METADATA'
41
+ content = self.build_metadata(
42
+ Name='VersionedDistribution',
43
+ )
44
+ filename.write_text(content, encoding='utf-8')
45
+
46
+ dist_info_name = 'UnversionedDistribution.dist-info'
47
+ unversioned = tmpdir / dist_info_name
48
+ unversioned.mkdir()
49
+ filename = unversioned / 'METADATA'
50
+ content = self.build_metadata(
51
+ Name='UnversionedDistribution',
52
+ Version='0.3',
53
+ )
54
+ filename.write_text(content, encoding='utf-8')
55
+
56
+ return str(tmpdir)
57
+
58
+ def test_distinfo(self, metadata):
59
+ dists = dict(
60
+ (d.project_name, d) for d in pkg_resources.find_distributions(metadata)
61
+ )
62
+
63
+ assert len(dists) == 2, dists
64
+
65
+ unversioned = dists['UnversionedDistribution']
66
+ versioned = dists['VersionedDistribution']
67
+
68
+ assert versioned.version == '2.718' # from filename
69
+ assert unversioned.version == '0.3' # from METADATA
70
+
71
+ def test_conditional_dependencies(self, metadata):
72
+ specs = 'splort==4', 'quux>=1.1'
73
+ requires = list(map(pkg_resources.Requirement.parse, specs))
74
+
75
+ for d in pkg_resources.find_distributions(metadata):
76
+ assert d.requires() == requires[:1]
77
+ assert d.requires(extras=('baz',)) == [
78
+ requires[0],
79
+ pkg_resources.Requirement.parse('quux>=1.1;extra=="baz"'),
80
+ ]
81
+ assert d.extras == ['baz']
82
+
83
+ def test_invalid_version(self, tmp_path):
84
+ """
85
+ Supplying an invalid version crashes dist_info.
86
+ """
87
+ config = "[metadata]\nname=proj\nversion=42\n[egg_info]\ntag_build=invalid!!!\n"
88
+ (tmp_path / "setup.cfg").write_text(config, encoding="utf-8")
89
+ msg = re.compile("invalid version", re.M | re.I)
90
+ proc = run_command_inner("dist_info", cwd=tmp_path, check=False)
91
+ assert proc.returncode
92
+ assert msg.search(proc.stdout)
93
+ assert not list(tmp_path.glob("*.dist-info"))
94
+
95
+ def test_tag_arguments(self, tmp_path):
96
+ config = """
97
+ [metadata]
98
+ name=proj
99
+ version=42
100
+ [egg_info]
101
+ tag_date=1
102
+ tag_build=.post
103
+ """
104
+ (tmp_path / "setup.cfg").write_text(config, encoding="utf-8")
105
+
106
+ print(run_command("dist_info", "--no-date", cwd=tmp_path))
107
+ dist_info = next(tmp_path.glob("*.dist-info"))
108
+ assert dist_info.name.startswith("proj-42")
109
+ shutil.rmtree(dist_info)
110
+
111
+ print(run_command("dist_info", "--tag-build", ".a", cwd=tmp_path))
112
+ dist_info = next(tmp_path.glob("*.dist-info"))
113
+ assert dist_info.name.startswith("proj-42a")
114
+
115
+ @pytest.mark.parametrize("keep_egg_info", (False, True))
116
+ def test_output_dir(self, tmp_path, keep_egg_info):
117
+ config = "[metadata]\nname=proj\nversion=42\n"
118
+ (tmp_path / "setup.cfg").write_text(config, encoding="utf-8")
119
+ out = tmp_path / "__out"
120
+ out.mkdir()
121
+ opts = ["--keep-egg-info"] if keep_egg_info else []
122
+ run_command("dist_info", "--output-dir", out, *opts, cwd=tmp_path)
123
+ assert len(list(out.glob("*.dist-info"))) == 1
124
+ assert len(list(tmp_path.glob("*.dist-info"))) == 0
125
+ expected_egg_info = int(keep_egg_info)
126
+ assert len(list(out.glob("*.egg-info"))) == expected_egg_info
127
+ assert len(list(tmp_path.glob("*.egg-info"))) == 0
128
+ assert len(list(out.glob("*.__bkp__"))) == 0
129
+ assert len(list(tmp_path.glob("*.__bkp__"))) == 0
130
+
131
+
132
+ class TestWheelCompatibility:
133
+ """Make sure the .dist-info directory produced with the ``dist_info`` command
134
+ is the same as the one produced by ``bdist_wheel``.
135
+ """
136
+
137
+ SETUPCFG = DALS(
138
+ """
139
+ [metadata]
140
+ name = {name}
141
+ version = {version}
142
+
143
+ [options]
144
+ install_requires =
145
+ foo>=12; sys_platform != "linux"
146
+
147
+ [options.extras_require]
148
+ test = pytest
149
+
150
+ [options.entry_points]
151
+ console_scripts =
152
+ executable-name = my_package.module:function
153
+ discover =
154
+ myproj = my_package.other_module:function
155
+ """
156
+ )
157
+
158
+ EGG_INFO_OPTS = [
159
+ # Related: #3088 #2872
160
+ ("", ""),
161
+ (".post", "[egg_info]\ntag_build = post\n"),
162
+ (".post", "[egg_info]\ntag_build = .post\n"),
163
+ (".post", "[egg_info]\ntag_build = post\ntag_date = 1\n"),
164
+ (".dev", "[egg_info]\ntag_build = .dev\n"),
165
+ (".dev", "[egg_info]\ntag_build = .dev\ntag_date = 1\n"),
166
+ ("a1", "[egg_info]\ntag_build = .a1\n"),
167
+ ("+local", "[egg_info]\ntag_build = +local\n"),
168
+ ]
169
+
170
+ @pytest.mark.parametrize("name", "my-proj my_proj my.proj My.Proj".split())
171
+ @pytest.mark.parametrize("version", ["0.42.13"])
172
+ @pytest.mark.parametrize(("suffix", "cfg"), EGG_INFO_OPTS)
173
+ def test_dist_info_is_the_same_as_in_wheel(
174
+ self, name, version, tmp_path, suffix, cfg
175
+ ):
176
+ config = self.SETUPCFG.format(name=name, version=version) + cfg
177
+
178
+ for i in "dir_wheel", "dir_dist":
179
+ (tmp_path / i).mkdir()
180
+ (tmp_path / i / "setup.cfg").write_text(config, encoding="utf-8")
181
+
182
+ run_command("bdist_wheel", cwd=tmp_path / "dir_wheel")
183
+ wheel = next(tmp_path.glob("dir_wheel/dist/*.whl"))
184
+ unpack_archive(wheel, tmp_path / "unpack")
185
+ wheel_dist_info = next(tmp_path.glob("unpack/*.dist-info"))
186
+
187
+ run_command("dist_info", cwd=tmp_path / "dir_dist")
188
+ dist_info = next(tmp_path.glob("dir_dist/*.dist-info"))
189
+
190
+ assert dist_info.name == wheel_dist_info.name
191
+ assert dist_info.name.startswith(f"my_proj-{version}{suffix}")
192
+ for file in "METADATA", "entry_points.txt":
193
+ assert read(dist_info / file) == read(wheel_dist_info / file)
194
+
195
+
196
+ def run_command_inner(*cmd, **kwargs):
197
+ opts = {
198
+ "stderr": subprocess.STDOUT,
199
+ "stdout": subprocess.PIPE,
200
+ "text": True,
201
+ "encoding": "utf-8",
202
+ "check": True,
203
+ **kwargs,
204
+ }
205
+ cmd = [sys.executable, "-c", "__import__('setuptools').setup()", *map(str, cmd)]
206
+ return subprocess.run(cmd, **opts)
207
+
208
+
209
+ def run_command(*args, **kwargs):
210
+ return run_command_inner(*args, **kwargs).stdout
.venv/lib/python3.12/site-packages/setuptools/tests/test_distutils_adoption.py ADDED
@@ -0,0 +1,198 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import platform
3
+ import sys
4
+ import textwrap
5
+
6
+ import pytest
7
+
8
+ IS_PYPY = '__pypy__' in sys.builtin_module_names
9
+
10
+ _TEXT_KWARGS = {"text": True, "encoding": "utf-8"} # For subprocess.run
11
+
12
+
13
+ def win_sr(env):
14
+ """
15
+ On Windows, SYSTEMROOT must be present to avoid
16
+
17
+ > Fatal Python error: _Py_HashRandomization_Init: failed to
18
+ > get random numbers to initialize Python
19
+ """
20
+ if env and platform.system() == 'Windows':
21
+ env['SYSTEMROOT'] = os.environ['SYSTEMROOT']
22
+ return env
23
+
24
+
25
+ def find_distutils(venv, imports='distutils', env=None, **kwargs):
26
+ py_cmd = 'import {imports}; print(distutils.__file__)'.format(**locals())
27
+ cmd = ['python', '-c', py_cmd]
28
+ return venv.run(cmd, env=win_sr(env), **_TEXT_KWARGS, **kwargs)
29
+
30
+
31
+ def count_meta_path(venv, env=None):
32
+ py_cmd = textwrap.dedent(
33
+ """
34
+ import sys
35
+ is_distutils = lambda finder: finder.__class__.__name__ == "DistutilsMetaFinder"
36
+ print(len(list(filter(is_distutils, sys.meta_path))))
37
+ """
38
+ )
39
+ cmd = ['python', '-c', py_cmd]
40
+ return int(venv.run(cmd, env=win_sr(env), **_TEXT_KWARGS))
41
+
42
+
43
+ skip_without_stdlib_distutils = pytest.mark.skipif(
44
+ sys.version_info >= (3, 12),
45
+ reason='stdlib distutils is removed from Python 3.12+',
46
+ )
47
+
48
+
49
+ @skip_without_stdlib_distutils
50
+ def test_distutils_stdlib(venv):
51
+ """
52
+ Ensure stdlib distutils is used when appropriate.
53
+ """
54
+ env = dict(SETUPTOOLS_USE_DISTUTILS='stdlib')
55
+ assert venv.name not in find_distutils(venv, env=env).split(os.sep)
56
+ assert count_meta_path(venv, env=env) == 0
57
+
58
+
59
+ def test_distutils_local_with_setuptools(venv):
60
+ """
61
+ Ensure local distutils is used when appropriate.
62
+ """
63
+ env = dict(SETUPTOOLS_USE_DISTUTILS='local')
64
+ loc = find_distutils(venv, imports='setuptools, distutils', env=env)
65
+ assert venv.name in loc.split(os.sep)
66
+ assert count_meta_path(venv, env=env) <= 1
67
+
68
+
69
+ @pytest.mark.xfail('IS_PYPY', reason='pypy imports distutils on startup')
70
+ def test_distutils_local(venv):
71
+ """
72
+ Even without importing, the setuptools-local copy of distutils is
73
+ preferred.
74
+ """
75
+ env = dict(SETUPTOOLS_USE_DISTUTILS='local')
76
+ assert venv.name in find_distutils(venv, env=env).split(os.sep)
77
+ assert count_meta_path(venv, env=env) <= 1
78
+
79
+
80
+ def test_pip_import(venv):
81
+ """
82
+ Ensure pip can be imported.
83
+ Regression test for #3002.
84
+ """
85
+ cmd = ['python', '-c', 'import pip']
86
+ venv.run(cmd, **_TEXT_KWARGS)
87
+
88
+
89
+ def test_distutils_has_origin():
90
+ """
91
+ Distutils module spec should have an origin. #2990.
92
+ """
93
+ assert __import__('distutils').__spec__.origin
94
+
95
+
96
+ ENSURE_IMPORTS_ARE_NOT_DUPLICATED = r"""
97
+ # Depending on the importlib machinery and _distutils_hack, some imports are
98
+ # duplicated resulting in different module objects being loaded, which prevents
99
+ # patches as shown in #3042.
100
+ # This script provides a way of verifying if this duplication is happening.
101
+
102
+ from distutils import cmd
103
+ import distutils.command.sdist as sdist
104
+
105
+ # import last to prevent caching
106
+ from distutils import {imported_module}
107
+
108
+ for mod in (cmd, sdist):
109
+ assert mod.{imported_module} == {imported_module}, (
110
+ f"\n{{mod.dir_util}}\n!=\n{{{imported_module}}}"
111
+ )
112
+
113
+ print("success")
114
+ """
115
+
116
+
117
+ @pytest.mark.usefixtures("tmpdir_cwd")
118
+ @pytest.mark.parametrize(
119
+ ('distutils_version', 'imported_module'),
120
+ [
121
+ pytest.param("stdlib", "dir_util", marks=skip_without_stdlib_distutils),
122
+ pytest.param("stdlib", "file_util", marks=skip_without_stdlib_distutils),
123
+ pytest.param("stdlib", "archive_util", marks=skip_without_stdlib_distutils),
124
+ ("local", "dir_util"),
125
+ ("local", "file_util"),
126
+ ("local", "archive_util"),
127
+ ],
128
+ )
129
+ def test_modules_are_not_duplicated_on_import(distutils_version, imported_module, venv):
130
+ env = dict(SETUPTOOLS_USE_DISTUTILS=distutils_version)
131
+ script = ENSURE_IMPORTS_ARE_NOT_DUPLICATED.format(imported_module=imported_module)
132
+ cmd = ['python', '-c', script]
133
+ output = venv.run(cmd, env=win_sr(env), **_TEXT_KWARGS).strip()
134
+ assert output == "success"
135
+
136
+
137
+ ENSURE_LOG_IMPORT_IS_NOT_DUPLICATED = r"""
138
+ import types
139
+ import distutils.dist as dist
140
+ from distutils import log
141
+ if isinstance(dist.log, types.ModuleType):
142
+ assert dist.log == log, f"\n{dist.log}\n!=\n{log}"
143
+ print("success")
144
+ """
145
+
146
+
147
+ @pytest.mark.usefixtures("tmpdir_cwd")
148
+ @pytest.mark.parametrize(
149
+ "distutils_version",
150
+ [
151
+ "local",
152
+ pytest.param("stdlib", marks=skip_without_stdlib_distutils),
153
+ ],
154
+ )
155
+ def test_log_module_is_not_duplicated_on_import(distutils_version, venv):
156
+ env = dict(SETUPTOOLS_USE_DISTUTILS=distutils_version)
157
+ cmd = ['python', '-c', ENSURE_LOG_IMPORT_IS_NOT_DUPLICATED]
158
+ output = venv.run(cmd, env=win_sr(env), **_TEXT_KWARGS).strip()
159
+ assert output == "success"
160
+
161
+
162
+ ENSURE_CONSISTENT_ERROR_FROM_MODIFIED_PY = r"""
163
+ from setuptools.modified import newer
164
+ from {imported_module}.errors import DistutilsError
165
+
166
+ # Can't use pytest.raises in this context
167
+ try:
168
+ newer("", "")
169
+ except DistutilsError:
170
+ print("success")
171
+ else:
172
+ raise AssertionError("Expected to raise")
173
+ """
174
+
175
+
176
+ @pytest.mark.usefixtures("tmpdir_cwd")
177
+ @pytest.mark.parametrize(
178
+ ('distutils_version', 'imported_module'),
179
+ [
180
+ ("local", "distutils"),
181
+ # Unfortunately we still get ._distutils.errors.DistutilsError with SETUPTOOLS_USE_DISTUTILS=stdlib
182
+ # But that's a deprecated use-case we don't mind not fully supporting in newer code
183
+ pytest.param(
184
+ "stdlib", "setuptools._distutils", marks=skip_without_stdlib_distutils
185
+ ),
186
+ ],
187
+ )
188
+ def test_consistent_error_from_modified_py(distutils_version, imported_module, venv):
189
+ env = dict(SETUPTOOLS_USE_DISTUTILS=distutils_version)
190
+ cmd = [
191
+ 'python',
192
+ '-c',
193
+ ENSURE_CONSISTENT_ERROR_FROM_MODIFIED_PY.format(
194
+ imported_module=imported_module
195
+ ),
196
+ ]
197
+ output = venv.run(cmd, env=win_sr(env), **_TEXT_KWARGS).strip()
198
+ assert output == "success"
.venv/lib/python3.12/site-packages/setuptools/tests/test_easy_install.py ADDED
@@ -0,0 +1,1476 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Easy install Tests"""
2
+
3
+ import contextlib
4
+ import io
5
+ import itertools
6
+ import logging
7
+ import os
8
+ import pathlib
9
+ import re
10
+ import site
11
+ import subprocess
12
+ import sys
13
+ import tarfile
14
+ import tempfile
15
+ import time
16
+ import warnings
17
+ import zipfile
18
+ from pathlib import Path
19
+ from typing import NamedTuple
20
+ from unittest import mock
21
+
22
+ import pytest
23
+ from jaraco import path
24
+
25
+ import pkg_resources
26
+ import setuptools.command.easy_install as ei
27
+ from pkg_resources import Distribution as PRDistribution, normalize_path, working_set
28
+ from setuptools import sandbox
29
+ from setuptools._normalization import safer_name
30
+ from setuptools.command.easy_install import PthDistributions
31
+ from setuptools.dist import Distribution
32
+ from setuptools.sandbox import run_setup
33
+ from setuptools.tests import fail_on_ascii
34
+ from setuptools.tests.server import MockServer, path_to_url
35
+
36
+ from . import contexts
37
+ from .textwrap import DALS
38
+
39
+ import distutils.errors
40
+
41
+
42
+ @pytest.fixture(autouse=True)
43
+ def pip_disable_index(monkeypatch):
44
+ """
45
+ Important: Disable the default index for pip to avoid
46
+ querying packages in the index and potentially resolving
47
+ and installing packages there.
48
+ """
49
+ monkeypatch.setenv('PIP_NO_INDEX', 'true')
50
+
51
+
52
+ class FakeDist:
53
+ def get_entry_map(self, group):
54
+ if group != 'console_scripts':
55
+ return {}
56
+ return {'name': 'ep'}
57
+
58
+ def as_requirement(self):
59
+ return 'spec'
60
+
61
+
62
+ SETUP_PY = DALS(
63
+ """
64
+ from setuptools import setup
65
+
66
+ setup()
67
+ """
68
+ )
69
+
70
+
71
+ class TestEasyInstallTest:
72
+ def test_get_script_args(self):
73
+ header = ei.CommandSpec.best().from_environment().as_header()
74
+ dist = FakeDist()
75
+ args = next(ei.ScriptWriter.get_args(dist))
76
+ _name, script = itertools.islice(args, 2)
77
+ assert script.startswith(header)
78
+ assert "'spec'" in script
79
+ assert "'console_scripts'" in script
80
+ assert "'name'" in script
81
+ assert re.search('^# EASY-INSTALL-ENTRY-SCRIPT', script, flags=re.MULTILINE)
82
+
83
+ def test_no_find_links(self):
84
+ # new option '--no-find-links', that blocks find-links added at
85
+ # the project level
86
+ dist = Distribution()
87
+ cmd = ei.easy_install(dist)
88
+ cmd.check_pth_processing = lambda: True
89
+ cmd.no_find_links = True
90
+ cmd.find_links = ['link1', 'link2']
91
+ cmd.install_dir = os.path.join(tempfile.mkdtemp(), 'ok')
92
+ cmd.args = ['ok']
93
+ cmd.ensure_finalized()
94
+ assert cmd.package_index.scanned_urls == {}
95
+
96
+ # let's try without it (default behavior)
97
+ cmd = ei.easy_install(dist)
98
+ cmd.check_pth_processing = lambda: True
99
+ cmd.find_links = ['link1', 'link2']
100
+ cmd.install_dir = os.path.join(tempfile.mkdtemp(), 'ok')
101
+ cmd.args = ['ok']
102
+ cmd.ensure_finalized()
103
+ keys = sorted(cmd.package_index.scanned_urls.keys())
104
+ assert keys == ['link1', 'link2']
105
+
106
+ def test_write_exception(self):
107
+ """
108
+ Test that `cant_write_to_target` is rendered as a DistutilsError.
109
+ """
110
+ dist = Distribution()
111
+ cmd = ei.easy_install(dist)
112
+ cmd.install_dir = os.getcwd()
113
+ with pytest.raises(distutils.errors.DistutilsError):
114
+ cmd.cant_write_to_target()
115
+
116
+ def test_all_site_dirs(self, monkeypatch):
117
+ """
118
+ get_site_dirs should always return site dirs reported by
119
+ site.getsitepackages.
120
+ """
121
+ path = normalize_path('/setuptools/test/site-packages')
122
+
123
+ def mock_gsp():
124
+ return [path]
125
+
126
+ monkeypatch.setattr(site, 'getsitepackages', mock_gsp, raising=False)
127
+ assert path in ei.get_site_dirs()
128
+
129
+ def test_all_site_dirs_works_without_getsitepackages(self, monkeypatch):
130
+ monkeypatch.delattr(site, 'getsitepackages', raising=False)
131
+ assert ei.get_site_dirs()
132
+
133
+ @pytest.fixture
134
+ def sdist_unicode(self, tmpdir):
135
+ files = [
136
+ (
137
+ 'setup.py',
138
+ DALS(
139
+ """
140
+ import setuptools
141
+ setuptools.setup(
142
+ name="setuptools-test-unicode",
143
+ version="1.0",
144
+ packages=["mypkg"],
145
+ include_package_data=True,
146
+ )
147
+ """
148
+ ),
149
+ ),
150
+ (
151
+ 'mypkg/__init__.py',
152
+ "",
153
+ ),
154
+ (
155
+ 'mypkg/☃.txt',
156
+ "",
157
+ ),
158
+ ]
159
+ sdist_name = 'setuptools-test-unicode-1.0.zip'
160
+ sdist = tmpdir / sdist_name
161
+ # can't use make_sdist, because the issue only occurs
162
+ # with zip sdists.
163
+ sdist_zip = zipfile.ZipFile(str(sdist), 'w')
164
+ for filename, content in files:
165
+ sdist_zip.writestr(filename, content)
166
+ sdist_zip.close()
167
+ return str(sdist)
168
+
169
+ @fail_on_ascii
170
+ def test_unicode_filename_in_sdist(self, sdist_unicode, tmpdir, monkeypatch):
171
+ """
172
+ The install command should execute correctly even if
173
+ the package has unicode filenames.
174
+ """
175
+ dist = Distribution({'script_args': ['easy_install']})
176
+ target = (tmpdir / 'target').ensure_dir()
177
+ cmd = ei.easy_install(
178
+ dist,
179
+ install_dir=str(target),
180
+ args=['x'],
181
+ )
182
+ monkeypatch.setitem(os.environ, 'PYTHONPATH', str(target))
183
+ cmd.ensure_finalized()
184
+ cmd.easy_install(sdist_unicode)
185
+
186
+ @pytest.fixture
187
+ def sdist_unicode_in_script(self, tmpdir):
188
+ files = [
189
+ (
190
+ "setup.py",
191
+ DALS(
192
+ """
193
+ import setuptools
194
+ setuptools.setup(
195
+ name="setuptools-test-unicode",
196
+ version="1.0",
197
+ packages=["mypkg"],
198
+ include_package_data=True,
199
+ scripts=['mypkg/unicode_in_script'],
200
+ )
201
+ """
202
+ ),
203
+ ),
204
+ ("mypkg/__init__.py", ""),
205
+ (
206
+ "mypkg/unicode_in_script",
207
+ DALS(
208
+ """
209
+ #!/bin/sh
210
+ # á
211
+
212
+ non_python_fn() {
213
+ }
214
+ """
215
+ ),
216
+ ),
217
+ ]
218
+ sdist_name = "setuptools-test-unicode-script-1.0.zip"
219
+ sdist = tmpdir / sdist_name
220
+ # can't use make_sdist, because the issue only occurs
221
+ # with zip sdists.
222
+ sdist_zip = zipfile.ZipFile(str(sdist), "w")
223
+ for filename, content in files:
224
+ sdist_zip.writestr(filename, content.encode('utf-8'))
225
+ sdist_zip.close()
226
+ return str(sdist)
227
+
228
+ @fail_on_ascii
229
+ def test_unicode_content_in_sdist(
230
+ self, sdist_unicode_in_script, tmpdir, monkeypatch
231
+ ):
232
+ """
233
+ The install command should execute correctly even if
234
+ the package has unicode in scripts.
235
+ """
236
+ dist = Distribution({"script_args": ["easy_install"]})
237
+ target = (tmpdir / "target").ensure_dir()
238
+ cmd = ei.easy_install(dist, install_dir=str(target), args=["x"])
239
+ monkeypatch.setitem(os.environ, "PYTHONPATH", str(target))
240
+ cmd.ensure_finalized()
241
+ cmd.easy_install(sdist_unicode_in_script)
242
+
243
+ @pytest.fixture
244
+ def sdist_script(self, tmpdir):
245
+ files = [
246
+ (
247
+ 'setup.py',
248
+ DALS(
249
+ """
250
+ import setuptools
251
+ setuptools.setup(
252
+ name="setuptools-test-script",
253
+ version="1.0",
254
+ scripts=["mypkg_script"],
255
+ )
256
+ """
257
+ ),
258
+ ),
259
+ (
260
+ 'mypkg_script',
261
+ DALS(
262
+ """
263
+ #/usr/bin/python
264
+ print('mypkg_script')
265
+ """
266
+ ),
267
+ ),
268
+ ]
269
+ sdist_name = 'setuptools-test-script-1.0.zip'
270
+ sdist = str(tmpdir / sdist_name)
271
+ make_sdist(sdist, files)
272
+ return sdist
273
+
274
+ @pytest.mark.skipif(
275
+ not sys.platform.startswith('linux'), reason="Test can only be run on Linux"
276
+ )
277
+ def test_script_install(self, sdist_script, tmpdir, monkeypatch):
278
+ """
279
+ Check scripts are installed.
280
+ """
281
+ dist = Distribution({'script_args': ['easy_install']})
282
+ target = (tmpdir / 'target').ensure_dir()
283
+ cmd = ei.easy_install(
284
+ dist,
285
+ install_dir=str(target),
286
+ args=['x'],
287
+ )
288
+ monkeypatch.setitem(os.environ, 'PYTHONPATH', str(target))
289
+ cmd.ensure_finalized()
290
+ cmd.easy_install(sdist_script)
291
+ assert (target / 'mypkg_script').exists()
292
+
293
+
294
+ @pytest.mark.filterwarnings('ignore:Unbuilt egg')
295
+ class TestPTHFileWriter:
296
+ def test_add_from_cwd_site_sets_dirty(self):
297
+ """a pth file manager should set dirty
298
+ if a distribution is in site but also the cwd
299
+ """
300
+ pth = PthDistributions('does-not_exist', [os.getcwd()])
301
+ assert not pth.dirty
302
+ pth.add(PRDistribution(os.getcwd()))
303
+ assert pth.dirty
304
+
305
+ def test_add_from_site_is_ignored(self):
306
+ location = '/test/location/does-not-have-to-exist'
307
+ # PthDistributions expects all locations to be normalized
308
+ location = pkg_resources.normalize_path(location)
309
+ pth = PthDistributions(
310
+ 'does-not_exist',
311
+ [
312
+ location,
313
+ ],
314
+ )
315
+ assert not pth.dirty
316
+ pth.add(PRDistribution(location))
317
+ assert not pth.dirty
318
+
319
+ def test_many_pth_distributions_merge_together(self, tmpdir):
320
+ """
321
+ If the pth file is modified under the hood, then PthDistribution
322
+ will refresh its content before saving, merging contents when
323
+ necessary.
324
+ """
325
+ # putting the pth file in a dedicated sub-folder,
326
+ pth_subdir = tmpdir.join("pth_subdir")
327
+ pth_subdir.mkdir()
328
+ pth_path = str(pth_subdir.join("file1.pth"))
329
+ pth1 = PthDistributions(pth_path)
330
+ pth2 = PthDistributions(pth_path)
331
+ assert pth1.paths == pth2.paths == [], (
332
+ "unless there would be some default added at some point"
333
+ )
334
+ # and so putting the src_subdir in folder distinct than the pth one,
335
+ # so to keep it absolute by PthDistributions
336
+ new_src_path = tmpdir.join("src_subdir")
337
+ new_src_path.mkdir() # must exist to be accounted
338
+ new_src_path_str = str(new_src_path)
339
+ pth1.paths.append(new_src_path_str)
340
+ pth1.save()
341
+ assert pth1.paths, (
342
+ "the new_src_path added must still be present/valid in pth1 after save"
343
+ )
344
+ # now,
345
+ assert new_src_path_str not in pth2.paths, (
346
+ "right before we save the entry should still not be present"
347
+ )
348
+ pth2.save()
349
+ assert new_src_path_str in pth2.paths, (
350
+ "the new_src_path entry should have been added by pth2 with its save() call"
351
+ )
352
+ assert pth2.paths[-1] == new_src_path, (
353
+ "and it should match exactly on the last entry actually "
354
+ "given we append to it in save()"
355
+ )
356
+ # finally,
357
+ assert PthDistributions(pth_path).paths == pth2.paths, (
358
+ "and we should have the exact same list at the end "
359
+ "with a fresh PthDistributions instance"
360
+ )
361
+
362
+
363
+ @pytest.fixture
364
+ def setup_context(tmpdir):
365
+ with (tmpdir / 'setup.py').open('w', encoding="utf-8") as f:
366
+ f.write(SETUP_PY)
367
+ with tmpdir.as_cwd():
368
+ yield tmpdir
369
+
370
+
371
+ @pytest.mark.usefixtures("user_override")
372
+ @pytest.mark.usefixtures("setup_context")
373
+ class TestUserInstallTest:
374
+ # prevent check that site-packages is writable. easy_install
375
+ # shouldn't be writing to system site-packages during finalize
376
+ # options, but while it does, bypass the behavior.
377
+ prev_sp_write = mock.patch(
378
+ 'setuptools.command.easy_install.easy_install.check_site_dir',
379
+ mock.Mock(),
380
+ )
381
+
382
+ # simulate setuptools installed in user site packages
383
+ @mock.patch('setuptools.command.easy_install.__file__', site.USER_SITE)
384
+ @mock.patch('site.ENABLE_USER_SITE', True)
385
+ @prev_sp_write
386
+ def test_user_install_not_implied_user_site_enabled(self):
387
+ self.assert_not_user_site()
388
+
389
+ @mock.patch('site.ENABLE_USER_SITE', False)
390
+ @prev_sp_write
391
+ def test_user_install_not_implied_user_site_disabled(self):
392
+ self.assert_not_user_site()
393
+
394
+ @staticmethod
395
+ def assert_not_user_site():
396
+ # create a finalized easy_install command
397
+ dist = Distribution()
398
+ dist.script_name = 'setup.py'
399
+ cmd = ei.easy_install(dist)
400
+ cmd.args = ['py']
401
+ cmd.ensure_finalized()
402
+ assert not cmd.user, 'user should not be implied'
403
+
404
+ def test_multiproc_atexit(self):
405
+ pytest.importorskip('multiprocessing')
406
+
407
+ log = logging.getLogger('test_easy_install')
408
+ logging.basicConfig(level=logging.INFO, stream=sys.stderr)
409
+ log.info('this should not break')
410
+
411
+ @pytest.fixture
412
+ def foo_package(self, tmpdir):
413
+ egg_file = tmpdir / 'foo-1.0.egg-info'
414
+ with egg_file.open('w') as f:
415
+ f.write('Name: foo\n')
416
+ return str(tmpdir)
417
+
418
+ @pytest.fixture
419
+ def install_target(self, tmpdir):
420
+ target = str(tmpdir)
421
+ with mock.patch('sys.path', sys.path + [target]):
422
+ python_path = os.path.pathsep.join(sys.path)
423
+ with mock.patch.dict(os.environ, PYTHONPATH=python_path):
424
+ yield target
425
+
426
+ def test_local_index(self, foo_package, install_target):
427
+ """
428
+ The local index must be used when easy_install locates installed
429
+ packages.
430
+ """
431
+ dist = Distribution()
432
+ dist.script_name = 'setup.py'
433
+ cmd = ei.easy_install(dist)
434
+ cmd.install_dir = install_target
435
+ cmd.args = ['foo']
436
+ cmd.ensure_finalized()
437
+ cmd.local_index.scan([foo_package])
438
+ res = cmd.easy_install('foo')
439
+ actual = os.path.normcase(os.path.realpath(res.location))
440
+ expected = os.path.normcase(os.path.realpath(foo_package))
441
+ assert actual == expected
442
+
443
+ @contextlib.contextmanager
444
+ def user_install_setup_context(self, *args, **kwargs):
445
+ """
446
+ Wrap sandbox.setup_context to patch easy_install in that context to
447
+ appear as user-installed.
448
+ """
449
+ with self.orig_context(*args, **kwargs):
450
+ import setuptools.command.easy_install as ei
451
+
452
+ ei.__file__ = site.USER_SITE
453
+ yield
454
+
455
+ def patched_setup_context(self):
456
+ self.orig_context = sandbox.setup_context
457
+
458
+ return mock.patch(
459
+ 'setuptools.sandbox.setup_context',
460
+ self.user_install_setup_context,
461
+ )
462
+
463
+
464
+ @pytest.fixture
465
+ def distutils_package():
466
+ distutils_setup_py = SETUP_PY.replace(
467
+ 'from setuptools import setup',
468
+ 'from distutils.core import setup',
469
+ )
470
+ with contexts.tempdir(cd=os.chdir):
471
+ with open('setup.py', 'w', encoding="utf-8") as f:
472
+ f.write(distutils_setup_py)
473
+ yield
474
+
475
+
476
+ @pytest.mark.usefixtures("distutils_package")
477
+ class TestDistutilsPackage:
478
+ def test_bdist_egg_available_on_distutils_pkg(self):
479
+ run_setup('setup.py', ['bdist_egg'])
480
+
481
+
482
+ @pytest.fixture
483
+ def mock_index():
484
+ # set up a server which will simulate an alternate package index.
485
+ p_index = MockServer()
486
+ if p_index.server_port == 0:
487
+ # Some platforms (Jython) don't find a port to which to bind,
488
+ # so skip test for them.
489
+ pytest.skip("could not find a valid port")
490
+ p_index.start()
491
+ return p_index
492
+
493
+
494
+ class TestInstallRequires:
495
+ def test_setup_install_includes_dependencies(self, tmp_path, mock_index):
496
+ """
497
+ When ``python setup.py install`` is called directly, it will use easy_install
498
+ to fetch dependencies.
499
+ """
500
+ # TODO: Remove these tests once `setup.py install` is completely removed
501
+ project_root = tmp_path / "project"
502
+ project_root.mkdir(exist_ok=True)
503
+ install_root = tmp_path / "install"
504
+ install_root.mkdir(exist_ok=True)
505
+
506
+ self.create_project(project_root)
507
+ cmd = [
508
+ sys.executable,
509
+ '-c',
510
+ '__import__("setuptools").setup()',
511
+ 'install',
512
+ '--install-base',
513
+ str(install_root),
514
+ '--install-lib',
515
+ str(install_root),
516
+ '--install-headers',
517
+ str(install_root),
518
+ '--install-scripts',
519
+ str(install_root),
520
+ '--install-data',
521
+ str(install_root),
522
+ '--install-purelib',
523
+ str(install_root),
524
+ '--install-platlib',
525
+ str(install_root),
526
+ ]
527
+ env = {**os.environ, "__EASYINSTALL_INDEX": mock_index.url}
528
+ cp = subprocess.run(
529
+ cmd,
530
+ cwd=str(project_root),
531
+ env=env,
532
+ stdout=subprocess.PIPE,
533
+ stderr=subprocess.STDOUT,
534
+ text=True,
535
+ encoding="utf-8",
536
+ )
537
+ assert cp.returncode != 0
538
+ try:
539
+ assert '/does-not-exist/' in {r.path for r in mock_index.requests}
540
+ assert next(
541
+ line
542
+ for line in cp.stdout.splitlines()
543
+ if "not find suitable distribution for" in line
544
+ and "does-not-exist" in line
545
+ )
546
+ except Exception:
547
+ if "failed to get random numbers" in cp.stdout:
548
+ pytest.xfail(f"{sys.platform} failure - {cp.stdout}")
549
+ raise
550
+
551
+ def create_project(self, root):
552
+ config = """
553
+ [metadata]
554
+ name = project
555
+ version = 42
556
+
557
+ [options]
558
+ install_requires = does-not-exist
559
+ py_modules = mod
560
+ """
561
+ (root / 'setup.cfg').write_text(DALS(config), encoding="utf-8")
562
+ (root / 'mod.py').touch()
563
+
564
+
565
+ class TestSetupRequires:
566
+ def test_setup_requires_honors_fetch_params(self, mock_index, monkeypatch):
567
+ """
568
+ When easy_install installs a source distribution which specifies
569
+ setup_requires, it should honor the fetch parameters (such as
570
+ index-url, and find-links).
571
+ """
572
+ monkeypatch.setenv('PIP_RETRIES', '0')
573
+ monkeypatch.setenv('PIP_TIMEOUT', '0')
574
+ monkeypatch.setenv('PIP_NO_INDEX', 'false')
575
+ with contexts.quiet():
576
+ # create an sdist that has a build-time dependency.
577
+ with TestSetupRequires.create_sdist() as dist_file:
578
+ with contexts.tempdir() as temp_install_dir:
579
+ with contexts.environment(PYTHONPATH=temp_install_dir):
580
+ cmd = [
581
+ sys.executable,
582
+ '-c',
583
+ '__import__("setuptools").setup()',
584
+ 'easy_install',
585
+ '--index-url',
586
+ mock_index.url,
587
+ '--exclude-scripts',
588
+ '--install-dir',
589
+ temp_install_dir,
590
+ dist_file,
591
+ ]
592
+ subprocess.Popen(cmd).wait()
593
+ # there should have been one requests to the server
594
+ assert [r.path for r in mock_index.requests] == ['/does-not-exist/']
595
+
596
+ @staticmethod
597
+ @contextlib.contextmanager
598
+ def create_sdist():
599
+ """
600
+ Return an sdist with a setup_requires dependency (of something that
601
+ doesn't exist)
602
+ """
603
+ with contexts.tempdir() as dir:
604
+ dist_path = os.path.join(dir, 'setuptools-test-fetcher-1.0.tar.gz')
605
+ make_sdist(
606
+ dist_path,
607
+ [
608
+ (
609
+ 'setup.py',
610
+ DALS(
611
+ """
612
+ import setuptools
613
+ setuptools.setup(
614
+ name="setuptools-test-fetcher",
615
+ version="1.0",
616
+ setup_requires = ['does-not-exist'],
617
+ )
618
+ """
619
+ ),
620
+ ),
621
+ ('setup.cfg', ''),
622
+ ],
623
+ )
624
+ yield dist_path
625
+
626
+ use_setup_cfg = (
627
+ (),
628
+ ('dependency_links',),
629
+ ('setup_requires',),
630
+ ('dependency_links', 'setup_requires'),
631
+ )
632
+
633
+ @pytest.mark.parametrize('use_setup_cfg', use_setup_cfg)
634
+ def test_setup_requires_overrides_version_conflict(self, use_setup_cfg):
635
+ """
636
+ Regression test for distribution issue 323:
637
+ https://bitbucket.org/tarek/distribute/issues/323
638
+
639
+ Ensures that a distribution's setup_requires requirements can still be
640
+ installed and used locally even if a conflicting version of that
641
+ requirement is already on the path.
642
+ """
643
+
644
+ fake_dist = PRDistribution(
645
+ 'does-not-matter', project_name='foobar', version='0.0'
646
+ )
647
+ working_set.add(fake_dist)
648
+
649
+ with contexts.save_pkg_resources_state():
650
+ with contexts.tempdir() as temp_dir:
651
+ test_pkg = create_setup_requires_package(
652
+ temp_dir, use_setup_cfg=use_setup_cfg
653
+ )
654
+ test_setup_py = os.path.join(test_pkg, 'setup.py')
655
+ with contexts.quiet() as (stdout, _stderr):
656
+ # Don't even need to install the package, just
657
+ # running the setup.py at all is sufficient
658
+ run_setup(test_setup_py, ['--name'])
659
+
660
+ lines = stdout.readlines()
661
+ assert len(lines) > 0
662
+ assert lines[-1].strip() == 'test_pkg'
663
+
664
+ @pytest.mark.parametrize('use_setup_cfg', use_setup_cfg)
665
+ def test_setup_requires_override_nspkg(self, use_setup_cfg):
666
+ """
667
+ Like ``test_setup_requires_overrides_version_conflict`` but where the
668
+ ``setup_requires`` package is part of a namespace package that has
669
+ *already* been imported.
670
+ """
671
+
672
+ with contexts.save_pkg_resources_state():
673
+ with contexts.tempdir() as temp_dir:
674
+ foobar_1_archive = os.path.join(temp_dir, 'foo_bar-0.1.tar.gz')
675
+ make_nspkg_sdist(foobar_1_archive, 'foo.bar', '0.1')
676
+ # Now actually go ahead an extract to the temp dir and add the
677
+ # extracted path to sys.path so foo.bar v0.1 is importable
678
+ foobar_1_dir = os.path.join(temp_dir, 'foo_bar-0.1')
679
+ os.mkdir(foobar_1_dir)
680
+ with tarfile.open(foobar_1_archive) as tf:
681
+ tf.extraction_filter = lambda member, path: member
682
+ tf.extractall(foobar_1_dir)
683
+ sys.path.insert(1, foobar_1_dir)
684
+
685
+ dist = PRDistribution(
686
+ foobar_1_dir, project_name='foo.bar', version='0.1'
687
+ )
688
+ working_set.add(dist)
689
+
690
+ template = DALS(
691
+ """\
692
+ import foo # Even with foo imported first the
693
+ # setup_requires package should override
694
+ import setuptools
695
+ setuptools.setup(**%r)
696
+
697
+ if not (hasattr(foo, '__path__') and
698
+ len(foo.__path__) == 2):
699
+ print('FAIL')
700
+
701
+ if 'foo_bar-0.2' not in foo.__path__[0]:
702
+ print('FAIL')
703
+ """
704
+ )
705
+
706
+ test_pkg = create_setup_requires_package(
707
+ temp_dir,
708
+ 'foo.bar',
709
+ '0.2',
710
+ make_nspkg_sdist,
711
+ template,
712
+ use_setup_cfg=use_setup_cfg,
713
+ )
714
+
715
+ test_setup_py = os.path.join(test_pkg, 'setup.py')
716
+
717
+ with contexts.quiet() as (stdout, _stderr):
718
+ try:
719
+ # Don't even need to install the package, just
720
+ # running the setup.py at all is sufficient
721
+ run_setup(test_setup_py, ['--name'])
722
+ except pkg_resources.VersionConflict: # pragma: nocover
723
+ pytest.fail(
724
+ 'Installing setup.py requirements caused a VersionConflict'
725
+ )
726
+
727
+ assert 'FAIL' not in stdout.getvalue()
728
+ lines = stdout.readlines()
729
+ assert len(lines) > 0
730
+ assert lines[-1].strip() == 'test_pkg'
731
+
732
+ @pytest.mark.parametrize('use_setup_cfg', use_setup_cfg)
733
+ def test_setup_requires_with_attr_version(self, use_setup_cfg):
734
+ def make_dependency_sdist(dist_path, distname, version):
735
+ files = [
736
+ (
737
+ 'setup.py',
738
+ DALS(
739
+ f"""
740
+ import setuptools
741
+ setuptools.setup(
742
+ name={distname!r},
743
+ version={version!r},
744
+ py_modules=[{distname!r}],
745
+ )
746
+ """
747
+ ),
748
+ ),
749
+ (
750
+ distname + '.py',
751
+ DALS(
752
+ """
753
+ version = 42
754
+ """
755
+ ),
756
+ ),
757
+ ]
758
+ make_sdist(dist_path, files)
759
+
760
+ with contexts.save_pkg_resources_state():
761
+ with contexts.tempdir() as temp_dir:
762
+ test_pkg = create_setup_requires_package(
763
+ temp_dir,
764
+ setup_attrs=dict(version='attr: foobar.version'),
765
+ make_package=make_dependency_sdist,
766
+ use_setup_cfg=use_setup_cfg + ('version',),
767
+ )
768
+ test_setup_py = os.path.join(test_pkg, 'setup.py')
769
+ with contexts.quiet() as (stdout, _stderr):
770
+ run_setup(test_setup_py, ['--version'])
771
+ lines = stdout.readlines()
772
+ assert len(lines) > 0
773
+ assert lines[-1].strip() == '42'
774
+
775
+ def test_setup_requires_honors_pip_env(self, mock_index, monkeypatch):
776
+ monkeypatch.setenv('PIP_RETRIES', '0')
777
+ monkeypatch.setenv('PIP_TIMEOUT', '0')
778
+ monkeypatch.setenv('PIP_NO_INDEX', 'false')
779
+ monkeypatch.setenv('PIP_INDEX_URL', mock_index.url)
780
+ with contexts.save_pkg_resources_state():
781
+ with contexts.tempdir() as temp_dir:
782
+ test_pkg = create_setup_requires_package(
783
+ temp_dir,
784
+ 'python-xlib',
785
+ '0.19',
786
+ setup_attrs=dict(dependency_links=[]),
787
+ )
788
+ test_setup_cfg = os.path.join(test_pkg, 'setup.cfg')
789
+ with open(test_setup_cfg, 'w', encoding="utf-8") as fp:
790
+ fp.write(
791
+ DALS(
792
+ """
793
+ [easy_install]
794
+ index_url = https://pypi.org/legacy/
795
+ """
796
+ )
797
+ )
798
+ test_setup_py = os.path.join(test_pkg, 'setup.py')
799
+ with pytest.raises(distutils.errors.DistutilsError):
800
+ run_setup(test_setup_py, ['--version'])
801
+ assert len(mock_index.requests) == 1
802
+ assert mock_index.requests[0].path == '/python-xlib/'
803
+
804
+ def test_setup_requires_with_pep508_url(self, mock_index, monkeypatch):
805
+ monkeypatch.setenv('PIP_RETRIES', '0')
806
+ monkeypatch.setenv('PIP_TIMEOUT', '0')
807
+ monkeypatch.setenv('PIP_INDEX_URL', mock_index.url)
808
+ with contexts.save_pkg_resources_state():
809
+ with contexts.tempdir() as temp_dir:
810
+ dep_sdist = os.path.join(temp_dir, 'dep.tar.gz')
811
+ make_trivial_sdist(dep_sdist, 'dependency', '42')
812
+ dep_url = path_to_url(dep_sdist, authority='localhost')
813
+ test_pkg = create_setup_requires_package(
814
+ temp_dir,
815
+ # Ignored (overridden by setup_attrs)
816
+ 'python-xlib',
817
+ '0.19',
818
+ setup_attrs=dict(setup_requires=f'dependency @ {dep_url}'),
819
+ )
820
+ test_setup_py = os.path.join(test_pkg, 'setup.py')
821
+ run_setup(test_setup_py, ['--version'])
822
+ assert len(mock_index.requests) == 0
823
+
824
+ def test_setup_requires_with_allow_hosts(self, mock_index):
825
+ """The `allow-hosts` option in not supported anymore."""
826
+ files = {
827
+ 'test_pkg': {
828
+ 'setup.py': DALS(
829
+ """
830
+ from setuptools import setup
831
+ setup(setup_requires='python-xlib')
832
+ """
833
+ ),
834
+ 'setup.cfg': DALS(
835
+ """
836
+ [easy_install]
837
+ allow_hosts = *
838
+ """
839
+ ),
840
+ }
841
+ }
842
+ with contexts.save_pkg_resources_state():
843
+ with contexts.tempdir() as temp_dir:
844
+ path.build(files, prefix=temp_dir)
845
+ setup_py = str(pathlib.Path(temp_dir, 'test_pkg', 'setup.py'))
846
+ with pytest.raises(distutils.errors.DistutilsError):
847
+ run_setup(setup_py, ['--version'])
848
+ assert len(mock_index.requests) == 0
849
+
850
+ def test_setup_requires_with_python_requires(self, monkeypatch, tmpdir):
851
+ """Check `python_requires` is honored."""
852
+ monkeypatch.setenv('PIP_RETRIES', '0')
853
+ monkeypatch.setenv('PIP_TIMEOUT', '0')
854
+ monkeypatch.setenv('PIP_NO_INDEX', '1')
855
+ monkeypatch.setenv('PIP_VERBOSE', '1')
856
+ dep_1_0_sdist = 'dep-1.0.tar.gz'
857
+ dep_1_0_url = path_to_url(str(tmpdir / dep_1_0_sdist))
858
+ dep_1_0_python_requires = '>=2.7'
859
+ make_python_requires_sdist(
860
+ str(tmpdir / dep_1_0_sdist), 'dep', '1.0', dep_1_0_python_requires
861
+ )
862
+ dep_2_0_sdist = 'dep-2.0.tar.gz'
863
+ dep_2_0_url = path_to_url(str(tmpdir / dep_2_0_sdist))
864
+ dep_2_0_python_requires = (
865
+ f'!={sys.version_info.major}.{sys.version_info.minor}.*'
866
+ )
867
+ make_python_requires_sdist(
868
+ str(tmpdir / dep_2_0_sdist), 'dep', '2.0', dep_2_0_python_requires
869
+ )
870
+ index = tmpdir / 'index.html'
871
+ index.write_text(
872
+ DALS(
873
+ """
874
+ <!DOCTYPE html>
875
+ <html><head><title>Links for dep</title></head>
876
+ <body>
877
+ <h1>Links for dep</h1>
878
+ <a href="{dep_1_0_url}"\
879
+ data-requires-python="{dep_1_0_python_requires}">{dep_1_0_sdist}</a><br/>
880
+ <a href="{dep_2_0_url}"\
881
+ data-requires-python="{dep_2_0_python_requires}">{dep_2_0_sdist}</a><br/>
882
+ </body>
883
+ </html>
884
+ """
885
+ ).format(
886
+ dep_1_0_url=dep_1_0_url,
887
+ dep_1_0_sdist=dep_1_0_sdist,
888
+ dep_1_0_python_requires=dep_1_0_python_requires,
889
+ dep_2_0_url=dep_2_0_url,
890
+ dep_2_0_sdist=dep_2_0_sdist,
891
+ dep_2_0_python_requires=dep_2_0_python_requires,
892
+ ),
893
+ 'utf-8',
894
+ )
895
+ index_url = path_to_url(str(index))
896
+ with contexts.save_pkg_resources_state():
897
+ test_pkg = create_setup_requires_package(
898
+ str(tmpdir),
899
+ 'python-xlib',
900
+ '0.19', # Ignored (overridden by setup_attrs).
901
+ setup_attrs=dict(setup_requires='dep', dependency_links=[index_url]),
902
+ )
903
+ test_setup_py = os.path.join(test_pkg, 'setup.py')
904
+ run_setup(test_setup_py, ['--version'])
905
+ eggs = list(
906
+ map(str, pkg_resources.find_distributions(os.path.join(test_pkg, '.eggs')))
907
+ )
908
+ assert eggs == ['dep 1.0']
909
+
910
+ @pytest.mark.parametrize('with_dependency_links_in_setup_py', (False, True))
911
+ def test_setup_requires_with_find_links_in_setup_cfg(
912
+ self, monkeypatch, with_dependency_links_in_setup_py
913
+ ):
914
+ monkeypatch.setenv('PIP_RETRIES', '0')
915
+ monkeypatch.setenv('PIP_TIMEOUT', '0')
916
+ with contexts.save_pkg_resources_state():
917
+ with contexts.tempdir() as temp_dir:
918
+ make_trivial_sdist(
919
+ os.path.join(temp_dir, 'python-xlib-42.tar.gz'), 'python-xlib', '42'
920
+ )
921
+ test_pkg = os.path.join(temp_dir, 'test_pkg')
922
+ test_setup_py = os.path.join(test_pkg, 'setup.py')
923
+ test_setup_cfg = os.path.join(test_pkg, 'setup.cfg')
924
+ os.mkdir(test_pkg)
925
+ with open(test_setup_py, 'w', encoding="utf-8") as fp:
926
+ if with_dependency_links_in_setup_py:
927
+ dependency_links = [os.path.join(temp_dir, 'links')]
928
+ else:
929
+ dependency_links = []
930
+ fp.write(
931
+ DALS(
932
+ """
933
+ from setuptools import installer, setup
934
+ setup(setup_requires='python-xlib==42',
935
+ dependency_links={dependency_links!r})
936
+ """
937
+ ).format(dependency_links=dependency_links)
938
+ )
939
+ with open(test_setup_cfg, 'w', encoding="utf-8") as fp:
940
+ fp.write(
941
+ DALS(
942
+ """
943
+ [easy_install]
944
+ index_url = {index_url}
945
+ find_links = {find_links}
946
+ """
947
+ ).format(
948
+ index_url=os.path.join(temp_dir, 'index'),
949
+ find_links=temp_dir,
950
+ )
951
+ )
952
+ run_setup(test_setup_py, ['--version'])
953
+
954
+ def test_setup_requires_with_transitive_extra_dependency(self, monkeypatch):
955
+ """
956
+ Use case: installing a package with a build dependency on
957
+ an already installed `dep[extra]`, which in turn depends
958
+ on `extra_dep` (whose is not already installed).
959
+ """
960
+ with contexts.save_pkg_resources_state():
961
+ with contexts.tempdir() as temp_dir:
962
+ # Create source distribution for `extra_dep`.
963
+ make_trivial_sdist(
964
+ os.path.join(temp_dir, 'extra_dep-1.0.tar.gz'), 'extra_dep', '1.0'
965
+ )
966
+ # Create source tree for `dep`.
967
+ dep_pkg = os.path.join(temp_dir, 'dep')
968
+ os.mkdir(dep_pkg)
969
+ path.build(
970
+ {
971
+ 'setup.py': DALS(
972
+ """
973
+ import setuptools
974
+ setuptools.setup(
975
+ name='dep', version='2.0',
976
+ extras_require={'extra': ['extra_dep']},
977
+ )
978
+ """
979
+ ),
980
+ 'setup.cfg': '',
981
+ },
982
+ prefix=dep_pkg,
983
+ )
984
+ # "Install" dep.
985
+ run_setup(os.path.join(dep_pkg, 'setup.py'), ['dist_info'])
986
+ working_set.add_entry(dep_pkg)
987
+ # Create source tree for test package.
988
+ test_pkg = os.path.join(temp_dir, 'test_pkg')
989
+ test_setup_py = os.path.join(test_pkg, 'setup.py')
990
+ os.mkdir(test_pkg)
991
+ with open(test_setup_py, 'w', encoding="utf-8") as fp:
992
+ fp.write(
993
+ DALS(
994
+ """
995
+ from setuptools import installer, setup
996
+ setup(setup_requires='dep[extra]')
997
+ """
998
+ )
999
+ )
1000
+ # Check...
1001
+ monkeypatch.setenv('PIP_FIND_LINKS', str(temp_dir))
1002
+ monkeypatch.setenv('PIP_NO_INDEX', '1')
1003
+ monkeypatch.setenv('PIP_RETRIES', '0')
1004
+ monkeypatch.setenv('PIP_TIMEOUT', '0')
1005
+ run_setup(test_setup_py, ['--version'])
1006
+
1007
+ def test_setup_requires_with_distutils_command_dep(self, monkeypatch):
1008
+ """
1009
+ Use case: ensure build requirements' extras
1010
+ are properly installed and activated.
1011
+ """
1012
+ with contexts.save_pkg_resources_state():
1013
+ with contexts.tempdir() as temp_dir:
1014
+ # Create source distribution for `extra_dep`.
1015
+ make_sdist(
1016
+ os.path.join(temp_dir, 'extra_dep-1.0.tar.gz'),
1017
+ [
1018
+ (
1019
+ 'setup.py',
1020
+ DALS(
1021
+ """
1022
+ import setuptools
1023
+ setuptools.setup(
1024
+ name='extra_dep',
1025
+ version='1.0',
1026
+ py_modules=['extra_dep'],
1027
+ )
1028
+ """
1029
+ ),
1030
+ ),
1031
+ ('setup.cfg', ''),
1032
+ ('extra_dep.py', ''),
1033
+ ],
1034
+ )
1035
+ # Create source tree for `epdep`.
1036
+ dep_pkg = os.path.join(temp_dir, 'epdep')
1037
+ os.mkdir(dep_pkg)
1038
+ path.build(
1039
+ {
1040
+ 'setup.py': DALS(
1041
+ """
1042
+ import setuptools
1043
+ setuptools.setup(
1044
+ name='dep', version='2.0',
1045
+ py_modules=['epcmd'],
1046
+ extras_require={'extra': ['extra_dep']},
1047
+ entry_points='''
1048
+ [distutils.commands]
1049
+ epcmd = epcmd:epcmd [extra]
1050
+ ''',
1051
+ )
1052
+ """
1053
+ ),
1054
+ 'setup.cfg': '',
1055
+ 'epcmd.py': DALS(
1056
+ """
1057
+ from distutils.command.build_py import build_py
1058
+
1059
+ import extra_dep
1060
+
1061
+ class epcmd(build_py):
1062
+ pass
1063
+ """
1064
+ ),
1065
+ },
1066
+ prefix=dep_pkg,
1067
+ )
1068
+ # "Install" dep.
1069
+ run_setup(os.path.join(dep_pkg, 'setup.py'), ['dist_info'])
1070
+ working_set.add_entry(dep_pkg)
1071
+ # Create source tree for test package.
1072
+ test_pkg = os.path.join(temp_dir, 'test_pkg')
1073
+ test_setup_py = os.path.join(test_pkg, 'setup.py')
1074
+ os.mkdir(test_pkg)
1075
+ with open(test_setup_py, 'w', encoding="utf-8") as fp:
1076
+ fp.write(
1077
+ DALS(
1078
+ """
1079
+ from setuptools import installer, setup
1080
+ setup(setup_requires='dep[extra]')
1081
+ """
1082
+ )
1083
+ )
1084
+ # Check...
1085
+ monkeypatch.setenv('PIP_FIND_LINKS', str(temp_dir))
1086
+ monkeypatch.setenv('PIP_NO_INDEX', '1')
1087
+ monkeypatch.setenv('PIP_RETRIES', '0')
1088
+ monkeypatch.setenv('PIP_TIMEOUT', '0')
1089
+ run_setup(test_setup_py, ['epcmd'])
1090
+
1091
+
1092
+ def make_trivial_sdist(dist_path, distname, version):
1093
+ """
1094
+ Create a simple sdist tarball at dist_path, containing just a simple
1095
+ setup.py.
1096
+ """
1097
+
1098
+ make_sdist(
1099
+ dist_path,
1100
+ [
1101
+ (
1102
+ 'setup.py',
1103
+ DALS(
1104
+ f"""\
1105
+ import setuptools
1106
+ setuptools.setup(
1107
+ name={distname!r},
1108
+ version={version!r}
1109
+ )
1110
+ """
1111
+ ),
1112
+ ),
1113
+ ('setup.cfg', ''),
1114
+ ],
1115
+ )
1116
+
1117
+
1118
+ def make_nspkg_sdist(dist_path, distname, version):
1119
+ """
1120
+ Make an sdist tarball with distname and version which also contains one
1121
+ package with the same name as distname. The top-level package is
1122
+ designated a namespace package).
1123
+ """
1124
+ # Assert that the distname contains at least one period
1125
+ assert '.' in distname
1126
+
1127
+ parts = distname.split('.')
1128
+ nspackage = parts[0]
1129
+
1130
+ packages = ['.'.join(parts[:idx]) for idx in range(1, len(parts) + 1)]
1131
+
1132
+ setup_py = DALS(
1133
+ f"""\
1134
+ import setuptools
1135
+ setuptools.setup(
1136
+ name={distname!r},
1137
+ version={version!r},
1138
+ packages={packages!r},
1139
+ namespace_packages=[{nspackage!r}]
1140
+ )
1141
+ """
1142
+ )
1143
+
1144
+ init = "__import__('pkg_resources').declare_namespace(__name__)"
1145
+
1146
+ files = [('setup.py', setup_py), (os.path.join(nspackage, '__init__.py'), init)]
1147
+ for package in packages[1:]:
1148
+ filename = os.path.join(*(package.split('.') + ['__init__.py']))
1149
+ files.append((filename, ''))
1150
+
1151
+ make_sdist(dist_path, files)
1152
+
1153
+
1154
+ def make_python_requires_sdist(dist_path, distname, version, python_requires):
1155
+ make_sdist(
1156
+ dist_path,
1157
+ [
1158
+ (
1159
+ 'setup.py',
1160
+ DALS(
1161
+ """\
1162
+ import setuptools
1163
+ setuptools.setup(
1164
+ name={name!r},
1165
+ version={version!r},
1166
+ python_requires={python_requires!r},
1167
+ )
1168
+ """
1169
+ ).format(
1170
+ name=distname, version=version, python_requires=python_requires
1171
+ ),
1172
+ ),
1173
+ ('setup.cfg', ''),
1174
+ ],
1175
+ )
1176
+
1177
+
1178
+ def make_sdist(dist_path, files):
1179
+ """
1180
+ Create a simple sdist tarball at dist_path, containing the files
1181
+ listed in ``files`` as ``(filename, content)`` tuples.
1182
+ """
1183
+
1184
+ # Distributions with only one file don't play well with pip.
1185
+ assert len(files) > 1
1186
+ with tarfile.open(dist_path, 'w:gz') as dist:
1187
+ for filename, content in files:
1188
+ file_bytes = io.BytesIO(content.encode('utf-8'))
1189
+ file_info = tarfile.TarInfo(name=filename)
1190
+ file_info.size = len(file_bytes.getvalue())
1191
+ file_info.mtime = int(time.time())
1192
+ dist.addfile(file_info, fileobj=file_bytes)
1193
+
1194
+
1195
+ def create_setup_requires_package(
1196
+ path,
1197
+ distname='foobar',
1198
+ version='0.1',
1199
+ make_package=make_trivial_sdist,
1200
+ setup_py_template=None,
1201
+ setup_attrs=None,
1202
+ use_setup_cfg=(),
1203
+ ):
1204
+ """Creates a source tree under path for a trivial test package that has a
1205
+ single requirement in setup_requires--a tarball for that requirement is
1206
+ also created and added to the dependency_links argument.
1207
+
1208
+ ``distname`` and ``version`` refer to the name/version of the package that
1209
+ the test package requires via ``setup_requires``. The name of the test
1210
+ package itself is just 'test_pkg'.
1211
+ """
1212
+
1213
+ normalized_distname = safer_name(distname)
1214
+ test_setup_attrs = {
1215
+ 'name': 'test_pkg',
1216
+ 'version': '0.0',
1217
+ 'setup_requires': [f'{normalized_distname}=={version}'],
1218
+ 'dependency_links': [os.path.abspath(path)],
1219
+ }
1220
+ if setup_attrs:
1221
+ test_setup_attrs.update(setup_attrs)
1222
+
1223
+ test_pkg = os.path.join(path, 'test_pkg')
1224
+ os.mkdir(test_pkg)
1225
+
1226
+ # setup.cfg
1227
+ if use_setup_cfg:
1228
+ options = []
1229
+ metadata = []
1230
+ for name in use_setup_cfg:
1231
+ value = test_setup_attrs.pop(name)
1232
+ if name in 'name version'.split():
1233
+ section = metadata
1234
+ else:
1235
+ section = options
1236
+ if isinstance(value, (tuple, list)):
1237
+ value = ';'.join(value)
1238
+ section.append(f'{name}: {value}')
1239
+ test_setup_cfg_contents = DALS(
1240
+ """
1241
+ [metadata]
1242
+ {metadata}
1243
+ [options]
1244
+ {options}
1245
+ """
1246
+ ).format(
1247
+ options='\n'.join(options),
1248
+ metadata='\n'.join(metadata),
1249
+ )
1250
+ else:
1251
+ test_setup_cfg_contents = ''
1252
+ with open(os.path.join(test_pkg, 'setup.cfg'), 'w', encoding="utf-8") as f:
1253
+ f.write(test_setup_cfg_contents)
1254
+
1255
+ # setup.py
1256
+ if setup_py_template is None:
1257
+ setup_py_template = DALS(
1258
+ """\
1259
+ import setuptools
1260
+ setuptools.setup(**%r)
1261
+ """
1262
+ )
1263
+ with open(os.path.join(test_pkg, 'setup.py'), 'w', encoding="utf-8") as f:
1264
+ f.write(setup_py_template % test_setup_attrs)
1265
+
1266
+ foobar_path = os.path.join(path, f'{normalized_distname}-{version}.tar.gz')
1267
+ make_package(foobar_path, distname, version)
1268
+
1269
+ return test_pkg
1270
+
1271
+
1272
+ @pytest.mark.skipif(
1273
+ sys.platform.startswith('java') and ei.is_sh(sys.executable),
1274
+ reason="Test cannot run under java when executable is sh",
1275
+ )
1276
+ class TestScriptHeader:
1277
+ non_ascii_exe = '/Users/José/bin/python'
1278
+ exe_with_spaces = r'C:\Program Files\Python36\python.exe'
1279
+
1280
+ def test_get_script_header(self):
1281
+ expected = f'#!{ei.nt_quote_arg(os.path.normpath(sys.executable))}\n'
1282
+ actual = ei.ScriptWriter.get_header('#!/usr/local/bin/python')
1283
+ assert actual == expected
1284
+
1285
+ def test_get_script_header_args(self):
1286
+ expected = f'#!{ei.nt_quote_arg(os.path.normpath(sys.executable))} -x\n'
1287
+ actual = ei.ScriptWriter.get_header('#!/usr/bin/python -x')
1288
+ assert actual == expected
1289
+
1290
+ def test_get_script_header_non_ascii_exe(self):
1291
+ actual = ei.ScriptWriter.get_header(
1292
+ '#!/usr/bin/python', executable=self.non_ascii_exe
1293
+ )
1294
+ expected = f'#!{self.non_ascii_exe} -x\n'
1295
+ assert actual == expected
1296
+
1297
+ def test_get_script_header_exe_with_spaces(self):
1298
+ actual = ei.ScriptWriter.get_header(
1299
+ '#!/usr/bin/python', executable='"' + self.exe_with_spaces + '"'
1300
+ )
1301
+ expected = f'#!"{self.exe_with_spaces}"\n'
1302
+ assert actual == expected
1303
+
1304
+
1305
+ class TestCommandSpec:
1306
+ def test_custom_launch_command(self):
1307
+ """
1308
+ Show how a custom CommandSpec could be used to specify a #! executable
1309
+ which takes parameters.
1310
+ """
1311
+ cmd = ei.CommandSpec(['/usr/bin/env', 'python3'])
1312
+ assert cmd.as_header() == '#!/usr/bin/env python3\n'
1313
+
1314
+ def test_from_param_for_CommandSpec_is_passthrough(self):
1315
+ """
1316
+ from_param should return an instance of a CommandSpec
1317
+ """
1318
+ cmd = ei.CommandSpec(['python'])
1319
+ cmd_new = ei.CommandSpec.from_param(cmd)
1320
+ assert cmd is cmd_new
1321
+
1322
+ @mock.patch('sys.executable', TestScriptHeader.exe_with_spaces)
1323
+ @mock.patch.dict(os.environ)
1324
+ def test_from_environment_with_spaces_in_executable(self):
1325
+ os.environ.pop('__PYVENV_LAUNCHER__', None)
1326
+ cmd = ei.CommandSpec.from_environment()
1327
+ assert len(cmd) == 1
1328
+ assert cmd.as_header().startswith('#!"')
1329
+
1330
+ def test_from_simple_string_uses_shlex(self):
1331
+ """
1332
+ In order to support `executable = /usr/bin/env my-python`, make sure
1333
+ from_param invokes shlex on that input.
1334
+ """
1335
+ cmd = ei.CommandSpec.from_param('/usr/bin/env my-python')
1336
+ assert len(cmd) == 2
1337
+ assert '"' not in cmd.as_header()
1338
+
1339
+ def test_from_param_raises_expected_error(self) -> None:
1340
+ """
1341
+ from_param should raise its own TypeError when the argument's type is unsupported
1342
+ """
1343
+ with pytest.raises(TypeError) as exc_info:
1344
+ ei.CommandSpec.from_param(object()) # type: ignore[arg-type] # We want a type error here
1345
+ assert (
1346
+ str(exc_info.value) == "Argument has an unsupported type <class 'object'>"
1347
+ ), exc_info.value
1348
+
1349
+
1350
+ class TestWindowsScriptWriter:
1351
+ def test_header(self):
1352
+ hdr = ei.WindowsScriptWriter.get_header('')
1353
+ assert hdr.startswith('#!')
1354
+ assert hdr.endswith('\n')
1355
+ hdr = hdr.lstrip('#!')
1356
+ hdr = hdr.rstrip('\n')
1357
+ # header should not start with an escaped quote
1358
+ assert not hdr.startswith('\\"')
1359
+
1360
+
1361
+ class VersionStub(NamedTuple):
1362
+ major: int
1363
+ minor: int
1364
+ micro: int
1365
+ releaselevel: str
1366
+ serial: int
1367
+
1368
+
1369
+ def test_use_correct_python_version_string(tmpdir, tmpdir_cwd, monkeypatch):
1370
+ # In issue #3001, easy_install wrongly uses the `python3.1` directory
1371
+ # when the interpreter is `python3.10` and the `--user` option is given.
1372
+ # See pypa/setuptools#3001.
1373
+ dist = Distribution()
1374
+ cmd = dist.get_command_obj('easy_install')
1375
+ cmd.args = ['ok']
1376
+ cmd.optimize = 0
1377
+ cmd.user = True
1378
+ cmd.install_userbase = str(tmpdir)
1379
+ cmd.install_usersite = None
1380
+ install_cmd = dist.get_command_obj('install')
1381
+ install_cmd.install_userbase = str(tmpdir)
1382
+ install_cmd.install_usersite = None
1383
+
1384
+ with monkeypatch.context() as patch, warnings.catch_warnings():
1385
+ warnings.simplefilter("ignore")
1386
+ version = '3.10.1 (main, Dec 21 2021, 09:17:12) [GCC 10.2.1 20210110]'
1387
+ info = VersionStub(3, 10, 1, "final", 0)
1388
+ patch.setattr('site.ENABLE_USER_SITE', True)
1389
+ patch.setattr('sys.version', version)
1390
+ patch.setattr('sys.version_info', info)
1391
+ patch.setattr(cmd, 'create_home_path', mock.Mock())
1392
+ cmd.finalize_options()
1393
+
1394
+ name = "pypy" if hasattr(sys, 'pypy_version_info') else "python"
1395
+ install_dir = cmd.install_dir.lower()
1396
+
1397
+ # In some platforms (e.g. Windows), install_dir is mostly determined
1398
+ # via `sysconfig`, which define constants eagerly at module creation.
1399
+ # This means that monkeypatching `sys.version` to emulate 3.10 for testing
1400
+ # may have no effect.
1401
+ # The safest test here is to rely on the fact that 3.1 is no longer
1402
+ # supported/tested, and make sure that if 'python3.1' ever appears in the string
1403
+ # it is followed by another digit (e.g. 'python3.10').
1404
+ if re.search(name + r'3\.?1', install_dir):
1405
+ assert re.search(name + r'3\.?1\d', install_dir)
1406
+
1407
+ # The following "variables" are used for interpolation in distutils
1408
+ # installation schemes, so it should be fair to treat them as "semi-public",
1409
+ # or at least public enough so we can have a test to make sure they are correct
1410
+ assert cmd.config_vars['py_version'] == '3.10.1'
1411
+ assert cmd.config_vars['py_version_short'] == '3.10'
1412
+ assert cmd.config_vars['py_version_nodot'] == '310'
1413
+
1414
+
1415
+ @pytest.mark.xfail(
1416
+ sys.platform == "darwin",
1417
+ reason="https://github.com/pypa/setuptools/pull/4716#issuecomment-2447624418",
1418
+ )
1419
+ def test_editable_user_and_build_isolation(setup_context, monkeypatch, tmp_path):
1420
+ """`setup.py develop` should honor `--user` even under build isolation"""
1421
+
1422
+ # == Arrange ==
1423
+ # Pretend that build isolation was enabled
1424
+ # e.g pip sets the environment variable PYTHONNOUSERSITE=1
1425
+ monkeypatch.setattr('site.ENABLE_USER_SITE', False)
1426
+
1427
+ # Patching $HOME for 2 reasons:
1428
+ # 1. setuptools/command/easy_install.py:create_home_path
1429
+ # tries creating directories in $HOME.
1430
+ # Given::
1431
+ # self.config_vars['DESTDIRS'] = (
1432
+ # "/home/user/.pyenv/versions/3.9.10 "
1433
+ # "/home/user/.pyenv/versions/3.9.10/lib "
1434
+ # "/home/user/.pyenv/versions/3.9.10/lib/python3.9 "
1435
+ # "/home/user/.pyenv/versions/3.9.10/lib/python3.9/lib-dynload")
1436
+ # `create_home_path` will::
1437
+ # makedirs(
1438
+ # "/home/user/.pyenv/versions/3.9.10 "
1439
+ # "/home/user/.pyenv/versions/3.9.10/lib "
1440
+ # "/home/user/.pyenv/versions/3.9.10/lib/python3.9 "
1441
+ # "/home/user/.pyenv/versions/3.9.10/lib/python3.9/lib-dynload")
1442
+ #
1443
+ # 2. We are going to force `site` to update site.USER_BASE and site.USER_SITE
1444
+ # To point inside our new home
1445
+ monkeypatch.setenv('HOME', str(tmp_path / '.home'))
1446
+ monkeypatch.setenv('USERPROFILE', str(tmp_path / '.home'))
1447
+ monkeypatch.setenv('APPDATA', str(tmp_path / '.home'))
1448
+ monkeypatch.setattr('site.USER_BASE', None)
1449
+ monkeypatch.setattr('site.USER_SITE', None)
1450
+ user_site = Path(site.getusersitepackages())
1451
+ user_site.mkdir(parents=True, exist_ok=True)
1452
+
1453
+ sys_prefix = tmp_path / '.sys_prefix'
1454
+ sys_prefix.mkdir(parents=True, exist_ok=True)
1455
+ monkeypatch.setattr('sys.prefix', str(sys_prefix))
1456
+
1457
+ setup_script = (
1458
+ "__import__('setuptools').setup(name='aproj', version=42, packages=[])\n"
1459
+ )
1460
+ (tmp_path / "setup.py").write_text(setup_script, encoding="utf-8")
1461
+
1462
+ # == Sanity check ==
1463
+ assert list(sys_prefix.glob("*")) == []
1464
+ assert list(user_site.glob("*")) == []
1465
+
1466
+ # == Act ==
1467
+ run_setup('setup.py', ['develop', '--user'])
1468
+
1469
+ # == Assert ==
1470
+ # Should not install to sys.prefix
1471
+ assert list(sys_prefix.glob("*")) == []
1472
+ # Should install to user site
1473
+ installed = {f.name for f in user_site.glob("*")}
1474
+ # sometimes easy-install.pth is created and sometimes not
1475
+ installed = installed - {"easy-install.pth"}
1476
+ assert installed == {'aproj.egg-link'}
.venv/lib/python3.12/site-packages/setuptools/tests/test_editable_install.py ADDED
@@ -0,0 +1,1289 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import os
4
+ import platform
5
+ import stat
6
+ import subprocess
7
+ import sys
8
+ from copy import deepcopy
9
+ from importlib import import_module
10
+ from importlib.machinery import EXTENSION_SUFFIXES
11
+ from pathlib import Path
12
+ from textwrap import dedent
13
+ from typing import Any
14
+ from unittest.mock import Mock
15
+ from uuid import uuid4
16
+
17
+ import jaraco.envs
18
+ import jaraco.path
19
+ import pytest
20
+ from path import Path as _Path
21
+
22
+ from setuptools._importlib import resources as importlib_resources
23
+ from setuptools.command.editable_wheel import (
24
+ _DebuggingTips,
25
+ _encode_pth,
26
+ _find_namespaces,
27
+ _find_package_roots,
28
+ _find_virtual_namespaces,
29
+ _finder_template,
30
+ _LinkTree,
31
+ _TopLevelFinder,
32
+ editable_wheel,
33
+ )
34
+ from setuptools.dist import Distribution
35
+ from setuptools.extension import Extension
36
+ from setuptools.warnings import SetuptoolsDeprecationWarning
37
+
38
+ from . import contexts, namespaces
39
+
40
+ from distutils.core import run_setup
41
+
42
+
43
+ @pytest.fixture(params=["strict", "lenient"])
44
+ def editable_opts(request):
45
+ if request.param == "strict":
46
+ return ["--config-settings", "editable-mode=strict"]
47
+ return []
48
+
49
+
50
+ EXAMPLE = {
51
+ 'pyproject.toml': dedent(
52
+ """\
53
+ [build-system]
54
+ requires = ["setuptools"]
55
+ build-backend = "setuptools.build_meta"
56
+
57
+ [project]
58
+ name = "mypkg"
59
+ version = "3.14159"
60
+ license = {text = "MIT"}
61
+ description = "This is a Python package"
62
+ dynamic = ["readme"]
63
+ classifiers = [
64
+ "Development Status :: 5 - Production/Stable",
65
+ "Intended Audience :: Developers"
66
+ ]
67
+ urls = {Homepage = "https://github.com"}
68
+
69
+ [tool.setuptools]
70
+ package-dir = {"" = "src"}
71
+ packages = {find = {where = ["src"]}}
72
+ license-files = ["LICENSE*"]
73
+
74
+ [tool.setuptools.dynamic]
75
+ readme = {file = "README.rst"}
76
+
77
+ [tool.distutils.egg_info]
78
+ tag-build = ".post0"
79
+ """
80
+ ),
81
+ "MANIFEST.in": dedent(
82
+ """\
83
+ global-include *.py *.txt
84
+ global-exclude *.py[cod]
85
+ prune dist
86
+ prune build
87
+ """
88
+ ).strip(),
89
+ "README.rst": "This is a ``README``",
90
+ "LICENSE.txt": "---- placeholder MIT license ----",
91
+ "src": {
92
+ "mypkg": {
93
+ "__init__.py": dedent(
94
+ """\
95
+ import sys
96
+ from importlib.metadata import PackageNotFoundError, version
97
+
98
+ try:
99
+ __version__ = version(__name__)
100
+ except PackageNotFoundError:
101
+ __version__ = "unknown"
102
+ """
103
+ ),
104
+ "__main__.py": dedent(
105
+ """\
106
+ from importlib.resources import read_text
107
+ from . import __version__, __name__ as parent
108
+ from .mod import x
109
+
110
+ data = read_text(parent, "data.txt")
111
+ print(__version__, data, x)
112
+ """
113
+ ),
114
+ "mod.py": "x = ''",
115
+ "data.txt": "Hello World",
116
+ }
117
+ },
118
+ }
119
+
120
+
121
+ SETUP_SCRIPT_STUB = "__import__('setuptools').setup()"
122
+
123
+
124
+ @pytest.mark.xfail(sys.platform == "darwin", reason="pypa/setuptools#4328")
125
+ @pytest.mark.parametrize(
126
+ "files",
127
+ [
128
+ {**EXAMPLE, "setup.py": SETUP_SCRIPT_STUB},
129
+ EXAMPLE, # No setup.py script
130
+ ],
131
+ )
132
+ def test_editable_with_pyproject(tmp_path, venv, files, editable_opts):
133
+ project = tmp_path / "mypkg"
134
+ project.mkdir()
135
+ jaraco.path.build(files, prefix=project)
136
+
137
+ cmd = [
138
+ "python",
139
+ "-m",
140
+ "pip",
141
+ "install",
142
+ "--no-build-isolation", # required to force current version of setuptools
143
+ "-e",
144
+ str(project),
145
+ *editable_opts,
146
+ ]
147
+ print(venv.run(cmd))
148
+
149
+ cmd = ["python", "-m", "mypkg"]
150
+ assert venv.run(cmd).strip() == "3.14159.post0 Hello World"
151
+
152
+ (project / "src/mypkg/data.txt").write_text("foobar", encoding="utf-8")
153
+ (project / "src/mypkg/mod.py").write_text("x = 42", encoding="utf-8")
154
+ assert venv.run(cmd).strip() == "3.14159.post0 foobar 42"
155
+
156
+
157
+ def test_editable_with_flat_layout(tmp_path, venv, editable_opts):
158
+ files = {
159
+ "mypkg": {
160
+ "pyproject.toml": dedent(
161
+ """\
162
+ [build-system]
163
+ requires = ["setuptools", "wheel"]
164
+ build-backend = "setuptools.build_meta"
165
+
166
+ [project]
167
+ name = "mypkg"
168
+ version = "3.14159"
169
+
170
+ [tool.setuptools]
171
+ packages = ["pkg"]
172
+ py-modules = ["mod"]
173
+ """
174
+ ),
175
+ "pkg": {"__init__.py": "a = 4"},
176
+ "mod.py": "b = 2",
177
+ },
178
+ }
179
+ jaraco.path.build(files, prefix=tmp_path)
180
+ project = tmp_path / "mypkg"
181
+
182
+ cmd = [
183
+ "python",
184
+ "-m",
185
+ "pip",
186
+ "install",
187
+ "--no-build-isolation", # required to force current version of setuptools
188
+ "-e",
189
+ str(project),
190
+ *editable_opts,
191
+ ]
192
+ print(venv.run(cmd))
193
+ cmd = ["python", "-c", "import pkg, mod; print(pkg.a, mod.b)"]
194
+ assert venv.run(cmd).strip() == "4 2"
195
+
196
+
197
+ def test_editable_with_single_module(tmp_path, venv, editable_opts):
198
+ files = {
199
+ "mypkg": {
200
+ "pyproject.toml": dedent(
201
+ """\
202
+ [build-system]
203
+ requires = ["setuptools", "wheel"]
204
+ build-backend = "setuptools.build_meta"
205
+
206
+ [project]
207
+ name = "mod"
208
+ version = "3.14159"
209
+
210
+ [tool.setuptools]
211
+ py-modules = ["mod"]
212
+ """
213
+ ),
214
+ "mod.py": "b = 2",
215
+ },
216
+ }
217
+ jaraco.path.build(files, prefix=tmp_path)
218
+ project = tmp_path / "mypkg"
219
+
220
+ cmd = [
221
+ "python",
222
+ "-m",
223
+ "pip",
224
+ "install",
225
+ "--no-build-isolation", # required to force current version of setuptools
226
+ "-e",
227
+ str(project),
228
+ *editable_opts,
229
+ ]
230
+ print(venv.run(cmd))
231
+ cmd = ["python", "-c", "import mod; print(mod.b)"]
232
+ assert venv.run(cmd).strip() == "2"
233
+
234
+
235
+ class TestLegacyNamespaces:
236
+ # legacy => pkg_resources.declare_namespace(...) + setup(namespace_packages=...)
237
+
238
+ def test_nspkg_file_is_unique(self, tmp_path, monkeypatch):
239
+ deprecation = pytest.warns(
240
+ SetuptoolsDeprecationWarning, match=".*namespace_packages parameter.*"
241
+ )
242
+ installation_dir = tmp_path / ".installation_dir"
243
+ installation_dir.mkdir()
244
+ examples = (
245
+ "myns.pkgA",
246
+ "myns.pkgB",
247
+ "myns.n.pkgA",
248
+ "myns.n.pkgB",
249
+ )
250
+
251
+ for name in examples:
252
+ pkg = namespaces.build_namespace_package(tmp_path, name, version="42")
253
+ with deprecation, monkeypatch.context() as ctx:
254
+ ctx.chdir(pkg)
255
+ dist = run_setup("setup.py", stop_after="config")
256
+ cmd = editable_wheel(dist)
257
+ cmd.finalize_options()
258
+ editable_name = cmd.get_finalized_command("dist_info").name
259
+ cmd._install_namespaces(installation_dir, editable_name)
260
+
261
+ files = list(installation_dir.glob("*-nspkg.pth"))
262
+ assert len(files) == len(examples)
263
+
264
+ @pytest.mark.parametrize(
265
+ "impl",
266
+ (
267
+ "pkg_resources",
268
+ # "pkgutil", => does not work
269
+ ),
270
+ )
271
+ @pytest.mark.parametrize("ns", ("myns.n",))
272
+ def test_namespace_package_importable(
273
+ self, venv, tmp_path, ns, impl, editable_opts
274
+ ):
275
+ """
276
+ Installing two packages sharing the same namespace, one installed
277
+ naturally using pip or `--single-version-externally-managed`
278
+ and the other installed in editable mode should leave the namespace
279
+ intact and both packages reachable by import.
280
+ (Ported from test_develop).
281
+ """
282
+ build_system = """\
283
+ [build-system]
284
+ requires = ["setuptools"]
285
+ build-backend = "setuptools.build_meta"
286
+ """
287
+ pkg_A = namespaces.build_namespace_package(tmp_path, f"{ns}.pkgA", impl=impl)
288
+ pkg_B = namespaces.build_namespace_package(tmp_path, f"{ns}.pkgB", impl=impl)
289
+ (pkg_A / "pyproject.toml").write_text(build_system, encoding="utf-8")
290
+ (pkg_B / "pyproject.toml").write_text(build_system, encoding="utf-8")
291
+ # use pip to install to the target directory
292
+ opts = editable_opts[:]
293
+ opts.append("--no-build-isolation") # force current version of setuptools
294
+ venv.run(["python", "-m", "pip", "install", str(pkg_A), *opts])
295
+ venv.run(["python", "-m", "pip", "install", "-e", str(pkg_B), *opts])
296
+ venv.run(["python", "-c", f"import {ns}.pkgA; import {ns}.pkgB"])
297
+ # additionally ensure that pkg_resources import works
298
+ venv.run(["python", "-c", "import pkg_resources"])
299
+
300
+
301
+ class TestPep420Namespaces:
302
+ def test_namespace_package_importable(self, venv, tmp_path, editable_opts):
303
+ """
304
+ Installing two packages sharing the same namespace, one installed
305
+ normally using pip and the other installed in editable mode
306
+ should allow importing both packages.
307
+ """
308
+ pkg_A = namespaces.build_pep420_namespace_package(tmp_path, 'myns.n.pkgA')
309
+ pkg_B = namespaces.build_pep420_namespace_package(tmp_path, 'myns.n.pkgB')
310
+ # use pip to install to the target directory
311
+ opts = editable_opts[:]
312
+ opts.append("--no-build-isolation") # force current version of setuptools
313
+ venv.run(["python", "-m", "pip", "install", str(pkg_A), *opts])
314
+ venv.run(["python", "-m", "pip", "install", "-e", str(pkg_B), *opts])
315
+ venv.run(["python", "-c", "import myns.n.pkgA; import myns.n.pkgB"])
316
+
317
+ def test_namespace_created_via_package_dir(self, venv, tmp_path, editable_opts):
318
+ """Currently users can create a namespace by tweaking `package_dir`"""
319
+ files = {
320
+ "pkgA": {
321
+ "pyproject.toml": dedent(
322
+ """\
323
+ [build-system]
324
+ requires = ["setuptools", "wheel"]
325
+ build-backend = "setuptools.build_meta"
326
+
327
+ [project]
328
+ name = "pkgA"
329
+ version = "3.14159"
330
+
331
+ [tool.setuptools]
332
+ package-dir = {"myns.n.pkgA" = "src"}
333
+ """
334
+ ),
335
+ "src": {"__init__.py": "a = 1"},
336
+ },
337
+ }
338
+ jaraco.path.build(files, prefix=tmp_path)
339
+ pkg_A = tmp_path / "pkgA"
340
+ pkg_B = namespaces.build_pep420_namespace_package(tmp_path, 'myns.n.pkgB')
341
+ pkg_C = namespaces.build_pep420_namespace_package(tmp_path, 'myns.n.pkgC')
342
+
343
+ # use pip to install to the target directory
344
+ opts = editable_opts[:]
345
+ opts.append("--no-build-isolation") # force current version of setuptools
346
+ venv.run(["python", "-m", "pip", "install", str(pkg_A), *opts])
347
+ venv.run(["python", "-m", "pip", "install", "-e", str(pkg_B), *opts])
348
+ venv.run(["python", "-m", "pip", "install", "-e", str(pkg_C), *opts])
349
+ venv.run(["python", "-c", "from myns.n import pkgA, pkgB, pkgC"])
350
+
351
+ def test_namespace_accidental_config_in_lenient_mode(self, venv, tmp_path):
352
+ """Sometimes users might specify an ``include`` pattern that ignores parent
353
+ packages. In a normal installation this would ignore all modules inside the
354
+ parent packages, and make them namespaces (reported in issue #3504),
355
+ so the editable mode should preserve this behaviour.
356
+ """
357
+ files = {
358
+ "pkgA": {
359
+ "pyproject.toml": dedent(
360
+ """\
361
+ [build-system]
362
+ requires = ["setuptools", "wheel"]
363
+ build-backend = "setuptools.build_meta"
364
+
365
+ [project]
366
+ name = "pkgA"
367
+ version = "3.14159"
368
+
369
+ [tool.setuptools]
370
+ packages.find.include = ["mypkg.*"]
371
+ """
372
+ ),
373
+ "mypkg": {
374
+ "__init__.py": "",
375
+ "other.py": "b = 1",
376
+ "n": {
377
+ "__init__.py": "",
378
+ "pkgA.py": "a = 1",
379
+ },
380
+ },
381
+ "MANIFEST.in": EXAMPLE["MANIFEST.in"],
382
+ },
383
+ }
384
+ jaraco.path.build(files, prefix=tmp_path)
385
+ pkg_A = tmp_path / "pkgA"
386
+
387
+ # use pip to install to the target directory
388
+ opts = ["--no-build-isolation"] # force current version of setuptools
389
+ venv.run(["python", "-m", "pip", "-v", "install", "-e", str(pkg_A), *opts])
390
+ out = venv.run(["python", "-c", "from mypkg.n import pkgA; print(pkgA.a)"])
391
+ assert out.strip() == "1"
392
+ cmd = """\
393
+ try:
394
+ import mypkg.other
395
+ except ImportError:
396
+ print("mypkg.other not defined")
397
+ """
398
+ out = venv.run(["python", "-c", dedent(cmd)])
399
+ assert "mypkg.other not defined" in out
400
+
401
+
402
+ def test_editable_with_prefix(tmp_path, sample_project, editable_opts):
403
+ """
404
+ Editable install to a prefix should be discoverable.
405
+ """
406
+ prefix = tmp_path / 'prefix'
407
+
408
+ # figure out where pip will likely install the package
409
+ site_packages_all = [
410
+ prefix / Path(path).relative_to(sys.prefix)
411
+ for path in sys.path
412
+ if 'site-packages' in path and path.startswith(sys.prefix)
413
+ ]
414
+
415
+ for sp in site_packages_all:
416
+ sp.mkdir(parents=True)
417
+
418
+ # install workaround
419
+ _addsitedirs(site_packages_all)
420
+
421
+ env = dict(os.environ, PYTHONPATH=os.pathsep.join(map(str, site_packages_all)))
422
+ cmd = [
423
+ sys.executable,
424
+ '-m',
425
+ 'pip',
426
+ 'install',
427
+ '--editable',
428
+ str(sample_project),
429
+ '--prefix',
430
+ str(prefix),
431
+ '--no-build-isolation',
432
+ *editable_opts,
433
+ ]
434
+ subprocess.check_call(cmd, env=env)
435
+
436
+ # now run 'sample' with the prefix on the PYTHONPATH
437
+ bin = 'Scripts' if platform.system() == 'Windows' else 'bin'
438
+ exe = prefix / bin / 'sample'
439
+ subprocess.check_call([exe], env=env)
440
+
441
+
442
+ class TestFinderTemplate:
443
+ """This test focus in getting a particular implementation detail right.
444
+ If at some point in time the implementation is changed for something different,
445
+ this test can be modified or even excluded.
446
+ """
447
+
448
+ def install_finder(self, finder):
449
+ loc = {}
450
+ exec(finder, loc, loc)
451
+ loc["install"]()
452
+
453
+ def test_packages(self, tmp_path):
454
+ files = {
455
+ "src1": {
456
+ "pkg1": {
457
+ "__init__.py": "",
458
+ "subpkg": {"mod1.py": "a = 42"},
459
+ },
460
+ },
461
+ "src2": {"mod2.py": "a = 43"},
462
+ }
463
+ jaraco.path.build(files, prefix=tmp_path)
464
+
465
+ mapping = {
466
+ "pkg1": str(tmp_path / "src1/pkg1"),
467
+ "mod2": str(tmp_path / "src2/mod2"),
468
+ }
469
+ template = _finder_template(str(uuid4()), mapping, {})
470
+
471
+ with contexts.save_paths(), contexts.save_sys_modules():
472
+ for mod in ("pkg1", "pkg1.subpkg", "pkg1.subpkg.mod1", "mod2"):
473
+ sys.modules.pop(mod, None)
474
+
475
+ self.install_finder(template)
476
+ mod1 = import_module("pkg1.subpkg.mod1")
477
+ mod2 = import_module("mod2")
478
+ subpkg = import_module("pkg1.subpkg")
479
+
480
+ assert mod1.a == 42
481
+ assert mod2.a == 43
482
+ expected = str((tmp_path / "src1/pkg1/subpkg").resolve())
483
+ assert_path(subpkg, expected)
484
+
485
+ def test_namespace(self, tmp_path):
486
+ files = {"pkg": {"__init__.py": "a = 13", "text.txt": "abc"}}
487
+ jaraco.path.build(files, prefix=tmp_path)
488
+
489
+ mapping = {"ns.othername": str(tmp_path / "pkg")}
490
+ namespaces = {"ns": []}
491
+
492
+ template = _finder_template(str(uuid4()), mapping, namespaces)
493
+ with contexts.save_paths(), contexts.save_sys_modules():
494
+ for mod in ("ns", "ns.othername"):
495
+ sys.modules.pop(mod, None)
496
+
497
+ self.install_finder(template)
498
+ pkg = import_module("ns.othername")
499
+ text = importlib_resources.files(pkg) / "text.txt"
500
+
501
+ expected = str((tmp_path / "pkg").resolve())
502
+ assert_path(pkg, expected)
503
+ assert pkg.a == 13
504
+
505
+ # Make sure resources can also be found
506
+ assert text.read_text(encoding="utf-8") == "abc"
507
+
508
+ def test_combine_namespaces(self, tmp_path):
509
+ files = {
510
+ "src1": {"ns": {"pkg1": {"__init__.py": "a = 13"}}},
511
+ "src2": {"ns": {"mod2.py": "b = 37"}},
512
+ }
513
+ jaraco.path.build(files, prefix=tmp_path)
514
+
515
+ mapping = {
516
+ "ns.pkgA": str(tmp_path / "src1/ns/pkg1"),
517
+ "ns": str(tmp_path / "src2/ns"),
518
+ }
519
+ namespaces_ = {"ns": [str(tmp_path / "src1"), str(tmp_path / "src2")]}
520
+ template = _finder_template(str(uuid4()), mapping, namespaces_)
521
+
522
+ with contexts.save_paths(), contexts.save_sys_modules():
523
+ for mod in ("ns", "ns.pkgA", "ns.mod2"):
524
+ sys.modules.pop(mod, None)
525
+
526
+ self.install_finder(template)
527
+ pkgA = import_module("ns.pkgA")
528
+ mod2 = import_module("ns.mod2")
529
+
530
+ expected = str((tmp_path / "src1/ns/pkg1").resolve())
531
+ assert_path(pkgA, expected)
532
+ assert pkgA.a == 13
533
+ assert mod2.b == 37
534
+
535
+ def test_combine_namespaces_nested(self, tmp_path):
536
+ """
537
+ Users may attempt to combine namespace packages in a nested way via
538
+ ``package_dir`` as shown in pypa/setuptools#4248.
539
+ """
540
+
541
+ files = {
542
+ "src": {"my_package": {"my_module.py": "a = 13"}},
543
+ "src2": {"my_package2": {"my_module2.py": "b = 37"}},
544
+ }
545
+
546
+ stack = jaraco.path.DirectoryStack()
547
+ with stack.context(tmp_path):
548
+ jaraco.path.build(files)
549
+ attrs = {
550
+ "script_name": "%PEP 517%",
551
+ "package_dir": {
552
+ "different_name": "src/my_package",
553
+ "different_name.subpkg": "src2/my_package2",
554
+ },
555
+ "packages": ["different_name", "different_name.subpkg"],
556
+ }
557
+ dist = Distribution(attrs)
558
+ finder = _TopLevelFinder(dist, str(uuid4()))
559
+ code = next(v for k, v in finder.get_implementation() if k.endswith(".py"))
560
+
561
+ with contexts.save_paths(), contexts.save_sys_modules():
562
+ for mod in attrs["packages"]:
563
+ sys.modules.pop(mod, None)
564
+
565
+ self.install_finder(code)
566
+ mod1 = import_module("different_name.my_module")
567
+ mod2 = import_module("different_name.subpkg.my_module2")
568
+
569
+ expected = str((tmp_path / "src/my_package/my_module.py").resolve())
570
+ assert str(Path(mod1.__file__).resolve()) == expected
571
+
572
+ expected = str((tmp_path / "src2/my_package2/my_module2.py").resolve())
573
+ assert str(Path(mod2.__file__).resolve()) == expected
574
+
575
+ assert mod1.a == 13
576
+ assert mod2.b == 37
577
+
578
+ def test_dynamic_path_computation(self, tmp_path):
579
+ # Follows the example in PEP 420
580
+ files = {
581
+ "project1": {"parent": {"child": {"one.py": "x = 1"}}},
582
+ "project2": {"parent": {"child": {"two.py": "x = 2"}}},
583
+ "project3": {"parent": {"child": {"three.py": "x = 3"}}},
584
+ }
585
+ jaraco.path.build(files, prefix=tmp_path)
586
+ mapping = {}
587
+ namespaces_ = {"parent": [str(tmp_path / "project1/parent")]}
588
+ template = _finder_template(str(uuid4()), mapping, namespaces_)
589
+
590
+ mods = (f"parent.child.{name}" for name in ("one", "two", "three"))
591
+ with contexts.save_paths(), contexts.save_sys_modules():
592
+ for mod in ("parent", "parent.child", "parent.child", *mods):
593
+ sys.modules.pop(mod, None)
594
+
595
+ self.install_finder(template)
596
+
597
+ one = import_module("parent.child.one")
598
+ assert one.x == 1
599
+
600
+ with pytest.raises(ImportError):
601
+ import_module("parent.child.two")
602
+
603
+ sys.path.append(str(tmp_path / "project2"))
604
+ two = import_module("parent.child.two")
605
+ assert two.x == 2
606
+
607
+ with pytest.raises(ImportError):
608
+ import_module("parent.child.three")
609
+
610
+ sys.path.append(str(tmp_path / "project3"))
611
+ three = import_module("parent.child.three")
612
+ assert three.x == 3
613
+
614
+ def test_no_recursion(self, tmp_path):
615
+ # See issue #3550
616
+ files = {
617
+ "pkg": {
618
+ "__init__.py": "from . import pkg",
619
+ },
620
+ }
621
+ jaraco.path.build(files, prefix=tmp_path)
622
+
623
+ mapping = {
624
+ "pkg": str(tmp_path / "pkg"),
625
+ }
626
+ template = _finder_template(str(uuid4()), mapping, {})
627
+
628
+ with contexts.save_paths(), contexts.save_sys_modules():
629
+ sys.modules.pop("pkg", None)
630
+
631
+ self.install_finder(template)
632
+ with pytest.raises(ImportError, match="pkg"):
633
+ import_module("pkg")
634
+
635
+ def test_similar_name(self, tmp_path):
636
+ files = {
637
+ "foo": {
638
+ "__init__.py": "",
639
+ "bar": {
640
+ "__init__.py": "",
641
+ },
642
+ },
643
+ }
644
+ jaraco.path.build(files, prefix=tmp_path)
645
+
646
+ mapping = {
647
+ "foo": str(tmp_path / "foo"),
648
+ }
649
+ template = _finder_template(str(uuid4()), mapping, {})
650
+
651
+ with contexts.save_paths(), contexts.save_sys_modules():
652
+ sys.modules.pop("foo", None)
653
+ sys.modules.pop("foo.bar", None)
654
+
655
+ self.install_finder(template)
656
+ with pytest.raises(ImportError, match="foobar"):
657
+ import_module("foobar")
658
+
659
+ def test_case_sensitivity(self, tmp_path):
660
+ files = {
661
+ "foo": {
662
+ "__init__.py": "",
663
+ "lowercase.py": "x = 1",
664
+ "bar": {
665
+ "__init__.py": "",
666
+ "lowercase.py": "x = 2",
667
+ },
668
+ },
669
+ }
670
+ jaraco.path.build(files, prefix=tmp_path)
671
+ mapping = {
672
+ "foo": str(tmp_path / "foo"),
673
+ }
674
+ template = _finder_template(str(uuid4()), mapping, {})
675
+ with contexts.save_paths(), contexts.save_sys_modules():
676
+ sys.modules.pop("foo", None)
677
+
678
+ self.install_finder(template)
679
+ with pytest.raises(ImportError, match="'FOO'"):
680
+ import_module("FOO")
681
+
682
+ with pytest.raises(ImportError, match="'foo\\.LOWERCASE'"):
683
+ import_module("foo.LOWERCASE")
684
+
685
+ with pytest.raises(ImportError, match="'foo\\.bar\\.Lowercase'"):
686
+ import_module("foo.bar.Lowercase")
687
+
688
+ with pytest.raises(ImportError, match="'foo\\.BAR'"):
689
+ import_module("foo.BAR.lowercase")
690
+
691
+ with pytest.raises(ImportError, match="'FOO'"):
692
+ import_module("FOO.bar.lowercase")
693
+
694
+ mod = import_module("foo.lowercase")
695
+ assert mod.x == 1
696
+
697
+ mod = import_module("foo.bar.lowercase")
698
+ assert mod.x == 2
699
+
700
+ def test_namespace_case_sensitivity(self, tmp_path):
701
+ files = {
702
+ "pkg": {
703
+ "__init__.py": "a = 13",
704
+ "foo": {
705
+ "__init__.py": "b = 37",
706
+ "bar.py": "c = 42",
707
+ },
708
+ },
709
+ }
710
+ jaraco.path.build(files, prefix=tmp_path)
711
+
712
+ mapping = {"ns.othername": str(tmp_path / "pkg")}
713
+ namespaces = {"ns": []}
714
+
715
+ template = _finder_template(str(uuid4()), mapping, namespaces)
716
+ with contexts.save_paths(), contexts.save_sys_modules():
717
+ for mod in ("ns", "ns.othername"):
718
+ sys.modules.pop(mod, None)
719
+
720
+ self.install_finder(template)
721
+ pkg = import_module("ns.othername")
722
+ expected = str((tmp_path / "pkg").resolve())
723
+ assert_path(pkg, expected)
724
+ assert pkg.a == 13
725
+
726
+ foo = import_module("ns.othername.foo")
727
+ assert foo.b == 37
728
+
729
+ bar = import_module("ns.othername.foo.bar")
730
+ assert bar.c == 42
731
+
732
+ with pytest.raises(ImportError, match="'NS'"):
733
+ import_module("NS.othername.foo")
734
+
735
+ with pytest.raises(ImportError, match="'ns\\.othername\\.FOO\\'"):
736
+ import_module("ns.othername.FOO")
737
+
738
+ with pytest.raises(ImportError, match="'ns\\.othername\\.foo\\.BAR\\'"):
739
+ import_module("ns.othername.foo.BAR")
740
+
741
+ def test_intermediate_packages(self, tmp_path):
742
+ """
743
+ The finder should not import ``fullname`` if the intermediate segments
744
+ don't exist (see pypa/setuptools#4019).
745
+ """
746
+ files = {
747
+ "src": {
748
+ "mypkg": {
749
+ "__init__.py": "",
750
+ "config.py": "a = 13",
751
+ "helloworld.py": "b = 13",
752
+ "components": {
753
+ "config.py": "a = 37",
754
+ },
755
+ },
756
+ }
757
+ }
758
+ jaraco.path.build(files, prefix=tmp_path)
759
+
760
+ mapping = {"mypkg": str(tmp_path / "src/mypkg")}
761
+ template = _finder_template(str(uuid4()), mapping, {})
762
+
763
+ with contexts.save_paths(), contexts.save_sys_modules():
764
+ for mod in (
765
+ "mypkg",
766
+ "mypkg.config",
767
+ "mypkg.helloworld",
768
+ "mypkg.components",
769
+ "mypkg.components.config",
770
+ "mypkg.components.helloworld",
771
+ ):
772
+ sys.modules.pop(mod, None)
773
+
774
+ self.install_finder(template)
775
+
776
+ config = import_module("mypkg.components.config")
777
+ assert config.a == 37
778
+
779
+ helloworld = import_module("mypkg.helloworld")
780
+ assert helloworld.b == 13
781
+
782
+ with pytest.raises(ImportError):
783
+ import_module("mypkg.components.helloworld")
784
+
785
+
786
+ def test_pkg_roots(tmp_path):
787
+ """This test focus in getting a particular implementation detail right.
788
+ If at some point in time the implementation is changed for something different,
789
+ this test can be modified or even excluded.
790
+ """
791
+ files = {
792
+ "a": {"b": {"__init__.py": "ab = 1"}, "__init__.py": "a = 1"},
793
+ "d": {"__init__.py": "d = 1", "e": {"__init__.py": "de = 1"}},
794
+ "f": {"g": {"h": {"__init__.py": "fgh = 1"}}},
795
+ "other": {"__init__.py": "abc = 1"},
796
+ "another": {"__init__.py": "abcxyz = 1"},
797
+ "yet_another": {"__init__.py": "mnopq = 1"},
798
+ }
799
+ jaraco.path.build(files, prefix=tmp_path)
800
+ package_dir = {
801
+ "a.b.c": "other",
802
+ "a.b.c.x.y.z": "another",
803
+ "m.n.o.p.q": "yet_another",
804
+ }
805
+ packages = [
806
+ "a",
807
+ "a.b",
808
+ "a.b.c",
809
+ "a.b.c.x.y",
810
+ "a.b.c.x.y.z",
811
+ "d",
812
+ "d.e",
813
+ "f",
814
+ "f.g",
815
+ "f.g.h",
816
+ "m.n.o.p.q",
817
+ ]
818
+ roots = _find_package_roots(packages, package_dir, tmp_path)
819
+ assert roots == {
820
+ "a": str(tmp_path / "a"),
821
+ "a.b.c": str(tmp_path / "other"),
822
+ "a.b.c.x.y.z": str(tmp_path / "another"),
823
+ "d": str(tmp_path / "d"),
824
+ "f": str(tmp_path / "f"),
825
+ "m.n.o.p.q": str(tmp_path / "yet_another"),
826
+ }
827
+
828
+ ns = set(dict(_find_namespaces(packages, roots)))
829
+ assert ns == {"f", "f.g"}
830
+
831
+ ns = set(_find_virtual_namespaces(roots))
832
+ assert ns == {"a.b", "a.b.c.x", "a.b.c.x.y", "m", "m.n", "m.n.o", "m.n.o.p"}
833
+
834
+
835
+ class TestOverallBehaviour:
836
+ PYPROJECT = """\
837
+ [build-system]
838
+ requires = ["setuptools"]
839
+ build-backend = "setuptools.build_meta"
840
+
841
+ [project]
842
+ name = "mypkg"
843
+ version = "3.14159"
844
+ """
845
+
846
+ # Any: Would need a TypedDict. Keep it simple for tests
847
+ FLAT_LAYOUT: dict[str, Any] = {
848
+ "pyproject.toml": dedent(PYPROJECT),
849
+ "MANIFEST.in": EXAMPLE["MANIFEST.in"],
850
+ "otherfile.py": "",
851
+ "mypkg": {
852
+ "__init__.py": "",
853
+ "mod1.py": "var = 42",
854
+ "subpackage": {
855
+ "__init__.py": "",
856
+ "mod2.py": "var = 13",
857
+ "resource_file.txt": "resource 39",
858
+ },
859
+ },
860
+ }
861
+
862
+ EXAMPLES = {
863
+ "flat-layout": FLAT_LAYOUT,
864
+ "src-layout": {
865
+ "pyproject.toml": dedent(PYPROJECT),
866
+ "MANIFEST.in": EXAMPLE["MANIFEST.in"],
867
+ "otherfile.py": "",
868
+ "src": {"mypkg": FLAT_LAYOUT["mypkg"]},
869
+ },
870
+ "custom-layout": {
871
+ "pyproject.toml": dedent(PYPROJECT)
872
+ + dedent(
873
+ """\
874
+ [tool.setuptools]
875
+ packages = ["mypkg", "mypkg.subpackage"]
876
+
877
+ [tool.setuptools.package-dir]
878
+ "mypkg.subpackage" = "other"
879
+ """
880
+ ),
881
+ "MANIFEST.in": EXAMPLE["MANIFEST.in"],
882
+ "otherfile.py": "",
883
+ "mypkg": {
884
+ "__init__.py": "",
885
+ "mod1.py": FLAT_LAYOUT["mypkg"]["mod1.py"],
886
+ },
887
+ "other": FLAT_LAYOUT["mypkg"]["subpackage"],
888
+ },
889
+ "namespace": {
890
+ "pyproject.toml": dedent(PYPROJECT),
891
+ "MANIFEST.in": EXAMPLE["MANIFEST.in"],
892
+ "otherfile.py": "",
893
+ "src": {
894
+ "mypkg": {
895
+ "mod1.py": FLAT_LAYOUT["mypkg"]["mod1.py"],
896
+ "subpackage": FLAT_LAYOUT["mypkg"]["subpackage"],
897
+ },
898
+ },
899
+ },
900
+ }
901
+
902
+ @pytest.mark.xfail(sys.platform == "darwin", reason="pypa/setuptools#4328")
903
+ @pytest.mark.parametrize("layout", EXAMPLES.keys())
904
+ def test_editable_install(self, tmp_path, venv, layout, editable_opts):
905
+ project, _ = install_project(
906
+ "mypkg", venv, tmp_path, self.EXAMPLES[layout], *editable_opts
907
+ )
908
+
909
+ # Ensure stray files are not importable
910
+ cmd_import_error = """\
911
+ try:
912
+ import otherfile
913
+ except ImportError as ex:
914
+ print(ex)
915
+ """
916
+ out = venv.run(["python", "-c", dedent(cmd_import_error)])
917
+ assert "No module named 'otherfile'" in out
918
+
919
+ # Ensure the modules are importable
920
+ cmd_get_vars = """\
921
+ import mypkg, mypkg.mod1, mypkg.subpackage.mod2
922
+ print(mypkg.mod1.var, mypkg.subpackage.mod2.var)
923
+ """
924
+ out = venv.run(["python", "-c", dedent(cmd_get_vars)])
925
+ assert "42 13" in out
926
+
927
+ # Ensure resources are reachable
928
+ cmd_get_resource = """\
929
+ import mypkg.subpackage
930
+ from setuptools._importlib import resources as importlib_resources
931
+ text = importlib_resources.files(mypkg.subpackage) / "resource_file.txt"
932
+ print(text.read_text(encoding="utf-8"))
933
+ """
934
+ out = venv.run(["python", "-c", dedent(cmd_get_resource)])
935
+ assert "resource 39" in out
936
+
937
+ # Ensure files are editable
938
+ mod1 = next(project.glob("**/mod1.py"))
939
+ mod2 = next(project.glob("**/mod2.py"))
940
+ resource_file = next(project.glob("**/resource_file.txt"))
941
+
942
+ mod1.write_text("var = 17", encoding="utf-8")
943
+ mod2.write_text("var = 781", encoding="utf-8")
944
+ resource_file.write_text("resource 374", encoding="utf-8")
945
+
946
+ out = venv.run(["python", "-c", dedent(cmd_get_vars)])
947
+ assert "42 13" not in out
948
+ assert "17 781" in out
949
+
950
+ out = venv.run(["python", "-c", dedent(cmd_get_resource)])
951
+ assert "resource 39" not in out
952
+ assert "resource 374" in out
953
+
954
+
955
+ class TestLinkTree:
956
+ FILES = deepcopy(TestOverallBehaviour.EXAMPLES["src-layout"])
957
+ FILES["pyproject.toml"] += dedent(
958
+ """\
959
+ [tool.setuptools]
960
+ # Temporary workaround: both `include-package-data` and `package-data` configs
961
+ # can be removed after #3260 is fixed.
962
+ include-package-data = false
963
+ package-data = {"*" = ["*.txt"]}
964
+
965
+ [tool.setuptools.packages.find]
966
+ where = ["src"]
967
+ exclude = ["*.subpackage*"]
968
+ """
969
+ )
970
+ FILES["src"]["mypkg"]["resource.not_in_manifest"] = "abc"
971
+
972
+ def test_generated_tree(self, tmp_path):
973
+ jaraco.path.build(self.FILES, prefix=tmp_path)
974
+
975
+ with _Path(tmp_path):
976
+ name = "mypkg-3.14159"
977
+ dist = Distribution({"script_name": "%PEP 517%"})
978
+ dist.parse_config_files()
979
+
980
+ wheel = Mock()
981
+ aux = tmp_path / ".aux"
982
+ build = tmp_path / ".build"
983
+ aux.mkdir()
984
+ build.mkdir()
985
+
986
+ build_py = dist.get_command_obj("build_py")
987
+ build_py.editable_mode = True
988
+ build_py.build_lib = str(build)
989
+ build_py.ensure_finalized()
990
+ outputs = build_py.get_outputs()
991
+ output_mapping = build_py.get_output_mapping()
992
+
993
+ make_tree = _LinkTree(dist, name, aux, build)
994
+ make_tree(wheel, outputs, output_mapping)
995
+
996
+ mod1 = next(aux.glob("**/mod1.py"))
997
+ expected = tmp_path / "src/mypkg/mod1.py"
998
+ assert_link_to(mod1, expected)
999
+
1000
+ assert next(aux.glob("**/subpackage"), None) is None
1001
+ assert next(aux.glob("**/mod2.py"), None) is None
1002
+ assert next(aux.glob("**/resource_file.txt"), None) is None
1003
+
1004
+ assert next(aux.glob("**/resource.not_in_manifest"), None) is None
1005
+
1006
+ def test_strict_install(self, tmp_path, venv):
1007
+ opts = ["--config-settings", "editable-mode=strict"]
1008
+ install_project("mypkg", venv, tmp_path, self.FILES, *opts)
1009
+
1010
+ out = venv.run(["python", "-c", "import mypkg.mod1; print(mypkg.mod1.var)"])
1011
+ assert "42" in out
1012
+
1013
+ # Ensure packages excluded from distribution are not importable
1014
+ cmd_import_error = """\
1015
+ try:
1016
+ from mypkg import subpackage
1017
+ except ImportError as ex:
1018
+ print(ex)
1019
+ """
1020
+ out = venv.run(["python", "-c", dedent(cmd_import_error)])
1021
+ assert "cannot import name 'subpackage'" in out
1022
+
1023
+ # Ensure resource files excluded from distribution are not reachable
1024
+ cmd_get_resource = """\
1025
+ import mypkg
1026
+ from setuptools._importlib import resources as importlib_resources
1027
+ try:
1028
+ text = importlib_resources.files(mypkg) / "resource.not_in_manifest"
1029
+ print(text.read_text(encoding="utf-8"))
1030
+ except FileNotFoundError as ex:
1031
+ print(ex)
1032
+ """
1033
+ out = venv.run(["python", "-c", dedent(cmd_get_resource)])
1034
+ assert "No such file or directory" in out
1035
+ assert "resource.not_in_manifest" in out
1036
+
1037
+
1038
+ @pytest.mark.filterwarnings("ignore:.*compat.*:setuptools.SetuptoolsDeprecationWarning")
1039
+ def test_compat_install(tmp_path, venv):
1040
+ # TODO: Remove `compat` after Dec/2022.
1041
+ opts = ["--config-settings", "editable-mode=compat"]
1042
+ files = TestOverallBehaviour.EXAMPLES["custom-layout"]
1043
+ install_project("mypkg", venv, tmp_path, files, *opts)
1044
+
1045
+ out = venv.run(["python", "-c", "import mypkg.mod1; print(mypkg.mod1.var)"])
1046
+ assert "42" in out
1047
+
1048
+ expected_path = comparable_path(str(tmp_path))
1049
+
1050
+ # Compatible behaviour will make spurious modules and excluded
1051
+ # files importable directly from the original path
1052
+ for cmd in (
1053
+ "import otherfile; print(otherfile)",
1054
+ "import other; print(other)",
1055
+ "import mypkg; print(mypkg)",
1056
+ ):
1057
+ out = comparable_path(venv.run(["python", "-c", cmd]))
1058
+ assert expected_path in out
1059
+
1060
+ # Compatible behaviour will not consider custom mappings
1061
+ cmd = """\
1062
+ try:
1063
+ from mypkg import subpackage;
1064
+ except ImportError as ex:
1065
+ print(ex)
1066
+ """
1067
+ out = venv.run(["python", "-c", dedent(cmd)])
1068
+ assert "cannot import name 'subpackage'" in out
1069
+
1070
+
1071
+ def test_pbr_integration(tmp_path, venv, editable_opts):
1072
+ """Ensure editable installs work with pbr, issue #3500"""
1073
+ files = {
1074
+ "pyproject.toml": dedent(
1075
+ """\
1076
+ [build-system]
1077
+ requires = ["setuptools"]
1078
+ build-backend = "setuptools.build_meta"
1079
+ """
1080
+ ),
1081
+ "setup.py": dedent(
1082
+ """\
1083
+ __import__('setuptools').setup(
1084
+ pbr=True,
1085
+ setup_requires=["pbr"],
1086
+ )
1087
+ """
1088
+ ),
1089
+ "setup.cfg": dedent(
1090
+ """\
1091
+ [metadata]
1092
+ name = mypkg
1093
+
1094
+ [files]
1095
+ packages =
1096
+ mypkg
1097
+ """
1098
+ ),
1099
+ "mypkg": {
1100
+ "__init__.py": "",
1101
+ "hello.py": "print('Hello world!')",
1102
+ },
1103
+ "other": {"test.txt": "Another file in here."},
1104
+ }
1105
+ venv.run(["python", "-m", "pip", "install", "pbr"])
1106
+
1107
+ with contexts.environment(PBR_VERSION="0.42"):
1108
+ install_project("mypkg", venv, tmp_path, files, *editable_opts)
1109
+
1110
+ out = venv.run(["python", "-c", "import mypkg.hello"])
1111
+ assert "Hello world!" in out
1112
+
1113
+
1114
+ class TestCustomBuildPy:
1115
+ """
1116
+ Issue #3501 indicates that some plugins/customizations might rely on:
1117
+
1118
+ 1. ``build_py`` not running
1119
+ 2. ``build_py`` always copying files to ``build_lib``
1120
+
1121
+ During the transition period setuptools should prevent potential errors from
1122
+ happening due to those assumptions.
1123
+ """
1124
+
1125
+ # TODO: Remove tests after _run_build_steps is removed.
1126
+
1127
+ FILES = {
1128
+ **TestOverallBehaviour.EXAMPLES["flat-layout"],
1129
+ "setup.py": dedent(
1130
+ """\
1131
+ import pathlib
1132
+ from setuptools import setup
1133
+ from setuptools.command.build_py import build_py as orig
1134
+
1135
+ class my_build_py(orig):
1136
+ def run(self):
1137
+ super().run()
1138
+ raise ValueError("TEST_RAISE")
1139
+
1140
+ setup(cmdclass={"build_py": my_build_py})
1141
+ """
1142
+ ),
1143
+ }
1144
+
1145
+ def test_safeguarded_from_errors(self, tmp_path, venv):
1146
+ """Ensure that errors in custom build_py are reported as warnings"""
1147
+ # Warnings should show up
1148
+ _, out = install_project("mypkg", venv, tmp_path, self.FILES)
1149
+ assert "SetuptoolsDeprecationWarning" in out
1150
+ assert "ValueError: TEST_RAISE" in out
1151
+ # but installation should be successful
1152
+ out = venv.run(["python", "-c", "import mypkg.mod1; print(mypkg.mod1.var)"])
1153
+ assert "42" in out
1154
+
1155
+
1156
+ class TestCustomBuildWheel:
1157
+ def install_custom_build_wheel(self, dist):
1158
+ bdist_wheel_cls = dist.get_command_class("bdist_wheel")
1159
+
1160
+ class MyBdistWheel(bdist_wheel_cls):
1161
+ def get_tag(self):
1162
+ # In issue #3513, we can see that some extensions may try to access
1163
+ # the `plat_name` property in bdist_wheel
1164
+ if self.plat_name.startswith("macosx-"):
1165
+ _ = "macOS platform"
1166
+ return super().get_tag()
1167
+
1168
+ dist.cmdclass["bdist_wheel"] = MyBdistWheel
1169
+
1170
+ def test_access_plat_name(self, tmpdir_cwd):
1171
+ # Even when a custom bdist_wheel tries to access plat_name the build should
1172
+ # be successful
1173
+ jaraco.path.build({"module.py": "x = 42"})
1174
+ dist = Distribution()
1175
+ dist.script_name = "setup.py"
1176
+ dist.set_defaults()
1177
+ self.install_custom_build_wheel(dist)
1178
+ cmd = editable_wheel(dist)
1179
+ cmd.ensure_finalized()
1180
+ cmd.run()
1181
+ wheel_file = str(next(Path().glob('dist/*.whl')))
1182
+ assert "editable" in wheel_file
1183
+
1184
+
1185
+ class TestCustomBuildExt:
1186
+ def install_custom_build_ext_distutils(self, dist):
1187
+ from distutils.command.build_ext import build_ext as build_ext_cls
1188
+
1189
+ class MyBuildExt(build_ext_cls):
1190
+ pass
1191
+
1192
+ dist.cmdclass["build_ext"] = MyBuildExt
1193
+
1194
+ @pytest.mark.skipif(
1195
+ sys.platform != "linux", reason="compilers may fail without correct setup"
1196
+ )
1197
+ def test_distutils_leave_inplace_files(self, tmpdir_cwd):
1198
+ jaraco.path.build({"module.c": ""})
1199
+ attrs = {
1200
+ "ext_modules": [Extension("module", ["module.c"])],
1201
+ }
1202
+ dist = Distribution(attrs)
1203
+ dist.script_name = "setup.py"
1204
+ dist.set_defaults()
1205
+ self.install_custom_build_ext_distutils(dist)
1206
+ cmd = editable_wheel(dist)
1207
+ cmd.ensure_finalized()
1208
+ cmd.run()
1209
+ wheel_file = str(next(Path().glob('dist/*.whl')))
1210
+ assert "editable" in wheel_file
1211
+ files = [p for p in Path().glob("module.*") if p.suffix != ".c"]
1212
+ assert len(files) == 1
1213
+ name = files[0].name
1214
+ assert any(name.endswith(ext) for ext in EXTENSION_SUFFIXES)
1215
+
1216
+
1217
+ def test_debugging_tips(tmpdir_cwd, monkeypatch):
1218
+ """Make sure to display useful debugging tips to the user."""
1219
+ jaraco.path.build({"module.py": "x = 42"})
1220
+ dist = Distribution()
1221
+ dist.script_name = "setup.py"
1222
+ dist.set_defaults()
1223
+ cmd = editable_wheel(dist)
1224
+ cmd.ensure_finalized()
1225
+
1226
+ SimulatedErr = type("SimulatedErr", (Exception,), {})
1227
+ simulated_failure = Mock(side_effect=SimulatedErr())
1228
+ monkeypatch.setattr(cmd, "get_finalized_command", simulated_failure)
1229
+
1230
+ expected_msg = "following steps are recommended to help debug"
1231
+ with pytest.raises(SimulatedErr), pytest.warns(_DebuggingTips, match=expected_msg):
1232
+ cmd.run()
1233
+
1234
+
1235
+ @pytest.mark.filterwarnings("error")
1236
+ def test_encode_pth():
1237
+ """Ensure _encode_pth function does not produce encoding warnings"""
1238
+ content = _encode_pth("tkmilan_ç_utf8") # no warnings (would be turned into errors)
1239
+ assert isinstance(content, bytes)
1240
+
1241
+
1242
+ def install_project(name, venv, tmp_path, files, *opts):
1243
+ project = tmp_path / name
1244
+ project.mkdir()
1245
+ jaraco.path.build(files, prefix=project)
1246
+ opts = [*opts, "--no-build-isolation"] # force current version of setuptools
1247
+ out = venv.run(
1248
+ ["python", "-m", "pip", "-v", "install", "-e", str(project), *opts],
1249
+ stderr=subprocess.STDOUT,
1250
+ )
1251
+ return project, out
1252
+
1253
+
1254
+ def _addsitedirs(new_dirs):
1255
+ """To use this function, it is necessary to insert new_dir in front of sys.path.
1256
+ The Python process will try to import a ``sitecustomize`` module on startup.
1257
+ If we manipulate sys.path/PYTHONPATH, we can force it to run our code,
1258
+ which invokes ``addsitedir`` and ensure ``.pth`` files are loaded.
1259
+ """
1260
+ content = '\n'.join(
1261
+ ("import site",)
1262
+ + tuple(f"site.addsitedir({os.fspath(new_dir)!r})" for new_dir in new_dirs)
1263
+ )
1264
+ (new_dirs[0] / "sitecustomize.py").write_text(content, encoding="utf-8")
1265
+
1266
+
1267
+ # ---- Assertion Helpers ----
1268
+
1269
+
1270
+ def assert_path(pkg, expected):
1271
+ # __path__ is not guaranteed to exist, so we have to account for that
1272
+ if pkg.__path__:
1273
+ path = next(iter(pkg.__path__), None)
1274
+ if path:
1275
+ assert str(Path(path).resolve()) == expected
1276
+
1277
+
1278
+ def assert_link_to(file: Path, other: Path) -> None:
1279
+ if file.is_symlink():
1280
+ assert str(file.resolve()) == str(other.resolve())
1281
+ else:
1282
+ file_stat = file.stat()
1283
+ other_stat = other.stat()
1284
+ assert file_stat[stat.ST_INO] == other_stat[stat.ST_INO]
1285
+ assert file_stat[stat.ST_DEV] == other_stat[stat.ST_DEV]
1286
+
1287
+
1288
+ def comparable_path(str_with_path: str) -> str:
1289
+ return str_with_path.lower().replace(os.sep, "/").replace("//", "/")
.venv/lib/python3.12/site-packages/setuptools/tests/test_egg_info.py ADDED
@@ -0,0 +1,1305 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import ast
4
+ import glob
5
+ import os
6
+ import re
7
+ import stat
8
+ import sys
9
+ import time
10
+ from pathlib import Path
11
+ from unittest import mock
12
+
13
+ import pytest
14
+ from jaraco import path
15
+
16
+ from setuptools import errors
17
+ from setuptools.command.egg_info import egg_info, manifest_maker, write_entries
18
+ from setuptools.dist import Distribution
19
+
20
+ from . import contexts, environment
21
+ from .textwrap import DALS
22
+
23
+
24
+ class Environment(str):
25
+ pass
26
+
27
+
28
+ @pytest.fixture
29
+ def env():
30
+ with contexts.tempdir(prefix='setuptools-test.') as env_dir:
31
+ env = Environment(env_dir)
32
+ os.chmod(env_dir, stat.S_IRWXU)
33
+ subs = 'home', 'lib', 'scripts', 'data', 'egg-base'
34
+ env.paths = dict((dirname, os.path.join(env_dir, dirname)) for dirname in subs)
35
+ list(map(os.mkdir, env.paths.values()))
36
+ path.build({
37
+ env.paths['home']: {
38
+ '.pydistutils.cfg': DALS(
39
+ """
40
+ [egg_info]
41
+ egg-base = {egg-base}
42
+ """.format(**env.paths)
43
+ )
44
+ }
45
+ })
46
+ yield env
47
+
48
+
49
+ class TestEggInfo:
50
+ setup_script = DALS(
51
+ """
52
+ from setuptools import setup
53
+
54
+ setup(
55
+ name='foo',
56
+ py_modules=['hello'],
57
+ entry_points={'console_scripts': ['hi = hello.run']},
58
+ zip_safe=False,
59
+ )
60
+ """
61
+ )
62
+
63
+ def _create_project(self):
64
+ path.build({
65
+ 'setup.py': self.setup_script,
66
+ 'hello.py': DALS(
67
+ """
68
+ def run():
69
+ print('hello')
70
+ """
71
+ ),
72
+ })
73
+
74
+ @staticmethod
75
+ def _extract_mv_version(pkg_info_lines: list[str]) -> tuple[int, int]:
76
+ version_str = pkg_info_lines[0].split(' ')[1]
77
+ major, minor = map(int, version_str.split('.')[:2])
78
+ return major, minor
79
+
80
+ def test_egg_info_save_version_info_setup_empty(self, tmpdir_cwd, env):
81
+ """
82
+ When the egg_info section is empty or not present, running
83
+ save_version_info should add the settings to the setup.cfg
84
+ in a deterministic order.
85
+ """
86
+ setup_cfg = os.path.join(env.paths['home'], 'setup.cfg')
87
+ dist = Distribution()
88
+ ei = egg_info(dist)
89
+ ei.initialize_options()
90
+ ei.save_version_info(setup_cfg)
91
+
92
+ with open(setup_cfg, 'r', encoding="utf-8") as f:
93
+ content = f.read()
94
+
95
+ assert '[egg_info]' in content
96
+ assert 'tag_build =' in content
97
+ assert 'tag_date = 0' in content
98
+
99
+ expected_order = (
100
+ 'tag_build',
101
+ 'tag_date',
102
+ )
103
+
104
+ self._validate_content_order(content, expected_order)
105
+
106
+ @staticmethod
107
+ def _validate_content_order(content, expected):
108
+ """
109
+ Assert that the strings in expected appear in content
110
+ in order.
111
+ """
112
+ pattern = '.*'.join(expected)
113
+ flags = re.MULTILINE | re.DOTALL
114
+ assert re.search(pattern, content, flags)
115
+
116
+ def test_egg_info_save_version_info_setup_defaults(self, tmpdir_cwd, env):
117
+ """
118
+ When running save_version_info on an existing setup.cfg
119
+ with the 'default' values present from a previous run,
120
+ the file should remain unchanged.
121
+ """
122
+ setup_cfg = os.path.join(env.paths['home'], 'setup.cfg')
123
+ path.build({
124
+ setup_cfg: DALS(
125
+ """
126
+ [egg_info]
127
+ tag_build =
128
+ tag_date = 0
129
+ """
130
+ ),
131
+ })
132
+ dist = Distribution()
133
+ ei = egg_info(dist)
134
+ ei.initialize_options()
135
+ ei.save_version_info(setup_cfg)
136
+
137
+ with open(setup_cfg, 'r', encoding="utf-8") as f:
138
+ content = f.read()
139
+
140
+ assert '[egg_info]' in content
141
+ assert 'tag_build =' in content
142
+ assert 'tag_date = 0' in content
143
+
144
+ expected_order = (
145
+ 'tag_build',
146
+ 'tag_date',
147
+ )
148
+
149
+ self._validate_content_order(content, expected_order)
150
+
151
+ def test_expected_files_produced(self, tmpdir_cwd, env):
152
+ self._create_project()
153
+
154
+ self._run_egg_info_command(tmpdir_cwd, env)
155
+ actual = os.listdir('foo.egg-info')
156
+
157
+ expected = [
158
+ 'PKG-INFO',
159
+ 'SOURCES.txt',
160
+ 'dependency_links.txt',
161
+ 'entry_points.txt',
162
+ 'not-zip-safe',
163
+ 'top_level.txt',
164
+ ]
165
+ assert sorted(actual) == expected
166
+
167
+ def test_handling_utime_error(self, tmpdir_cwd, env):
168
+ dist = Distribution()
169
+ ei = egg_info(dist)
170
+ utime_patch = mock.patch('os.utime', side_effect=OSError("TEST"))
171
+ mkpath_patch = mock.patch(
172
+ 'setuptools.command.egg_info.egg_info.mkpath', return_val=None
173
+ )
174
+
175
+ with utime_patch, mkpath_patch:
176
+ import distutils.errors
177
+
178
+ msg = r"Cannot update time stamp of directory 'None'"
179
+ with pytest.raises(distutils.errors.DistutilsFileError, match=msg):
180
+ ei.run()
181
+
182
+ def test_license_is_a_string(self, tmpdir_cwd, env):
183
+ setup_config = DALS(
184
+ """
185
+ [metadata]
186
+ name=foo
187
+ version=0.0.1
188
+ license=file:MIT
189
+ """
190
+ )
191
+
192
+ setup_script = DALS(
193
+ """
194
+ from setuptools import setup
195
+
196
+ setup()
197
+ """
198
+ )
199
+
200
+ path.build({
201
+ 'setup.py': setup_script,
202
+ 'setup.cfg': setup_config,
203
+ })
204
+
205
+ # This command should fail with a ValueError, but because it's
206
+ # currently configured to use a subprocess, the actual traceback
207
+ # object is lost and we need to parse it from stderr
208
+ with pytest.raises(AssertionError) as exc:
209
+ self._run_egg_info_command(tmpdir_cwd, env)
210
+
211
+ # The only argument to the assertion error should be a traceback
212
+ # containing a ValueError
213
+ assert 'ValueError' in exc.value.args[0]
214
+
215
+ def test_rebuilt(self, tmpdir_cwd, env):
216
+ """Ensure timestamps are updated when the command is re-run."""
217
+ self._create_project()
218
+
219
+ self._run_egg_info_command(tmpdir_cwd, env)
220
+ timestamp_a = os.path.getmtime('foo.egg-info')
221
+
222
+ # arbitrary sleep just to handle *really* fast systems
223
+ time.sleep(0.001)
224
+
225
+ self._run_egg_info_command(tmpdir_cwd, env)
226
+ timestamp_b = os.path.getmtime('foo.egg-info')
227
+
228
+ assert timestamp_a != timestamp_b
229
+
230
+ def test_manifest_template_is_read(self, tmpdir_cwd, env):
231
+ self._create_project()
232
+ path.build({
233
+ 'MANIFEST.in': DALS(
234
+ """
235
+ recursive-include docs *.rst
236
+ """
237
+ ),
238
+ 'docs': {
239
+ 'usage.rst': "Run 'hi'",
240
+ },
241
+ })
242
+ self._run_egg_info_command(tmpdir_cwd, env)
243
+ egg_info_dir = os.path.join('.', 'foo.egg-info')
244
+ sources_txt = os.path.join(egg_info_dir, 'SOURCES.txt')
245
+ with open(sources_txt, encoding="utf-8") as f:
246
+ assert 'docs/usage.rst' in f.read().split('\n')
247
+
248
+ def _setup_script_with_requires(self, requires, use_setup_cfg=False):
249
+ setup_script = DALS(
250
+ """
251
+ from setuptools import setup
252
+
253
+ setup(name='foo', zip_safe=False, %s)
254
+ """
255
+ ) % ('' if use_setup_cfg else requires)
256
+ setup_config = requires if use_setup_cfg else ''
257
+ path.build({
258
+ 'setup.py': setup_script,
259
+ 'setup.cfg': setup_config,
260
+ })
261
+
262
+ mismatch_marker = f"python_version<'{sys.version_info[0]}'"
263
+ # Alternate equivalent syntax.
264
+ mismatch_marker_alternate = f'python_version < "{sys.version_info[0]}"'
265
+ invalid_marker = "<=>++"
266
+
267
+ class RequiresTestHelper:
268
+ @staticmethod
269
+ def parametrize(*test_list, **format_dict):
270
+ idlist = []
271
+ argvalues = []
272
+ for test in test_list:
273
+ test_params = test.lstrip().split('\n\n', 3)
274
+ name_kwargs = test_params.pop(0).split('\n')
275
+ if len(name_kwargs) > 1:
276
+ val = name_kwargs[1].strip()
277
+ install_cmd_kwargs = ast.literal_eval(val)
278
+ else:
279
+ install_cmd_kwargs = {}
280
+ name = name_kwargs[0].strip()
281
+ setup_py_requires, setup_cfg_requires, expected_requires = [
282
+ DALS(a).format(**format_dict) for a in test_params
283
+ ]
284
+ for id_, requires, use_cfg in (
285
+ (name, setup_py_requires, False),
286
+ (name + '_in_setup_cfg', setup_cfg_requires, True),
287
+ ):
288
+ idlist.append(id_)
289
+ marks = ()
290
+ if requires.startswith('@xfail\n'):
291
+ requires = requires[7:]
292
+ marks = pytest.mark.xfail
293
+ argvalues.append(
294
+ pytest.param(
295
+ requires,
296
+ use_cfg,
297
+ expected_requires,
298
+ install_cmd_kwargs,
299
+ marks=marks,
300
+ )
301
+ )
302
+ return pytest.mark.parametrize(
303
+ (
304
+ "requires",
305
+ "use_setup_cfg",
306
+ "expected_requires",
307
+ "install_cmd_kwargs",
308
+ ),
309
+ argvalues,
310
+ ids=idlist,
311
+ )
312
+
313
+ @RequiresTestHelper.parametrize(
314
+ # Format of a test:
315
+ #
316
+ # id
317
+ # install_cmd_kwargs [optional]
318
+ #
319
+ # requires block (when used in setup.py)
320
+ #
321
+ # requires block (when used in setup.cfg)
322
+ #
323
+ # expected contents of requires.txt
324
+ """
325
+ install_requires_deterministic
326
+
327
+ install_requires=["wheel>=0.5", "pytest"]
328
+
329
+ [options]
330
+ install_requires =
331
+ wheel>=0.5
332
+ pytest
333
+
334
+ wheel>=0.5
335
+ pytest
336
+ """,
337
+ """
338
+ install_requires_ordered
339
+
340
+ install_requires=["pytest>=3.0.2,!=10.9999"]
341
+
342
+ [options]
343
+ install_requires =
344
+ pytest>=3.0.2,!=10.9999
345
+
346
+ pytest!=10.9999,>=3.0.2
347
+ """,
348
+ """
349
+ install_requires_with_marker
350
+
351
+ install_requires=["barbazquux;{mismatch_marker}"],
352
+
353
+ [options]
354
+ install_requires =
355
+ barbazquux; {mismatch_marker}
356
+
357
+ [:{mismatch_marker_alternate}]
358
+ barbazquux
359
+ """,
360
+ """
361
+ install_requires_with_extra
362
+ {'cmd': ['egg_info']}
363
+
364
+ install_requires=["barbazquux [test]"],
365
+
366
+ [options]
367
+ install_requires =
368
+ barbazquux [test]
369
+
370
+ barbazquux[test]
371
+ """,
372
+ """
373
+ install_requires_with_extra_and_marker
374
+
375
+ install_requires=["barbazquux [test]; {mismatch_marker}"],
376
+
377
+ [options]
378
+ install_requires =
379
+ barbazquux [test]; {mismatch_marker}
380
+
381
+ [:{mismatch_marker_alternate}]
382
+ barbazquux[test]
383
+ """,
384
+ """
385
+ setup_requires_with_markers
386
+
387
+ setup_requires=["barbazquux;{mismatch_marker}"],
388
+
389
+ [options]
390
+ setup_requires =
391
+ barbazquux; {mismatch_marker}
392
+
393
+ """,
394
+ """
395
+ extras_require_with_extra
396
+ {'cmd': ['egg_info']}
397
+
398
+ extras_require={{"extra": ["barbazquux [test]"]}},
399
+
400
+ [options.extras_require]
401
+ extra = barbazquux [test]
402
+
403
+ [extra]
404
+ barbazquux[test]
405
+ """,
406
+ """
407
+ extras_require_with_extra_and_marker_in_req
408
+
409
+ extras_require={{"extra": ["barbazquux [test]; {mismatch_marker}"]}},
410
+
411
+ [options.extras_require]
412
+ extra =
413
+ barbazquux [test]; {mismatch_marker}
414
+
415
+ [extra]
416
+
417
+ [extra:{mismatch_marker_alternate}]
418
+ barbazquux[test]
419
+ """,
420
+ # FIXME: ConfigParser does not allow : in key names!
421
+ """
422
+ extras_require_with_marker
423
+
424
+ extras_require={{":{mismatch_marker}": ["barbazquux"]}},
425
+
426
+ @xfail
427
+ [options.extras_require]
428
+ :{mismatch_marker} = barbazquux
429
+
430
+ [:{mismatch_marker}]
431
+ barbazquux
432
+ """,
433
+ """
434
+ extras_require_with_marker_in_req
435
+
436
+ extras_require={{"extra": ["barbazquux; {mismatch_marker}"]}},
437
+
438
+ [options.extras_require]
439
+ extra =
440
+ barbazquux; {mismatch_marker}
441
+
442
+ [extra]
443
+
444
+ [extra:{mismatch_marker_alternate}]
445
+ barbazquux
446
+ """,
447
+ """
448
+ extras_require_with_empty_section
449
+
450
+ extras_require={{"empty": []}},
451
+
452
+ [options.extras_require]
453
+ empty =
454
+
455
+ [empty]
456
+ """,
457
+ # Format arguments.
458
+ invalid_marker=invalid_marker,
459
+ mismatch_marker=mismatch_marker,
460
+ mismatch_marker_alternate=mismatch_marker_alternate,
461
+ )
462
+ def test_requires(
463
+ self,
464
+ tmpdir_cwd,
465
+ env,
466
+ requires,
467
+ use_setup_cfg,
468
+ expected_requires,
469
+ install_cmd_kwargs,
470
+ ):
471
+ self._setup_script_with_requires(requires, use_setup_cfg)
472
+ self._run_egg_info_command(tmpdir_cwd, env, **install_cmd_kwargs)
473
+ egg_info_dir = os.path.join('.', 'foo.egg-info')
474
+ requires_txt = os.path.join(egg_info_dir, 'requires.txt')
475
+ if os.path.exists(requires_txt):
476
+ with open(requires_txt, encoding="utf-8") as fp:
477
+ install_requires = fp.read()
478
+ else:
479
+ install_requires = ''
480
+ assert install_requires.lstrip() == expected_requires
481
+ assert glob.glob(os.path.join(env.paths['lib'], 'barbazquux*')) == []
482
+
483
+ def test_install_requires_unordered_disallowed(self, tmpdir_cwd, env):
484
+ """
485
+ Packages that pass unordered install_requires sequences
486
+ should be rejected as they produce non-deterministic
487
+ builds. See #458.
488
+ """
489
+ req = 'install_requires={"fake-factory==0.5.2", "pytz"}'
490
+ self._setup_script_with_requires(req)
491
+ with pytest.raises(AssertionError):
492
+ self._run_egg_info_command(tmpdir_cwd, env)
493
+
494
+ def test_extras_require_with_invalid_marker(self, tmpdir_cwd, env):
495
+ tmpl = 'extras_require={{":{marker}": ["barbazquux"]}},'
496
+ req = tmpl.format(marker=self.invalid_marker)
497
+ self._setup_script_with_requires(req)
498
+ with pytest.raises(AssertionError):
499
+ self._run_egg_info_command(tmpdir_cwd, env)
500
+ assert glob.glob(os.path.join(env.paths['lib'], 'barbazquux*')) == []
501
+
502
+ def test_extras_require_with_invalid_marker_in_req(self, tmpdir_cwd, env):
503
+ tmpl = 'extras_require={{"extra": ["barbazquux; {marker}"]}},'
504
+ req = tmpl.format(marker=self.invalid_marker)
505
+ self._setup_script_with_requires(req)
506
+ with pytest.raises(AssertionError):
507
+ self._run_egg_info_command(tmpdir_cwd, env)
508
+ assert glob.glob(os.path.join(env.paths['lib'], 'barbazquux*')) == []
509
+
510
+ def test_provides_extra(self, tmpdir_cwd, env):
511
+ self._setup_script_with_requires('extras_require={"foobar": ["barbazquux"]},')
512
+ environ = os.environ.copy().update(
513
+ HOME=env.paths['home'],
514
+ )
515
+ environment.run_setup_py(
516
+ cmd=['egg_info'],
517
+ pypath=os.pathsep.join([env.paths['lib'], str(tmpdir_cwd)]),
518
+ data_stream=1,
519
+ env=environ,
520
+ )
521
+ egg_info_dir = os.path.join('.', 'foo.egg-info')
522
+ with open(os.path.join(egg_info_dir, 'PKG-INFO'), encoding="utf-8") as fp:
523
+ pkg_info_lines = fp.read().split('\n')
524
+ assert 'Provides-Extra: foobar' in pkg_info_lines
525
+ assert 'Metadata-Version: 2.4' in pkg_info_lines
526
+
527
+ def test_doesnt_provides_extra(self, tmpdir_cwd, env):
528
+ self._setup_script_with_requires(
529
+ """install_requires=["spam ; python_version<'3.6'"]"""
530
+ )
531
+ environ = os.environ.copy().update(
532
+ HOME=env.paths['home'],
533
+ )
534
+ environment.run_setup_py(
535
+ cmd=['egg_info'],
536
+ pypath=os.pathsep.join([env.paths['lib'], str(tmpdir_cwd)]),
537
+ data_stream=1,
538
+ env=environ,
539
+ )
540
+ egg_info_dir = os.path.join('.', 'foo.egg-info')
541
+ with open(os.path.join(egg_info_dir, 'PKG-INFO'), encoding="utf-8") as fp:
542
+ pkg_info_text = fp.read()
543
+ assert 'Provides-Extra:' not in pkg_info_text
544
+
545
+ @pytest.mark.parametrize(
546
+ ('files', 'license_in_sources'),
547
+ [
548
+ (
549
+ {
550
+ 'setup.cfg': DALS(
551
+ """
552
+ [metadata]
553
+ license_file = LICENSE
554
+ """
555
+ ),
556
+ 'LICENSE': "Test license",
557
+ },
558
+ True,
559
+ ), # with license
560
+ (
561
+ {
562
+ 'setup.cfg': DALS(
563
+ """
564
+ [metadata]
565
+ license_file = INVALID_LICENSE
566
+ """
567
+ ),
568
+ 'LICENSE': "Test license",
569
+ },
570
+ False,
571
+ ), # with an invalid license
572
+ (
573
+ {
574
+ 'setup.cfg': DALS(
575
+ """
576
+ """
577
+ ),
578
+ 'LICENSE': "Test license",
579
+ },
580
+ True,
581
+ ), # no license_file attribute, LICENSE auto-included
582
+ (
583
+ {
584
+ 'setup.cfg': DALS(
585
+ """
586
+ [metadata]
587
+ license_file = LICENSE
588
+ """
589
+ ),
590
+ 'MANIFEST.in': "exclude LICENSE",
591
+ 'LICENSE': "Test license",
592
+ },
593
+ True,
594
+ ), # manifest is overwritten by license_file
595
+ pytest.param(
596
+ {
597
+ 'setup.cfg': DALS(
598
+ """
599
+ [metadata]
600
+ license_file = LICEN[CS]E*
601
+ """
602
+ ),
603
+ 'LICENSE': "Test license",
604
+ },
605
+ True,
606
+ id="glob_pattern",
607
+ ),
608
+ ],
609
+ )
610
+ def test_setup_cfg_license_file(self, tmpdir_cwd, env, files, license_in_sources):
611
+ self._create_project()
612
+ path.build(files)
613
+
614
+ environment.run_setup_py(
615
+ cmd=['egg_info'],
616
+ pypath=os.pathsep.join([env.paths['lib'], str(tmpdir_cwd)]),
617
+ )
618
+ egg_info_dir = os.path.join('.', 'foo.egg-info')
619
+
620
+ sources_text = Path(egg_info_dir, "SOURCES.txt").read_text(encoding="utf-8")
621
+
622
+ if license_in_sources:
623
+ assert 'LICENSE' in sources_text
624
+ else:
625
+ assert 'LICENSE' not in sources_text
626
+ # for invalid license test
627
+ assert 'INVALID_LICENSE' not in sources_text
628
+
629
+ @pytest.mark.parametrize(
630
+ ('files', 'incl_licenses', 'excl_licenses'),
631
+ [
632
+ (
633
+ {
634
+ 'setup.cfg': DALS(
635
+ """
636
+ [metadata]
637
+ license_files =
638
+ LICENSE-ABC
639
+ LICENSE-XYZ
640
+ """
641
+ ),
642
+ 'LICENSE-ABC': "ABC license",
643
+ 'LICENSE-XYZ': "XYZ license",
644
+ },
645
+ ['LICENSE-ABC', 'LICENSE-XYZ'],
646
+ [],
647
+ ), # with licenses
648
+ (
649
+ {
650
+ 'setup.cfg': DALS(
651
+ """
652
+ [metadata]
653
+ license_files = LICENSE-ABC, LICENSE-XYZ
654
+ """
655
+ ),
656
+ 'LICENSE-ABC': "ABC license",
657
+ 'LICENSE-XYZ': "XYZ license",
658
+ },
659
+ ['LICENSE-ABC', 'LICENSE-XYZ'],
660
+ [],
661
+ ), # with commas
662
+ (
663
+ {
664
+ 'setup.cfg': DALS(
665
+ """
666
+ [metadata]
667
+ license_files =
668
+ LICENSE-ABC
669
+ """
670
+ ),
671
+ 'LICENSE-ABC': "ABC license",
672
+ 'LICENSE-XYZ': "XYZ license",
673
+ },
674
+ ['LICENSE-ABC'],
675
+ ['LICENSE-XYZ'],
676
+ ), # with one license
677
+ (
678
+ {
679
+ 'setup.cfg': DALS(
680
+ """
681
+ [metadata]
682
+ license_files =
683
+ """
684
+ ),
685
+ 'LICENSE-ABC': "ABC license",
686
+ 'LICENSE-XYZ': "XYZ license",
687
+ },
688
+ [],
689
+ ['LICENSE-ABC', 'LICENSE-XYZ'],
690
+ ), # empty
691
+ (
692
+ {
693
+ 'setup.cfg': DALS(
694
+ """
695
+ [metadata]
696
+ license_files = LICENSE-XYZ
697
+ """
698
+ ),
699
+ 'LICENSE-ABC': "ABC license",
700
+ 'LICENSE-XYZ': "XYZ license",
701
+ },
702
+ ['LICENSE-XYZ'],
703
+ ['LICENSE-ABC'],
704
+ ), # on same line
705
+ (
706
+ {
707
+ 'setup.cfg': DALS(
708
+ """
709
+ [metadata]
710
+ license_files =
711
+ LICENSE-ABC
712
+ INVALID_LICENSE
713
+ """
714
+ ),
715
+ 'LICENSE-ABC': "Test license",
716
+ },
717
+ ['LICENSE-ABC'],
718
+ ['INVALID_LICENSE'],
719
+ ), # with an invalid license
720
+ (
721
+ {
722
+ 'setup.cfg': DALS(
723
+ """
724
+ """
725
+ ),
726
+ 'LICENSE': "Test license",
727
+ },
728
+ ['LICENSE'],
729
+ [],
730
+ ), # no license_files attribute, LICENSE auto-included
731
+ (
732
+ {
733
+ 'setup.cfg': DALS(
734
+ """
735
+ [metadata]
736
+ license_files = LICENSE
737
+ """
738
+ ),
739
+ 'MANIFEST.in': "exclude LICENSE",
740
+ 'LICENSE': "Test license",
741
+ },
742
+ ['LICENSE'],
743
+ [],
744
+ ), # manifest is overwritten by license_files
745
+ (
746
+ {
747
+ 'setup.cfg': DALS(
748
+ """
749
+ [metadata]
750
+ license_files =
751
+ LICENSE-ABC
752
+ LICENSE-XYZ
753
+ """
754
+ ),
755
+ 'MANIFEST.in': "exclude LICENSE-XYZ",
756
+ 'LICENSE-ABC': "ABC license",
757
+ 'LICENSE-XYZ': "XYZ license",
758
+ # manifest is overwritten by license_files
759
+ },
760
+ ['LICENSE-ABC', 'LICENSE-XYZ'],
761
+ [],
762
+ ),
763
+ pytest.param(
764
+ {
765
+ 'setup.cfg': "",
766
+ 'LICENSE-ABC': "ABC license",
767
+ 'COPYING-ABC': "ABC copying",
768
+ 'NOTICE-ABC': "ABC notice",
769
+ 'AUTHORS-ABC': "ABC authors",
770
+ 'LICENCE-XYZ': "XYZ license",
771
+ 'LICENSE': "License",
772
+ 'INVALID-LICENSE': "Invalid license",
773
+ },
774
+ [
775
+ 'LICENSE-ABC',
776
+ 'COPYING-ABC',
777
+ 'NOTICE-ABC',
778
+ 'AUTHORS-ABC',
779
+ 'LICENCE-XYZ',
780
+ 'LICENSE',
781
+ ],
782
+ ['INVALID-LICENSE'],
783
+ # ('LICEN[CS]E*', 'COPYING*', 'NOTICE*', 'AUTHORS*')
784
+ id="default_glob_patterns",
785
+ ),
786
+ pytest.param(
787
+ {
788
+ 'setup.cfg': DALS(
789
+ """
790
+ [metadata]
791
+ license_files =
792
+ LICENSE*
793
+ """
794
+ ),
795
+ 'LICENSE-ABC': "ABC license",
796
+ 'NOTICE-XYZ': "XYZ notice",
797
+ },
798
+ ['LICENSE-ABC'],
799
+ ['NOTICE-XYZ'],
800
+ id="no_default_glob_patterns",
801
+ ),
802
+ pytest.param(
803
+ {
804
+ 'setup.cfg': DALS(
805
+ """
806
+ [metadata]
807
+ license_files =
808
+ LICENSE-ABC
809
+ LICENSE*
810
+ """
811
+ ),
812
+ 'LICENSE-ABC': "ABC license",
813
+ },
814
+ ['LICENSE-ABC'],
815
+ [],
816
+ id="files_only_added_once",
817
+ ),
818
+ pytest.param(
819
+ {
820
+ 'setup.cfg': DALS(
821
+ """
822
+ [metadata]
823
+ license_files = **/LICENSE
824
+ """
825
+ ),
826
+ 'LICENSE': "ABC license",
827
+ 'LICENSE-OTHER': "Don't include",
828
+ 'vendor': {'LICENSE': "Vendor license"},
829
+ },
830
+ ['LICENSE', 'vendor/LICENSE'],
831
+ ['LICENSE-OTHER'],
832
+ id="recursive_glob",
833
+ ),
834
+ ],
835
+ )
836
+ def test_setup_cfg_license_files(
837
+ self, tmpdir_cwd, env, files, incl_licenses, excl_licenses
838
+ ):
839
+ self._create_project()
840
+ path.build(files)
841
+
842
+ environment.run_setup_py(
843
+ cmd=['egg_info'],
844
+ pypath=os.pathsep.join([env.paths['lib'], str(tmpdir_cwd)]),
845
+ )
846
+ egg_info_dir = os.path.join('.', 'foo.egg-info')
847
+
848
+ sources_text = Path(egg_info_dir, "SOURCES.txt").read_text(encoding="utf-8")
849
+ sources_lines = [line.strip() for line in sources_text.splitlines()]
850
+
851
+ for lf in incl_licenses:
852
+ assert sources_lines.count(lf) == 1
853
+
854
+ for lf in excl_licenses:
855
+ assert sources_lines.count(lf) == 0
856
+
857
+ @pytest.mark.parametrize(
858
+ ('files', 'incl_licenses', 'excl_licenses'),
859
+ [
860
+ (
861
+ {
862
+ 'setup.cfg': DALS(
863
+ """
864
+ [metadata]
865
+ license_file =
866
+ license_files =
867
+ """
868
+ ),
869
+ 'LICENSE-ABC': "ABC license",
870
+ 'LICENSE-XYZ': "XYZ license",
871
+ },
872
+ [],
873
+ ['LICENSE-ABC', 'LICENSE-XYZ'],
874
+ ), # both empty
875
+ (
876
+ {
877
+ 'setup.cfg': DALS(
878
+ """
879
+ [metadata]
880
+ license_file =
881
+ LICENSE-ABC
882
+ LICENSE-XYZ
883
+ """
884
+ ),
885
+ 'LICENSE-ABC': "ABC license",
886
+ 'LICENSE-XYZ': "XYZ license",
887
+ # license_file is still singular
888
+ },
889
+ [],
890
+ ['LICENSE-ABC', 'LICENSE-XYZ'],
891
+ ),
892
+ (
893
+ {
894
+ 'setup.cfg': DALS(
895
+ """
896
+ [metadata]
897
+ license_file = LICENSE-ABC
898
+ license_files =
899
+ LICENSE-XYZ
900
+ LICENSE-PQR
901
+ """
902
+ ),
903
+ 'LICENSE-ABC': "ABC license",
904
+ 'LICENSE-PQR': "PQR license",
905
+ 'LICENSE-XYZ': "XYZ license",
906
+ },
907
+ ['LICENSE-ABC', 'LICENSE-PQR', 'LICENSE-XYZ'],
908
+ [],
909
+ ), # combined
910
+ (
911
+ {
912
+ 'setup.cfg': DALS(
913
+ """
914
+ [metadata]
915
+ license_file = LICENSE-ABC
916
+ license_files =
917
+ LICENSE-ABC
918
+ LICENSE-XYZ
919
+ LICENSE-PQR
920
+ """
921
+ ),
922
+ 'LICENSE-ABC': "ABC license",
923
+ 'LICENSE-PQR': "PQR license",
924
+ 'LICENSE-XYZ': "XYZ license",
925
+ # duplicate license
926
+ },
927
+ ['LICENSE-ABC', 'LICENSE-PQR', 'LICENSE-XYZ'],
928
+ [],
929
+ ),
930
+ (
931
+ {
932
+ 'setup.cfg': DALS(
933
+ """
934
+ [metadata]
935
+ license_file = LICENSE-ABC
936
+ license_files =
937
+ LICENSE-XYZ
938
+ """
939
+ ),
940
+ 'LICENSE-ABC': "ABC license",
941
+ 'LICENSE-PQR': "PQR license",
942
+ 'LICENSE-XYZ': "XYZ license",
943
+ # combined subset
944
+ },
945
+ ['LICENSE-ABC', 'LICENSE-XYZ'],
946
+ ['LICENSE-PQR'],
947
+ ),
948
+ (
949
+ {
950
+ 'setup.cfg': DALS(
951
+ """
952
+ [metadata]
953
+ license_file = LICENSE-ABC
954
+ license_files =
955
+ LICENSE-XYZ
956
+ LICENSE-PQR
957
+ """
958
+ ),
959
+ 'LICENSE-PQR': "Test license",
960
+ # with invalid licenses
961
+ },
962
+ ['LICENSE-PQR'],
963
+ ['LICENSE-ABC', 'LICENSE-XYZ'],
964
+ ),
965
+ (
966
+ {
967
+ 'setup.cfg': DALS(
968
+ """
969
+ [metadata]
970
+ license_file = LICENSE-ABC
971
+ license_files =
972
+ LICENSE-PQR
973
+ LICENSE-XYZ
974
+ """
975
+ ),
976
+ 'MANIFEST.in': "exclude LICENSE-ABC\nexclude LICENSE-PQR",
977
+ 'LICENSE-ABC': "ABC license",
978
+ 'LICENSE-PQR': "PQR license",
979
+ 'LICENSE-XYZ': "XYZ license",
980
+ # manifest is overwritten
981
+ },
982
+ ['LICENSE-ABC', 'LICENSE-PQR', 'LICENSE-XYZ'],
983
+ [],
984
+ ),
985
+ pytest.param(
986
+ {
987
+ 'setup.cfg': DALS(
988
+ """
989
+ [metadata]
990
+ license_file = LICENSE*
991
+ """
992
+ ),
993
+ 'LICENSE-ABC': "ABC license",
994
+ 'NOTICE-XYZ': "XYZ notice",
995
+ },
996
+ ['LICENSE-ABC'],
997
+ ['NOTICE-XYZ'],
998
+ id="no_default_glob_patterns",
999
+ ),
1000
+ pytest.param(
1001
+ {
1002
+ 'setup.cfg': DALS(
1003
+ """
1004
+ [metadata]
1005
+ license_file = LICENSE*
1006
+ license_files =
1007
+ NOTICE*
1008
+ """
1009
+ ),
1010
+ 'LICENSE-ABC': "ABC license",
1011
+ 'NOTICE-ABC': "ABC notice",
1012
+ 'AUTHORS-ABC': "ABC authors",
1013
+ },
1014
+ ['LICENSE-ABC', 'NOTICE-ABC'],
1015
+ ['AUTHORS-ABC'],
1016
+ id="combined_glob_patterrns",
1017
+ ),
1018
+ ],
1019
+ )
1020
+ def test_setup_cfg_license_file_license_files(
1021
+ self, tmpdir_cwd, env, files, incl_licenses, excl_licenses
1022
+ ):
1023
+ self._create_project()
1024
+ path.build(files)
1025
+
1026
+ environment.run_setup_py(
1027
+ cmd=['egg_info'],
1028
+ pypath=os.pathsep.join([env.paths['lib'], str(tmpdir_cwd)]),
1029
+ )
1030
+ egg_info_dir = os.path.join('.', 'foo.egg-info')
1031
+
1032
+ sources_text = Path(egg_info_dir, "SOURCES.txt").read_text(encoding="utf-8")
1033
+ sources_lines = [line.strip() for line in sources_text.splitlines()]
1034
+
1035
+ for lf in incl_licenses:
1036
+ assert sources_lines.count(lf) == 1
1037
+
1038
+ for lf in excl_licenses:
1039
+ assert sources_lines.count(lf) == 0
1040
+
1041
+ def test_license_file_attr_pkg_info(self, tmpdir_cwd, env):
1042
+ """All matched license files should have a corresponding License-File."""
1043
+ self._create_project()
1044
+ path.build({
1045
+ "setup.cfg": DALS(
1046
+ """
1047
+ [metadata]
1048
+ license_files =
1049
+ NOTICE*
1050
+ LICENSE*
1051
+ **/LICENSE
1052
+ """
1053
+ ),
1054
+ "LICENSE-ABC": "ABC license",
1055
+ "LICENSE-XYZ": "XYZ license",
1056
+ "NOTICE": "included",
1057
+ "IGNORE": "not include",
1058
+ "vendor": {'LICENSE': "Vendor license"},
1059
+ })
1060
+
1061
+ environment.run_setup_py(
1062
+ cmd=['egg_info'],
1063
+ pypath=os.pathsep.join([env.paths['lib'], str(tmpdir_cwd)]),
1064
+ )
1065
+ egg_info_dir = os.path.join('.', 'foo.egg-info')
1066
+ with open(os.path.join(egg_info_dir, 'PKG-INFO'), encoding="utf-8") as fp:
1067
+ pkg_info_lines = fp.read().split('\n')
1068
+ license_file_lines = [
1069
+ line for line in pkg_info_lines if line.startswith('License-File:')
1070
+ ]
1071
+
1072
+ # Only 'NOTICE', LICENSE-ABC', and 'LICENSE-XYZ' should have been matched
1073
+ # Also assert that order from license_files is keeped
1074
+ assert len(license_file_lines) == 4
1075
+ assert "License-File: NOTICE" == license_file_lines[0]
1076
+ assert "License-File: LICENSE-ABC" in license_file_lines[1:]
1077
+ assert "License-File: LICENSE-XYZ" in license_file_lines[1:]
1078
+ assert "License-File: vendor/LICENSE" in license_file_lines[3]
1079
+
1080
+ def test_metadata_version(self, tmpdir_cwd, env):
1081
+ """Make sure latest metadata version is used by default."""
1082
+ self._setup_script_with_requires("")
1083
+ environment.run_setup_py(
1084
+ cmd=['egg_info'],
1085
+ pypath=os.pathsep.join([env.paths['lib'], str(tmpdir_cwd)]),
1086
+ data_stream=1,
1087
+ )
1088
+ egg_info_dir = os.path.join('.', 'foo.egg-info')
1089
+ with open(os.path.join(egg_info_dir, 'PKG-INFO'), encoding="utf-8") as fp:
1090
+ pkg_info_lines = fp.read().split('\n')
1091
+ # Update metadata version if changed
1092
+ assert self._extract_mv_version(pkg_info_lines) == (2, 4)
1093
+
1094
+ def test_long_description_content_type(self, tmpdir_cwd, env):
1095
+ # Test that specifying a `long_description_content_type` keyword arg to
1096
+ # the `setup` function results in writing a `Description-Content-Type`
1097
+ # line to the `PKG-INFO` file in the `<distribution>.egg-info`
1098
+ # directory.
1099
+ # `Description-Content-Type` is described at
1100
+ # https://github.com/pypa/python-packaging-user-guide/pull/258
1101
+
1102
+ self._setup_script_with_requires(
1103
+ """long_description_content_type='text/markdown',"""
1104
+ )
1105
+ environ = os.environ.copy().update(
1106
+ HOME=env.paths['home'],
1107
+ )
1108
+ environment.run_setup_py(
1109
+ cmd=['egg_info'],
1110
+ pypath=os.pathsep.join([env.paths['lib'], str(tmpdir_cwd)]),
1111
+ data_stream=1,
1112
+ env=environ,
1113
+ )
1114
+ egg_info_dir = os.path.join('.', 'foo.egg-info')
1115
+ with open(os.path.join(egg_info_dir, 'PKG-INFO'), encoding="utf-8") as fp:
1116
+ pkg_info_lines = fp.read().split('\n')
1117
+ expected_line = 'Description-Content-Type: text/markdown'
1118
+ assert expected_line in pkg_info_lines
1119
+ assert 'Metadata-Version: 2.4' in pkg_info_lines
1120
+
1121
+ def test_long_description(self, tmpdir_cwd, env):
1122
+ # Test that specifying `long_description` and `long_description_content_type`
1123
+ # keyword args to the `setup` function results in writing
1124
+ # the description in the message payload of the `PKG-INFO` file
1125
+ # in the `<distribution>.egg-info` directory.
1126
+ self._setup_script_with_requires(
1127
+ "long_description='This is a long description\\nover multiple lines',"
1128
+ "long_description_content_type='text/markdown',"
1129
+ )
1130
+ environment.run_setup_py(
1131
+ cmd=['egg_info'],
1132
+ pypath=os.pathsep.join([env.paths['lib'], str(tmpdir_cwd)]),
1133
+ data_stream=1,
1134
+ )
1135
+ egg_info_dir = os.path.join('.', 'foo.egg-info')
1136
+ with open(os.path.join(egg_info_dir, 'PKG-INFO'), encoding="utf-8") as fp:
1137
+ pkg_info_lines = fp.read().split('\n')
1138
+ assert 'Metadata-Version: 2.4' in pkg_info_lines
1139
+ assert '' == pkg_info_lines[-1] # last line should be empty
1140
+ long_desc_lines = pkg_info_lines[pkg_info_lines.index('') :]
1141
+ assert 'This is a long description' in long_desc_lines
1142
+ assert 'over multiple lines' in long_desc_lines
1143
+
1144
+ def test_project_urls(self, tmpdir_cwd, env):
1145
+ # Test that specifying a `project_urls` dict to the `setup`
1146
+ # function results in writing multiple `Project-URL` lines to
1147
+ # the `PKG-INFO` file in the `<distribution>.egg-info`
1148
+ # directory.
1149
+ # `Project-URL` is described at https://packaging.python.org
1150
+ # /specifications/core-metadata/#project-url-multiple-use
1151
+
1152
+ self._setup_script_with_requires(
1153
+ """project_urls={
1154
+ 'Link One': 'https://example.com/one/',
1155
+ 'Link Two': 'https://example.com/two/',
1156
+ },"""
1157
+ )
1158
+ environ = os.environ.copy().update(
1159
+ HOME=env.paths['home'],
1160
+ )
1161
+ environment.run_setup_py(
1162
+ cmd=['egg_info'],
1163
+ pypath=os.pathsep.join([env.paths['lib'], str(tmpdir_cwd)]),
1164
+ data_stream=1,
1165
+ env=environ,
1166
+ )
1167
+ egg_info_dir = os.path.join('.', 'foo.egg-info')
1168
+ with open(os.path.join(egg_info_dir, 'PKG-INFO'), encoding="utf-8") as fp:
1169
+ pkg_info_lines = fp.read().split('\n')
1170
+ expected_line = 'Project-URL: Link One, https://example.com/one/'
1171
+ assert expected_line in pkg_info_lines
1172
+ expected_line = 'Project-URL: Link Two, https://example.com/two/'
1173
+ assert expected_line in pkg_info_lines
1174
+ assert self._extract_mv_version(pkg_info_lines) >= (1, 2)
1175
+
1176
+ def test_license(self, tmpdir_cwd, env):
1177
+ """Test single line license."""
1178
+ self._setup_script_with_requires("license='MIT',")
1179
+ environment.run_setup_py(
1180
+ cmd=['egg_info'],
1181
+ pypath=os.pathsep.join([env.paths['lib'], str(tmpdir_cwd)]),
1182
+ data_stream=1,
1183
+ )
1184
+ egg_info_dir = os.path.join('.', 'foo.egg-info')
1185
+ with open(os.path.join(egg_info_dir, 'PKG-INFO'), encoding="utf-8") as fp:
1186
+ pkg_info_lines = fp.read().split('\n')
1187
+ assert 'License: MIT' in pkg_info_lines
1188
+
1189
+ def test_license_escape(self, tmpdir_cwd, env):
1190
+ """Test license is escaped correctly if longer than one line."""
1191
+ self._setup_script_with_requires(
1192
+ "license='This is a long license text \\nover multiple lines',"
1193
+ )
1194
+ environment.run_setup_py(
1195
+ cmd=['egg_info'],
1196
+ pypath=os.pathsep.join([env.paths['lib'], str(tmpdir_cwd)]),
1197
+ data_stream=1,
1198
+ )
1199
+ egg_info_dir = os.path.join('.', 'foo.egg-info')
1200
+ with open(os.path.join(egg_info_dir, 'PKG-INFO'), encoding="utf-8") as fp:
1201
+ pkg_info_lines = fp.read().split('\n')
1202
+
1203
+ assert 'License: This is a long license text ' in pkg_info_lines
1204
+ assert ' over multiple lines' in pkg_info_lines
1205
+ assert 'text \n over multiple' in '\n'.join(pkg_info_lines)
1206
+
1207
+ def test_python_requires_egg_info(self, tmpdir_cwd, env):
1208
+ self._setup_script_with_requires("""python_requires='>=2.7.12',""")
1209
+ environ = os.environ.copy().update(
1210
+ HOME=env.paths['home'],
1211
+ )
1212
+ environment.run_setup_py(
1213
+ cmd=['egg_info'],
1214
+ pypath=os.pathsep.join([env.paths['lib'], str(tmpdir_cwd)]),
1215
+ data_stream=1,
1216
+ env=environ,
1217
+ )
1218
+ egg_info_dir = os.path.join('.', 'foo.egg-info')
1219
+ with open(os.path.join(egg_info_dir, 'PKG-INFO'), encoding="utf-8") as fp:
1220
+ pkg_info_lines = fp.read().split('\n')
1221
+ assert 'Requires-Python: >=2.7.12' in pkg_info_lines
1222
+ assert self._extract_mv_version(pkg_info_lines) >= (1, 2)
1223
+
1224
+ def test_manifest_maker_warning_suppression(self):
1225
+ fixtures = [
1226
+ "standard file not found: should have one of foo.py, bar.py",
1227
+ "standard file 'setup.py' not found",
1228
+ ]
1229
+
1230
+ for msg in fixtures:
1231
+ assert manifest_maker._should_suppress_warning(msg)
1232
+
1233
+ def test_egg_info_includes_setup_py(self, tmpdir_cwd):
1234
+ self._create_project()
1235
+ dist = Distribution({"name": "foo", "version": "0.0.1"})
1236
+ dist.script_name = "non_setup.py"
1237
+ egg_info_instance = egg_info(dist)
1238
+ egg_info_instance.finalize_options()
1239
+ egg_info_instance.run()
1240
+
1241
+ assert 'setup.py' in egg_info_instance.filelist.files
1242
+
1243
+ with open(egg_info_instance.egg_info + "/SOURCES.txt", encoding="utf-8") as f:
1244
+ sources = f.read().split('\n')
1245
+ assert 'setup.py' in sources
1246
+
1247
+ def _run_egg_info_command(self, tmpdir_cwd, env, cmd=None, output=None):
1248
+ environ = os.environ.copy().update(
1249
+ HOME=env.paths['home'],
1250
+ )
1251
+ if cmd is None:
1252
+ cmd = [
1253
+ 'egg_info',
1254
+ ]
1255
+ code, data = environment.run_setup_py(
1256
+ cmd=cmd,
1257
+ pypath=os.pathsep.join([env.paths['lib'], str(tmpdir_cwd)]),
1258
+ data_stream=1,
1259
+ env=environ,
1260
+ )
1261
+ assert not code, data
1262
+
1263
+ if output:
1264
+ assert output in data
1265
+
1266
+ def test_egg_info_tag_only_once(self, tmpdir_cwd, env):
1267
+ self._create_project()
1268
+ path.build({
1269
+ 'setup.cfg': DALS(
1270
+ """
1271
+ [egg_info]
1272
+ tag_build = dev
1273
+ tag_date = 0
1274
+ tag_svn_revision = 0
1275
+ """
1276
+ ),
1277
+ })
1278
+ self._run_egg_info_command(tmpdir_cwd, env)
1279
+ egg_info_dir = os.path.join('.', 'foo.egg-info')
1280
+ with open(os.path.join(egg_info_dir, 'PKG-INFO'), encoding="utf-8") as fp:
1281
+ pkg_info_lines = fp.read().split('\n')
1282
+ assert 'Version: 0.0.0.dev0' in pkg_info_lines
1283
+
1284
+
1285
+ class TestWriteEntries:
1286
+ def test_invalid_entry_point(self, tmpdir_cwd, env):
1287
+ dist = Distribution({"name": "foo", "version": "0.0.1"})
1288
+ dist.entry_points = {"foo": "foo = invalid-identifier:foo"}
1289
+ cmd = dist.get_command_obj("egg_info")
1290
+ expected_msg = r"Problems to parse .*invalid-identifier.*"
1291
+ with pytest.raises(errors.OptionError, match=expected_msg) as ex:
1292
+ write_entries(cmd, "entry_points", "entry_points.txt")
1293
+ assert "ensure entry-point follows the spec" in ex.value.args[0]
1294
+
1295
+ def test_valid_entry_point(self, tmpdir_cwd, env):
1296
+ dist = Distribution({"name": "foo", "version": "0.0.1"})
1297
+ dist.entry_points = {
1298
+ "abc": "foo = bar:baz",
1299
+ "def": ["faa = bor:boz"],
1300
+ }
1301
+ cmd = dist.get_command_obj("egg_info")
1302
+ write_entries(cmd, "entry_points", "entry_points.txt")
1303
+ content = Path("entry_points.txt").read_text(encoding="utf-8")
1304
+ assert "[abc]\nfoo = bar:baz\n" in content
1305
+ assert "[def]\nfaa = bor:boz\n" in content
.venv/lib/python3.12/site-packages/setuptools/tests/test_extern.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import importlib
2
+ import pickle
3
+
4
+ import packaging
5
+
6
+ from setuptools import Distribution
7
+
8
+
9
+ def test_reimport_extern():
10
+ packaging2 = importlib.import_module(packaging.__name__)
11
+ assert packaging is packaging2
12
+
13
+
14
+ def test_distribution_picklable():
15
+ pickle.loads(pickle.dumps(Distribution()))
.venv/lib/python3.12/site-packages/setuptools/tests/test_find_packages.py ADDED
@@ -0,0 +1,218 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Tests for automatic package discovery"""
2
+
3
+ import os
4
+ import shutil
5
+ import tempfile
6
+
7
+ import pytest
8
+
9
+ from setuptools import find_namespace_packages, find_packages
10
+ from setuptools.discovery import FlatLayoutPackageFinder
11
+
12
+ from .compat.py39 import os_helper
13
+
14
+
15
+ class TestFindPackages:
16
+ def setup_method(self, method):
17
+ self.dist_dir = tempfile.mkdtemp()
18
+ self._make_pkg_structure()
19
+
20
+ def teardown_method(self, method):
21
+ shutil.rmtree(self.dist_dir)
22
+
23
+ def _make_pkg_structure(self):
24
+ """Make basic package structure.
25
+
26
+ dist/
27
+ docs/
28
+ conf.py
29
+ pkg/
30
+ __pycache__/
31
+ nspkg/
32
+ mod.py
33
+ subpkg/
34
+ assets/
35
+ asset
36
+ __init__.py
37
+ setup.py
38
+
39
+ """
40
+ self.docs_dir = self._mkdir('docs', self.dist_dir)
41
+ self._touch('conf.py', self.docs_dir)
42
+ self.pkg_dir = self._mkdir('pkg', self.dist_dir)
43
+ self._mkdir('__pycache__', self.pkg_dir)
44
+ self.ns_pkg_dir = self._mkdir('nspkg', self.pkg_dir)
45
+ self._touch('mod.py', self.ns_pkg_dir)
46
+ self.sub_pkg_dir = self._mkdir('subpkg', self.pkg_dir)
47
+ self.asset_dir = self._mkdir('assets', self.sub_pkg_dir)
48
+ self._touch('asset', self.asset_dir)
49
+ self._touch('__init__.py', self.sub_pkg_dir)
50
+ self._touch('setup.py', self.dist_dir)
51
+
52
+ def _mkdir(self, path, parent_dir=None):
53
+ if parent_dir:
54
+ path = os.path.join(parent_dir, path)
55
+ os.mkdir(path)
56
+ return path
57
+
58
+ def _touch(self, path, dir_=None):
59
+ if dir_:
60
+ path = os.path.join(dir_, path)
61
+ open(path, 'wb').close()
62
+ return path
63
+
64
+ def test_regular_package(self):
65
+ self._touch('__init__.py', self.pkg_dir)
66
+ packages = find_packages(self.dist_dir)
67
+ assert packages == ['pkg', 'pkg.subpkg']
68
+
69
+ def test_exclude(self):
70
+ self._touch('__init__.py', self.pkg_dir)
71
+ packages = find_packages(self.dist_dir, exclude=('pkg.*',))
72
+ assert packages == ['pkg']
73
+
74
+ def test_exclude_recursive(self):
75
+ """
76
+ Excluding a parent package should not exclude child packages as well.
77
+ """
78
+ self._touch('__init__.py', self.pkg_dir)
79
+ self._touch('__init__.py', self.sub_pkg_dir)
80
+ packages = find_packages(self.dist_dir, exclude=('pkg',))
81
+ assert packages == ['pkg.subpkg']
82
+
83
+ def test_include_excludes_other(self):
84
+ """
85
+ If include is specified, other packages should be excluded.
86
+ """
87
+ self._touch('__init__.py', self.pkg_dir)
88
+ alt_dir = self._mkdir('other_pkg', self.dist_dir)
89
+ self._touch('__init__.py', alt_dir)
90
+ packages = find_packages(self.dist_dir, include=['other_pkg'])
91
+ assert packages == ['other_pkg']
92
+
93
+ def test_dir_with_dot_is_skipped(self):
94
+ shutil.rmtree(os.path.join(self.dist_dir, 'pkg/subpkg/assets'))
95
+ data_dir = self._mkdir('some.data', self.pkg_dir)
96
+ self._touch('__init__.py', data_dir)
97
+ self._touch('file.dat', data_dir)
98
+ packages = find_packages(self.dist_dir)
99
+ assert 'pkg.some.data' not in packages
100
+
101
+ def test_dir_with_packages_in_subdir_is_excluded(self):
102
+ """
103
+ Ensure that a package in a non-package such as build/pkg/__init__.py
104
+ is excluded.
105
+ """
106
+ build_dir = self._mkdir('build', self.dist_dir)
107
+ build_pkg_dir = self._mkdir('pkg', build_dir)
108
+ self._touch('__init__.py', build_pkg_dir)
109
+ packages = find_packages(self.dist_dir)
110
+ assert 'build.pkg' not in packages
111
+
112
+ @pytest.mark.skipif(not os_helper.can_symlink(), reason='Symlink support required')
113
+ def test_symlinked_packages_are_included(self):
114
+ """
115
+ A symbolically-linked directory should be treated like any other
116
+ directory when matched as a package.
117
+
118
+ Create a link from lpkg -> pkg.
119
+ """
120
+ self._touch('__init__.py', self.pkg_dir)
121
+ linked_pkg = os.path.join(self.dist_dir, 'lpkg')
122
+ os.symlink('pkg', linked_pkg)
123
+ assert os.path.isdir(linked_pkg)
124
+ packages = find_packages(self.dist_dir)
125
+ assert 'lpkg' in packages
126
+
127
+ def _assert_packages(self, actual, expected):
128
+ assert set(actual) == set(expected)
129
+
130
+ def test_pep420_ns_package(self):
131
+ packages = find_namespace_packages(
132
+ self.dist_dir, include=['pkg*'], exclude=['pkg.subpkg.assets']
133
+ )
134
+ self._assert_packages(packages, ['pkg', 'pkg.nspkg', 'pkg.subpkg'])
135
+
136
+ def test_pep420_ns_package_no_includes(self):
137
+ packages = find_namespace_packages(self.dist_dir, exclude=['pkg.subpkg.assets'])
138
+ self._assert_packages(packages, ['docs', 'pkg', 'pkg.nspkg', 'pkg.subpkg'])
139
+
140
+ def test_pep420_ns_package_no_includes_or_excludes(self):
141
+ packages = find_namespace_packages(self.dist_dir)
142
+ expected = ['docs', 'pkg', 'pkg.nspkg', 'pkg.subpkg', 'pkg.subpkg.assets']
143
+ self._assert_packages(packages, expected)
144
+
145
+ def test_regular_package_with_nested_pep420_ns_packages(self):
146
+ self._touch('__init__.py', self.pkg_dir)
147
+ packages = find_namespace_packages(
148
+ self.dist_dir, exclude=['docs', 'pkg.subpkg.assets']
149
+ )
150
+ self._assert_packages(packages, ['pkg', 'pkg.nspkg', 'pkg.subpkg'])
151
+
152
+ def test_pep420_ns_package_no_non_package_dirs(self):
153
+ shutil.rmtree(self.docs_dir)
154
+ shutil.rmtree(os.path.join(self.dist_dir, 'pkg/subpkg/assets'))
155
+ packages = find_namespace_packages(self.dist_dir)
156
+ self._assert_packages(packages, ['pkg', 'pkg.nspkg', 'pkg.subpkg'])
157
+
158
+
159
+ class TestFlatLayoutPackageFinder:
160
+ EXAMPLES = {
161
+ "hidden-folders": (
162
+ [".pkg/__init__.py", "pkg/__init__.py", "pkg/nested/file.txt"],
163
+ ["pkg", "pkg.nested"],
164
+ ),
165
+ "private-packages": (
166
+ ["_pkg/__init__.py", "pkg/_private/__init__.py"],
167
+ ["pkg", "pkg._private"],
168
+ ),
169
+ "invalid-name": (
170
+ ["invalid-pkg/__init__.py", "other.pkg/__init__.py", "yet,another/file.py"],
171
+ [],
172
+ ),
173
+ "docs": (["pkg/__init__.py", "docs/conf.py", "docs/readme.rst"], ["pkg"]),
174
+ "tests": (
175
+ ["pkg/__init__.py", "tests/test_pkg.py", "tests/__init__.py"],
176
+ ["pkg"],
177
+ ),
178
+ "examples": (
179
+ [
180
+ "pkg/__init__.py",
181
+ "examples/__init__.py",
182
+ "examples/file.py",
183
+ "example/other_file.py",
184
+ # Sub-packages should always be fine
185
+ "pkg/example/__init__.py",
186
+ "pkg/examples/__init__.py",
187
+ ],
188
+ ["pkg", "pkg.examples", "pkg.example"],
189
+ ),
190
+ "tool-specific": (
191
+ [
192
+ "htmlcov/index.html",
193
+ "pkg/__init__.py",
194
+ "tasks/__init__.py",
195
+ "tasks/subpackage/__init__.py",
196
+ "fabfile/__init__.py",
197
+ "fabfile/subpackage/__init__.py",
198
+ # Sub-packages should always be fine
199
+ "pkg/tasks/__init__.py",
200
+ "pkg/fabfile/__init__.py",
201
+ ],
202
+ ["pkg", "pkg.tasks", "pkg.fabfile"],
203
+ ),
204
+ }
205
+
206
+ @pytest.mark.parametrize("example", EXAMPLES.keys())
207
+ def test_unwanted_directories_not_included(self, tmp_path, example):
208
+ files, expected_packages = self.EXAMPLES[example]
209
+ ensure_files(tmp_path, files)
210
+ found_packages = FlatLayoutPackageFinder.find(str(tmp_path))
211
+ assert set(found_packages) == set(expected_packages)
212
+
213
+
214
+ def ensure_files(root_path, files):
215
+ for file in files:
216
+ path = root_path / file
217
+ path.parent.mkdir(parents=True, exist_ok=True)
218
+ path.touch()
.venv/lib/python3.12/site-packages/setuptools/tests/test_find_py_modules.py ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Tests for automatic discovery of modules"""
2
+
3
+ import os
4
+
5
+ import pytest
6
+
7
+ from setuptools.discovery import FlatLayoutModuleFinder, ModuleFinder
8
+
9
+ from .compat.py39 import os_helper
10
+ from .test_find_packages import ensure_files
11
+
12
+
13
+ class TestModuleFinder:
14
+ def find(self, path, *args, **kwargs):
15
+ return set(ModuleFinder.find(str(path), *args, **kwargs))
16
+
17
+ EXAMPLES = {
18
+ # circumstance: (files, kwargs, expected_modules)
19
+ "simple_folder": (
20
+ ["file.py", "other.py"],
21
+ {}, # kwargs
22
+ ["file", "other"],
23
+ ),
24
+ "exclude": (
25
+ ["file.py", "other.py"],
26
+ {"exclude": ["f*"]},
27
+ ["other"],
28
+ ),
29
+ "include": (
30
+ ["file.py", "fole.py", "other.py"],
31
+ {"include": ["f*"], "exclude": ["fo*"]},
32
+ ["file"],
33
+ ),
34
+ "invalid-name": (["my-file.py", "other.file.py"], {}, []),
35
+ }
36
+
37
+ @pytest.mark.parametrize("example", EXAMPLES.keys())
38
+ def test_finder(self, tmp_path, example):
39
+ files, kwargs, expected_modules = self.EXAMPLES[example]
40
+ ensure_files(tmp_path, files)
41
+ assert self.find(tmp_path, **kwargs) == set(expected_modules)
42
+
43
+ @pytest.mark.skipif(not os_helper.can_symlink(), reason='Symlink support required')
44
+ def test_symlinked_packages_are_included(self, tmp_path):
45
+ src = "_myfiles/file.py"
46
+ ensure_files(tmp_path, [src])
47
+ os.symlink(tmp_path / src, tmp_path / "link.py")
48
+ assert self.find(tmp_path) == {"link"}
49
+
50
+
51
+ class TestFlatLayoutModuleFinder:
52
+ def find(self, path, *args, **kwargs):
53
+ return set(FlatLayoutModuleFinder.find(str(path)))
54
+
55
+ EXAMPLES = {
56
+ # circumstance: (files, expected_modules)
57
+ "hidden-files": ([".module.py"], []),
58
+ "private-modules": (["_module.py"], []),
59
+ "common-names": (
60
+ ["setup.py", "conftest.py", "test.py", "tests.py", "example.py", "mod.py"],
61
+ ["mod"],
62
+ ),
63
+ "tool-specific": (
64
+ ["tasks.py", "fabfile.py", "noxfile.py", "dodo.py", "manage.py", "mod.py"],
65
+ ["mod"],
66
+ ),
67
+ }
68
+
69
+ @pytest.mark.parametrize("example", EXAMPLES.keys())
70
+ def test_unwanted_files_not_included(self, tmp_path, example):
71
+ files, expected_modules = self.EXAMPLES[example]
72
+ ensure_files(tmp_path, files)
73
+ assert self.find(tmp_path) == set(expected_modules)
.venv/lib/python3.12/site-packages/setuptools/tests/test_glob.py ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pytest
2
+ from jaraco import path
3
+
4
+ from setuptools.glob import glob
5
+
6
+
7
+ @pytest.mark.parametrize(
8
+ ('tree', 'pattern', 'matches'),
9
+ (
10
+ ('', b'', []),
11
+ ('', '', []),
12
+ (
13
+ """
14
+ appveyor.yml
15
+ CHANGES.rst
16
+ LICENSE
17
+ MANIFEST.in
18
+ pyproject.toml
19
+ README.rst
20
+ setup.cfg
21
+ setup.py
22
+ """,
23
+ '*.rst',
24
+ ('CHANGES.rst', 'README.rst'),
25
+ ),
26
+ (
27
+ """
28
+ appveyor.yml
29
+ CHANGES.rst
30
+ LICENSE
31
+ MANIFEST.in
32
+ pyproject.toml
33
+ README.rst
34
+ setup.cfg
35
+ setup.py
36
+ """,
37
+ b'*.rst',
38
+ (b'CHANGES.rst', b'README.rst'),
39
+ ),
40
+ ),
41
+ )
42
+ def test_glob(monkeypatch, tmpdir, tree, pattern, matches):
43
+ monkeypatch.chdir(tmpdir)
44
+ path.build({name: '' for name in tree.split()})
45
+ assert list(sorted(glob(pattern))) == list(sorted(matches))
.venv/lib/python3.12/site-packages/setuptools/tests/test_install_scripts.py ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """install_scripts tests"""
2
+
3
+ import sys
4
+
5
+ import pytest
6
+
7
+ from setuptools.command.install_scripts import install_scripts
8
+ from setuptools.dist import Distribution
9
+
10
+ from . import contexts
11
+
12
+
13
+ class TestInstallScripts:
14
+ settings = dict(
15
+ name='foo',
16
+ entry_points={'console_scripts': ['foo=foo:foo']},
17
+ version='0.0',
18
+ )
19
+ unix_exe = '/usr/dummy-test-path/local/bin/python'
20
+ unix_spaces_exe = '/usr/bin/env dummy-test-python'
21
+ win32_exe = 'C:\\Dummy Test Path\\Program Files\\Python 3.6\\python.exe'
22
+
23
+ def _run_install_scripts(self, install_dir, executable=None):
24
+ dist = Distribution(self.settings)
25
+ dist.script_name = 'setup.py'
26
+ cmd = install_scripts(dist)
27
+ cmd.install_dir = install_dir
28
+ if executable is not None:
29
+ bs = cmd.get_finalized_command('build_scripts')
30
+ bs.executable = executable
31
+ cmd.ensure_finalized()
32
+ with contexts.quiet():
33
+ cmd.run()
34
+
35
+ @pytest.mark.skipif(sys.platform == 'win32', reason='non-Windows only')
36
+ def test_sys_executable_escaping_unix(self, tmpdir, monkeypatch):
37
+ """
38
+ Ensure that shebang is not quoted on Unix when getting the Python exe
39
+ from sys.executable.
40
+ """
41
+ expected = f'#!{self.unix_exe}\n'
42
+ monkeypatch.setattr('sys.executable', self.unix_exe)
43
+ with tmpdir.as_cwd():
44
+ self._run_install_scripts(str(tmpdir))
45
+ with open(str(tmpdir.join('foo')), 'r', encoding="utf-8") as f:
46
+ actual = f.readline()
47
+ assert actual == expected
48
+
49
+ @pytest.mark.skipif(sys.platform != 'win32', reason='Windows only')
50
+ def test_sys_executable_escaping_win32(self, tmpdir, monkeypatch):
51
+ """
52
+ Ensure that shebang is quoted on Windows when getting the Python exe
53
+ from sys.executable and it contains a space.
54
+ """
55
+ expected = f'#!"{self.win32_exe}"\n'
56
+ monkeypatch.setattr('sys.executable', self.win32_exe)
57
+ with tmpdir.as_cwd():
58
+ self._run_install_scripts(str(tmpdir))
59
+ with open(str(tmpdir.join('foo-script.py')), 'r', encoding="utf-8") as f:
60
+ actual = f.readline()
61
+ assert actual == expected
62
+
63
+ @pytest.mark.skipif(sys.platform == 'win32', reason='non-Windows only')
64
+ def test_executable_with_spaces_escaping_unix(self, tmpdir):
65
+ """
66
+ Ensure that shebang on Unix is not quoted, even when
67
+ a value with spaces
68
+ is specified using --executable.
69
+ """
70
+ expected = f'#!{self.unix_spaces_exe}\n'
71
+ with tmpdir.as_cwd():
72
+ self._run_install_scripts(str(tmpdir), self.unix_spaces_exe)
73
+ with open(str(tmpdir.join('foo')), 'r', encoding="utf-8") as f:
74
+ actual = f.readline()
75
+ assert actual == expected
76
+
77
+ @pytest.mark.skipif(sys.platform != 'win32', reason='Windows only')
78
+ def test_executable_arg_escaping_win32(self, tmpdir):
79
+ """
80
+ Ensure that shebang on Windows is quoted when
81
+ getting a path with spaces
82
+ from --executable, that is itself properly quoted.
83
+ """
84
+ expected = f'#!"{self.win32_exe}"\n'
85
+ with tmpdir.as_cwd():
86
+ self._run_install_scripts(str(tmpdir), '"' + self.win32_exe + '"')
87
+ with open(str(tmpdir.join('foo-script.py')), 'r', encoding="utf-8") as f:
88
+ actual = f.readline()
89
+ assert actual == expected
.venv/lib/python3.12/site-packages/setuptools/tests/test_logging.py ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import functools
2
+ import inspect
3
+ import logging
4
+ import sys
5
+
6
+ import pytest
7
+
8
+ IS_PYPY = '__pypy__' in sys.builtin_module_names
9
+
10
+
11
+ setup_py = """\
12
+ from setuptools import setup
13
+
14
+ setup(
15
+ name="test_logging",
16
+ version="0.0"
17
+ )
18
+ """
19
+
20
+
21
+ @pytest.mark.parametrize(
22
+ ('flag', 'expected_level'), [("--dry-run", "INFO"), ("--verbose", "DEBUG")]
23
+ )
24
+ def test_verbosity_level(tmp_path, monkeypatch, flag, expected_level):
25
+ """Make sure the correct verbosity level is set (issue #3038)"""
26
+ import setuptools # noqa: F401 # import setuptools to monkeypatch distutils
27
+
28
+ import distutils # <- load distutils after all the patches take place
29
+
30
+ logger = logging.Logger(__name__)
31
+ monkeypatch.setattr(logging, "root", logger)
32
+ unset_log_level = logger.getEffectiveLevel()
33
+ assert logging.getLevelName(unset_log_level) == "NOTSET"
34
+
35
+ setup_script = tmp_path / "setup.py"
36
+ setup_script.write_text(setup_py, encoding="utf-8")
37
+ dist = distutils.core.run_setup(setup_script, stop_after="init")
38
+ dist.script_args = [flag, "sdist"]
39
+ dist.parse_command_line() # <- where the log level is set
40
+ log_level = logger.getEffectiveLevel()
41
+ log_level_name = logging.getLevelName(log_level)
42
+ assert log_level_name == expected_level
43
+
44
+
45
+ def flaky_on_pypy(func):
46
+ @functools.wraps(func)
47
+ def _func():
48
+ try:
49
+ func()
50
+ except AssertionError: # pragma: no cover
51
+ if IS_PYPY:
52
+ msg = "Flaky monkeypatch on PyPy (#4124)"
53
+ pytest.xfail(f"{msg}. Original discussion in #3707, #3709.")
54
+ raise
55
+
56
+ return _func
57
+
58
+
59
+ @flaky_on_pypy
60
+ def test_patching_does_not_cause_problems():
61
+ # Ensure `dist.log` is only patched if necessary
62
+
63
+ import _distutils_hack
64
+
65
+ import setuptools.logging
66
+
67
+ from distutils import dist
68
+
69
+ setuptools.logging.configure()
70
+
71
+ if _distutils_hack.enabled():
72
+ # Modern logging infra, no problematic patching.
73
+ assert dist.__file__ is None or "setuptools" in dist.__file__
74
+ assert isinstance(dist.log, logging.Logger)
75
+ else:
76
+ assert inspect.ismodule(dist.log)
.venv/lib/python3.12/site-packages/setuptools/tests/test_manifest.py ADDED
@@ -0,0 +1,622 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """sdist tests"""
2
+
3
+ from __future__ import annotations
4
+
5
+ import contextlib
6
+ import io
7
+ import itertools
8
+ import logging
9
+ import os
10
+ import shutil
11
+ import sys
12
+ import tempfile
13
+
14
+ import pytest
15
+
16
+ from setuptools.command.egg_info import FileList, egg_info, translate_pattern
17
+ from setuptools.dist import Distribution
18
+ from setuptools.tests.textwrap import DALS
19
+
20
+ from distutils import log
21
+ from distutils.errors import DistutilsTemplateError
22
+
23
+ IS_PYPY = '__pypy__' in sys.builtin_module_names
24
+
25
+
26
+ def make_local_path(s):
27
+ """Converts '/' in a string to os.sep"""
28
+ return s.replace('/', os.sep)
29
+
30
+
31
+ SETUP_ATTRS = {
32
+ 'name': 'app',
33
+ 'version': '0.0',
34
+ 'packages': ['app'],
35
+ }
36
+
37
+ SETUP_PY = f"""\
38
+ from setuptools import setup
39
+
40
+ setup(**{SETUP_ATTRS!r})
41
+ """
42
+
43
+
44
+ @contextlib.contextmanager
45
+ def quiet():
46
+ old_stdout, old_stderr = sys.stdout, sys.stderr
47
+ sys.stdout, sys.stderr = io.StringIO(), io.StringIO()
48
+ try:
49
+ yield
50
+ finally:
51
+ sys.stdout, sys.stderr = old_stdout, old_stderr
52
+
53
+
54
+ def touch(filename):
55
+ open(filename, 'wb').close()
56
+
57
+
58
+ # The set of files always in the manifest, including all files in the
59
+ # .egg-info directory
60
+ default_files = frozenset(
61
+ map(
62
+ make_local_path,
63
+ [
64
+ 'README.rst',
65
+ 'MANIFEST.in',
66
+ 'setup.py',
67
+ 'app.egg-info/PKG-INFO',
68
+ 'app.egg-info/SOURCES.txt',
69
+ 'app.egg-info/dependency_links.txt',
70
+ 'app.egg-info/top_level.txt',
71
+ 'app/__init__.py',
72
+ ],
73
+ )
74
+ )
75
+
76
+
77
+ translate_specs: list[tuple[str, list[str], list[str]]] = [
78
+ ('foo', ['foo'], ['bar', 'foobar']),
79
+ ('foo/bar', ['foo/bar'], ['foo/bar/baz', './foo/bar', 'foo']),
80
+ # Glob matching
81
+ ('*.txt', ['foo.txt', 'bar.txt'], ['foo/foo.txt']),
82
+ ('dir/*.txt', ['dir/foo.txt', 'dir/bar.txt', 'dir/.txt'], ['notdir/foo.txt']),
83
+ ('*/*.py', ['bin/start.py'], []),
84
+ ('docs/page-?.txt', ['docs/page-9.txt'], ['docs/page-10.txt']),
85
+ # Globstars change what they mean depending upon where they are
86
+ (
87
+ 'foo/**/bar',
88
+ ['foo/bing/bar', 'foo/bing/bang/bar', 'foo/bar'],
89
+ ['foo/abar'],
90
+ ),
91
+ (
92
+ 'foo/**',
93
+ ['foo/bar/bing.py', 'foo/x'],
94
+ ['/foo/x'],
95
+ ),
96
+ (
97
+ '**',
98
+ ['x', 'abc/xyz', '@nything'],
99
+ [],
100
+ ),
101
+ # Character classes
102
+ (
103
+ 'pre[one]post',
104
+ ['preopost', 'prenpost', 'preepost'],
105
+ ['prepost', 'preonepost'],
106
+ ),
107
+ (
108
+ 'hello[!one]world',
109
+ ['helloxworld', 'helloyworld'],
110
+ ['hellooworld', 'helloworld', 'hellooneworld'],
111
+ ),
112
+ (
113
+ '[]one].txt',
114
+ ['o.txt', '].txt', 'e.txt'],
115
+ ['one].txt'],
116
+ ),
117
+ (
118
+ 'foo[!]one]bar',
119
+ ['fooybar'],
120
+ ['foo]bar', 'fooobar', 'fooebar'],
121
+ ),
122
+ ]
123
+ """
124
+ A spec of inputs for 'translate_pattern' and matches and mismatches
125
+ for that input.
126
+ """
127
+
128
+ match_params = itertools.chain.from_iterable(
129
+ zip(itertools.repeat(pattern), matches)
130
+ for pattern, matches, mismatches in translate_specs
131
+ )
132
+
133
+
134
+ @pytest.fixture(params=match_params)
135
+ def pattern_match(request):
136
+ return map(make_local_path, request.param)
137
+
138
+
139
+ mismatch_params = itertools.chain.from_iterable(
140
+ zip(itertools.repeat(pattern), mismatches)
141
+ for pattern, matches, mismatches in translate_specs
142
+ )
143
+
144
+
145
+ @pytest.fixture(params=mismatch_params)
146
+ def pattern_mismatch(request):
147
+ return map(make_local_path, request.param)
148
+
149
+
150
+ def test_translated_pattern_match(pattern_match):
151
+ pattern, target = pattern_match
152
+ assert translate_pattern(pattern).match(target)
153
+
154
+
155
+ def test_translated_pattern_mismatch(pattern_mismatch):
156
+ pattern, target = pattern_mismatch
157
+ assert not translate_pattern(pattern).match(target)
158
+
159
+
160
+ class TempDirTestCase:
161
+ def setup_method(self, method):
162
+ self.temp_dir = tempfile.mkdtemp()
163
+ self.old_cwd = os.getcwd()
164
+ os.chdir(self.temp_dir)
165
+
166
+ def teardown_method(self, method):
167
+ os.chdir(self.old_cwd)
168
+ shutil.rmtree(self.temp_dir)
169
+
170
+
171
+ class TestManifestTest(TempDirTestCase):
172
+ def setup_method(self, method):
173
+ super().setup_method(method)
174
+
175
+ f = open(os.path.join(self.temp_dir, 'setup.py'), 'w', encoding="utf-8")
176
+ f.write(SETUP_PY)
177
+ f.close()
178
+ """
179
+ Create a file tree like:
180
+ - LICENSE
181
+ - README.rst
182
+ - testing.rst
183
+ - .hidden.rst
184
+ - app/
185
+ - __init__.py
186
+ - a.txt
187
+ - b.txt
188
+ - c.rst
189
+ - static/
190
+ - app.js
191
+ - app.js.map
192
+ - app.css
193
+ - app.css.map
194
+ """
195
+
196
+ for fname in ['README.rst', '.hidden.rst', 'testing.rst', 'LICENSE']:
197
+ touch(os.path.join(self.temp_dir, fname))
198
+
199
+ # Set up the rest of the test package
200
+ test_pkg = os.path.join(self.temp_dir, 'app')
201
+ os.mkdir(test_pkg)
202
+ for fname in ['__init__.py', 'a.txt', 'b.txt', 'c.rst']:
203
+ touch(os.path.join(test_pkg, fname))
204
+
205
+ # Some compiled front-end assets to include
206
+ static = os.path.join(test_pkg, 'static')
207
+ os.mkdir(static)
208
+ for fname in ['app.js', 'app.js.map', 'app.css', 'app.css.map']:
209
+ touch(os.path.join(static, fname))
210
+
211
+ def make_manifest(self, contents):
212
+ """Write a MANIFEST.in."""
213
+ manifest = os.path.join(self.temp_dir, 'MANIFEST.in')
214
+ with open(manifest, 'w', encoding="utf-8") as f:
215
+ f.write(DALS(contents))
216
+
217
+ def get_files(self):
218
+ """Run egg_info and get all the files to include, as a set"""
219
+ dist = Distribution(SETUP_ATTRS)
220
+ dist.script_name = 'setup.py'
221
+ cmd = egg_info(dist)
222
+ cmd.ensure_finalized()
223
+
224
+ cmd.run()
225
+
226
+ return set(cmd.filelist.files)
227
+
228
+ def test_no_manifest(self):
229
+ """Check a missing MANIFEST.in includes only the standard files."""
230
+ assert (default_files - set(['MANIFEST.in'])) == self.get_files()
231
+
232
+ def test_empty_files(self):
233
+ """Check an empty MANIFEST.in includes only the standard files."""
234
+ self.make_manifest("")
235
+ assert default_files == self.get_files()
236
+
237
+ def test_include(self):
238
+ """Include extra rst files in the project root."""
239
+ self.make_manifest("include *.rst")
240
+ files = default_files | set(['testing.rst', '.hidden.rst'])
241
+ assert files == self.get_files()
242
+
243
+ def test_exclude(self):
244
+ """Include everything in app/ except the text files"""
245
+ ml = make_local_path
246
+ self.make_manifest(
247
+ """
248
+ include app/*
249
+ exclude app/*.txt
250
+ """
251
+ )
252
+ files = default_files | set([ml('app/c.rst')])
253
+ assert files == self.get_files()
254
+
255
+ def test_include_multiple(self):
256
+ """Include with multiple patterns."""
257
+ ml = make_local_path
258
+ self.make_manifest("include app/*.txt app/static/*")
259
+ files = default_files | set([
260
+ ml('app/a.txt'),
261
+ ml('app/b.txt'),
262
+ ml('app/static/app.js'),
263
+ ml('app/static/app.js.map'),
264
+ ml('app/static/app.css'),
265
+ ml('app/static/app.css.map'),
266
+ ])
267
+ assert files == self.get_files()
268
+
269
+ def test_graft(self):
270
+ """Include the whole app/static/ directory."""
271
+ ml = make_local_path
272
+ self.make_manifest("graft app/static")
273
+ files = default_files | set([
274
+ ml('app/static/app.js'),
275
+ ml('app/static/app.js.map'),
276
+ ml('app/static/app.css'),
277
+ ml('app/static/app.css.map'),
278
+ ])
279
+ assert files == self.get_files()
280
+
281
+ def test_graft_glob_syntax(self):
282
+ """Include the whole app/static/ directory."""
283
+ ml = make_local_path
284
+ self.make_manifest("graft */static")
285
+ files = default_files | set([
286
+ ml('app/static/app.js'),
287
+ ml('app/static/app.js.map'),
288
+ ml('app/static/app.css'),
289
+ ml('app/static/app.css.map'),
290
+ ])
291
+ assert files == self.get_files()
292
+
293
+ def test_graft_global_exclude(self):
294
+ """Exclude all *.map files in the project."""
295
+ ml = make_local_path
296
+ self.make_manifest(
297
+ """
298
+ graft app/static
299
+ global-exclude *.map
300
+ """
301
+ )
302
+ files = default_files | set([ml('app/static/app.js'), ml('app/static/app.css')])
303
+ assert files == self.get_files()
304
+
305
+ def test_global_include(self):
306
+ """Include all *.rst, *.js, and *.css files in the whole tree."""
307
+ ml = make_local_path
308
+ self.make_manifest(
309
+ """
310
+ global-include *.rst *.js *.css
311
+ """
312
+ )
313
+ files = default_files | set([
314
+ '.hidden.rst',
315
+ 'testing.rst',
316
+ ml('app/c.rst'),
317
+ ml('app/static/app.js'),
318
+ ml('app/static/app.css'),
319
+ ])
320
+ assert files == self.get_files()
321
+
322
+ def test_graft_prune(self):
323
+ """Include all files in app/, except for the whole app/static/ dir."""
324
+ ml = make_local_path
325
+ self.make_manifest(
326
+ """
327
+ graft app
328
+ prune app/static
329
+ """
330
+ )
331
+ files = default_files | set([ml('app/a.txt'), ml('app/b.txt'), ml('app/c.rst')])
332
+ assert files == self.get_files()
333
+
334
+
335
+ class TestFileListTest(TempDirTestCase):
336
+ """
337
+ A copy of the relevant bits of distutils/tests/test_filelist.py,
338
+ to ensure setuptools' version of FileList keeps parity with distutils.
339
+ """
340
+
341
+ @pytest.fixture(autouse=os.getenv("SETUPTOOLS_USE_DISTUTILS") == "stdlib")
342
+ def _compat_record_logs(self, monkeypatch, caplog):
343
+ """Account for stdlib compatibility"""
344
+
345
+ def _log(_logger, level, msg, args):
346
+ exc = sys.exc_info()
347
+ rec = logging.LogRecord("distutils", level, "", 0, msg, args, exc)
348
+ caplog.records.append(rec)
349
+
350
+ monkeypatch.setattr(log.Log, "_log", _log)
351
+
352
+ def get_records(self, caplog, *levels):
353
+ return [r for r in caplog.records if r.levelno in levels]
354
+
355
+ def assertNoWarnings(self, caplog):
356
+ assert self.get_records(caplog, log.WARN) == []
357
+ caplog.clear()
358
+
359
+ def assertWarnings(self, caplog):
360
+ if IS_PYPY and not caplog.records:
361
+ pytest.xfail("caplog checks may not work well in PyPy")
362
+ else:
363
+ assert len(self.get_records(caplog, log.WARN)) > 0
364
+ caplog.clear()
365
+
366
+ def make_files(self, files):
367
+ for file in files:
368
+ file = os.path.join(self.temp_dir, file)
369
+ dirname, _basename = os.path.split(file)
370
+ os.makedirs(dirname, exist_ok=True)
371
+ touch(file)
372
+
373
+ def test_process_template_line(self):
374
+ # testing all MANIFEST.in template patterns
375
+ file_list = FileList()
376
+ ml = make_local_path
377
+
378
+ # simulated file list
379
+ self.make_files([
380
+ 'foo.tmp',
381
+ 'ok',
382
+ 'xo',
383
+ 'four.txt',
384
+ 'buildout.cfg',
385
+ # filelist does not filter out VCS directories,
386
+ # it's sdist that does
387
+ ml('.hg/last-message.txt'),
388
+ ml('global/one.txt'),
389
+ ml('global/two.txt'),
390
+ ml('global/files.x'),
391
+ ml('global/here.tmp'),
392
+ ml('f/o/f.oo'),
393
+ ml('dir/graft-one'),
394
+ ml('dir/dir2/graft2'),
395
+ ml('dir3/ok'),
396
+ ml('dir3/sub/ok.txt'),
397
+ ])
398
+
399
+ MANIFEST_IN = DALS(
400
+ """\
401
+ include ok
402
+ include xo
403
+ exclude xo
404
+ include foo.tmp
405
+ include buildout.cfg
406
+ global-include *.x
407
+ global-include *.txt
408
+ global-exclude *.tmp
409
+ recursive-include f *.oo
410
+ recursive-exclude global *.x
411
+ graft dir
412
+ prune dir3
413
+ """
414
+ )
415
+
416
+ for line in MANIFEST_IN.split('\n'):
417
+ if not line:
418
+ continue
419
+ file_list.process_template_line(line)
420
+
421
+ wanted = [
422
+ 'buildout.cfg',
423
+ 'four.txt',
424
+ 'ok',
425
+ ml('.hg/last-message.txt'),
426
+ ml('dir/graft-one'),
427
+ ml('dir/dir2/graft2'),
428
+ ml('f/o/f.oo'),
429
+ ml('global/one.txt'),
430
+ ml('global/two.txt'),
431
+ ]
432
+
433
+ file_list.sort()
434
+ assert file_list.files == wanted
435
+
436
+ def test_exclude_pattern(self):
437
+ # return False if no match
438
+ file_list = FileList()
439
+ assert not file_list.exclude_pattern('*.py')
440
+
441
+ # return True if files match
442
+ file_list = FileList()
443
+ file_list.files = ['a.py', 'b.py']
444
+ assert file_list.exclude_pattern('*.py')
445
+
446
+ # test excludes
447
+ file_list = FileList()
448
+ file_list.files = ['a.py', 'a.txt']
449
+ file_list.exclude_pattern('*.py')
450
+ file_list.sort()
451
+ assert file_list.files == ['a.txt']
452
+
453
+ def test_include_pattern(self):
454
+ # return False if no match
455
+ file_list = FileList()
456
+ self.make_files([])
457
+ assert not file_list.include_pattern('*.py')
458
+
459
+ # return True if files match
460
+ file_list = FileList()
461
+ self.make_files(['a.py', 'b.txt'])
462
+ assert file_list.include_pattern('*.py')
463
+
464
+ # test * matches all files
465
+ file_list = FileList()
466
+ self.make_files(['a.py', 'b.txt'])
467
+ file_list.include_pattern('*')
468
+ file_list.sort()
469
+ assert file_list.files == ['a.py', 'b.txt']
470
+
471
+ def test_process_template_line_invalid(self):
472
+ # invalid lines
473
+ file_list = FileList()
474
+ for action in (
475
+ 'include',
476
+ 'exclude',
477
+ 'global-include',
478
+ 'global-exclude',
479
+ 'recursive-include',
480
+ 'recursive-exclude',
481
+ 'graft',
482
+ 'prune',
483
+ 'blarg',
484
+ ):
485
+ with pytest.raises(DistutilsTemplateError):
486
+ file_list.process_template_line(action)
487
+
488
+ def test_include(self, caplog):
489
+ caplog.set_level(logging.DEBUG)
490
+ ml = make_local_path
491
+ # include
492
+ file_list = FileList()
493
+ self.make_files(['a.py', 'b.txt', ml('d/c.py')])
494
+
495
+ file_list.process_template_line('include *.py')
496
+ file_list.sort()
497
+ assert file_list.files == ['a.py']
498
+ self.assertNoWarnings(caplog)
499
+
500
+ file_list.process_template_line('include *.rb')
501
+ file_list.sort()
502
+ assert file_list.files == ['a.py']
503
+ self.assertWarnings(caplog)
504
+
505
+ def test_exclude(self, caplog):
506
+ caplog.set_level(logging.DEBUG)
507
+ ml = make_local_path
508
+ # exclude
509
+ file_list = FileList()
510
+ file_list.files = ['a.py', 'b.txt', ml('d/c.py')]
511
+
512
+ file_list.process_template_line('exclude *.py')
513
+ file_list.sort()
514
+ assert file_list.files == ['b.txt', ml('d/c.py')]
515
+ self.assertNoWarnings(caplog)
516
+
517
+ file_list.process_template_line('exclude *.rb')
518
+ file_list.sort()
519
+ assert file_list.files == ['b.txt', ml('d/c.py')]
520
+ self.assertWarnings(caplog)
521
+
522
+ def test_global_include(self, caplog):
523
+ caplog.set_level(logging.DEBUG)
524
+ ml = make_local_path
525
+ # global-include
526
+ file_list = FileList()
527
+ self.make_files(['a.py', 'b.txt', ml('d/c.py')])
528
+
529
+ file_list.process_template_line('global-include *.py')
530
+ file_list.sort()
531
+ assert file_list.files == ['a.py', ml('d/c.py')]
532
+ self.assertNoWarnings(caplog)
533
+
534
+ file_list.process_template_line('global-include *.rb')
535
+ file_list.sort()
536
+ assert file_list.files == ['a.py', ml('d/c.py')]
537
+ self.assertWarnings(caplog)
538
+
539
+ def test_global_exclude(self, caplog):
540
+ caplog.set_level(logging.DEBUG)
541
+ ml = make_local_path
542
+ # global-exclude
543
+ file_list = FileList()
544
+ file_list.files = ['a.py', 'b.txt', ml('d/c.py')]
545
+
546
+ file_list.process_template_line('global-exclude *.py')
547
+ file_list.sort()
548
+ assert file_list.files == ['b.txt']
549
+ self.assertNoWarnings(caplog)
550
+
551
+ file_list.process_template_line('global-exclude *.rb')
552
+ file_list.sort()
553
+ assert file_list.files == ['b.txt']
554
+ self.assertWarnings(caplog)
555
+
556
+ def test_recursive_include(self, caplog):
557
+ caplog.set_level(logging.DEBUG)
558
+ ml = make_local_path
559
+ # recursive-include
560
+ file_list = FileList()
561
+ self.make_files(['a.py', ml('d/b.py'), ml('d/c.txt'), ml('d/d/e.py')])
562
+
563
+ file_list.process_template_line('recursive-include d *.py')
564
+ file_list.sort()
565
+ assert file_list.files == [ml('d/b.py'), ml('d/d/e.py')]
566
+ self.assertNoWarnings(caplog)
567
+
568
+ file_list.process_template_line('recursive-include e *.py')
569
+ file_list.sort()
570
+ assert file_list.files == [ml('d/b.py'), ml('d/d/e.py')]
571
+ self.assertWarnings(caplog)
572
+
573
+ def test_recursive_exclude(self, caplog):
574
+ caplog.set_level(logging.DEBUG)
575
+ ml = make_local_path
576
+ # recursive-exclude
577
+ file_list = FileList()
578
+ file_list.files = ['a.py', ml('d/b.py'), ml('d/c.txt'), ml('d/d/e.py')]
579
+
580
+ file_list.process_template_line('recursive-exclude d *.py')
581
+ file_list.sort()
582
+ assert file_list.files == ['a.py', ml('d/c.txt')]
583
+ self.assertNoWarnings(caplog)
584
+
585
+ file_list.process_template_line('recursive-exclude e *.py')
586
+ file_list.sort()
587
+ assert file_list.files == ['a.py', ml('d/c.txt')]
588
+ self.assertWarnings(caplog)
589
+
590
+ def test_graft(self, caplog):
591
+ caplog.set_level(logging.DEBUG)
592
+ ml = make_local_path
593
+ # graft
594
+ file_list = FileList()
595
+ self.make_files(['a.py', ml('d/b.py'), ml('d/d/e.py'), ml('f/f.py')])
596
+
597
+ file_list.process_template_line('graft d')
598
+ file_list.sort()
599
+ assert file_list.files == [ml('d/b.py'), ml('d/d/e.py')]
600
+ self.assertNoWarnings(caplog)
601
+
602
+ file_list.process_template_line('graft e')
603
+ file_list.sort()
604
+ assert file_list.files == [ml('d/b.py'), ml('d/d/e.py')]
605
+ self.assertWarnings(caplog)
606
+
607
+ def test_prune(self, caplog):
608
+ caplog.set_level(logging.DEBUG)
609
+ ml = make_local_path
610
+ # prune
611
+ file_list = FileList()
612
+ file_list.files = ['a.py', ml('d/b.py'), ml('d/d/e.py'), ml('f/f.py')]
613
+
614
+ file_list.process_template_line('prune d')
615
+ file_list.sort()
616
+ assert file_list.files == ['a.py', ml('f/f.py')]
617
+ self.assertNoWarnings(caplog)
618
+
619
+ file_list.process_template_line('prune e')
620
+ file_list.sort()
621
+ assert file_list.files == ['a.py', ml('f/f.py')]
622
+ self.assertWarnings(caplog)
.venv/lib/python3.12/site-packages/setuptools/tests/test_namespaces.py ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import subprocess
2
+ import sys
3
+
4
+ from setuptools._path import paths_on_pythonpath
5
+
6
+ from . import namespaces
7
+
8
+
9
+ class TestNamespaces:
10
+ def test_mixed_site_and_non_site(self, tmpdir):
11
+ """
12
+ Installing two packages sharing the same namespace, one installed
13
+ to a site dir and the other installed just to a path on PYTHONPATH
14
+ should leave the namespace in tact and both packages reachable by
15
+ import.
16
+ """
17
+ pkg_A = namespaces.build_namespace_package(tmpdir, 'myns.pkgA')
18
+ pkg_B = namespaces.build_namespace_package(tmpdir, 'myns.pkgB')
19
+ site_packages = tmpdir / 'site-packages'
20
+ path_packages = tmpdir / 'path-packages'
21
+ targets = site_packages, path_packages
22
+ # use pip to install to the target directory
23
+ install_cmd = [
24
+ sys.executable,
25
+ '-m',
26
+ 'pip.__main__',
27
+ 'install',
28
+ str(pkg_A),
29
+ '-t',
30
+ str(site_packages),
31
+ ]
32
+ subprocess.check_call(install_cmd)
33
+ namespaces.make_site_dir(site_packages)
34
+ install_cmd = [
35
+ sys.executable,
36
+ '-m',
37
+ 'pip.__main__',
38
+ 'install',
39
+ str(pkg_B),
40
+ '-t',
41
+ str(path_packages),
42
+ ]
43
+ subprocess.check_call(install_cmd)
44
+ try_import = [
45
+ sys.executable,
46
+ '-c',
47
+ 'import myns.pkgA; import myns.pkgB',
48
+ ]
49
+ with paths_on_pythonpath(map(str, targets)):
50
+ subprocess.check_call(try_import)
51
+
52
+ def test_pkg_resources_import(self, tmpdir):
53
+ """
54
+ Ensure that a namespace package doesn't break on import
55
+ of pkg_resources.
56
+ """
57
+ pkg = namespaces.build_namespace_package(tmpdir, 'myns.pkgA')
58
+ target = tmpdir / 'packages'
59
+ target.mkdir()
60
+ install_cmd = [
61
+ sys.executable,
62
+ '-m',
63
+ 'pip',
64
+ 'install',
65
+ '-t',
66
+ str(target),
67
+ str(pkg),
68
+ ]
69
+ with paths_on_pythonpath([str(target)]):
70
+ subprocess.check_call(install_cmd)
71
+ namespaces.make_site_dir(target)
72
+ try_import = [
73
+ sys.executable,
74
+ '-c',
75
+ 'import pkg_resources',
76
+ ]
77
+ with paths_on_pythonpath([str(target)]):
78
+ subprocess.check_call(try_import)
79
+
80
+ def test_namespace_package_installed_and_cwd(self, tmpdir):
81
+ """
82
+ Installing a namespace packages but also having it in the current
83
+ working directory, only one version should take precedence.
84
+ """
85
+ pkg_A = namespaces.build_namespace_package(tmpdir, 'myns.pkgA')
86
+ target = tmpdir / 'packages'
87
+ # use pip to install to the target directory
88
+ install_cmd = [
89
+ sys.executable,
90
+ '-m',
91
+ 'pip.__main__',
92
+ 'install',
93
+ str(pkg_A),
94
+ '-t',
95
+ str(target),
96
+ ]
97
+ subprocess.check_call(install_cmd)
98
+ namespaces.make_site_dir(target)
99
+
100
+ # ensure that package imports and pkg_resources imports
101
+ pkg_resources_imp = [
102
+ sys.executable,
103
+ '-c',
104
+ 'import pkg_resources; import myns.pkgA',
105
+ ]
106
+ with paths_on_pythonpath([str(target)]):
107
+ subprocess.check_call(pkg_resources_imp, cwd=str(pkg_A))
108
+
109
+ def test_packages_in_the_same_namespace_installed_and_cwd(self, tmpdir):
110
+ """
111
+ Installing one namespace package and also have another in the same
112
+ namespace in the current working directory, both of them must be
113
+ importable.
114
+ """
115
+ pkg_A = namespaces.build_namespace_package(tmpdir, 'myns.pkgA')
116
+ pkg_B = namespaces.build_namespace_package(tmpdir, 'myns.pkgB')
117
+ target = tmpdir / 'packages'
118
+ # use pip to install to the target directory
119
+ install_cmd = [
120
+ sys.executable,
121
+ '-m',
122
+ 'pip.__main__',
123
+ 'install',
124
+ str(pkg_A),
125
+ '-t',
126
+ str(target),
127
+ ]
128
+ subprocess.check_call(install_cmd)
129
+ namespaces.make_site_dir(target)
130
+
131
+ # ensure that all packages import and pkg_resources imports
132
+ pkg_resources_imp = [
133
+ sys.executable,
134
+ '-c',
135
+ 'import pkg_resources; import myns.pkgA; import myns.pkgB',
136
+ ]
137
+ with paths_on_pythonpath([str(target)]):
138
+ subprocess.check_call(pkg_resources_imp, cwd=str(pkg_B))
.venv/lib/python3.12/site-packages/setuptools/tests/test_packageindex.py ADDED
@@ -0,0 +1,267 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import http.client
2
+ import re
3
+ import urllib.error
4
+ import urllib.request
5
+ from inspect import cleandoc
6
+
7
+ import pytest
8
+
9
+ import setuptools.package_index
10
+
11
+ import distutils.errors
12
+
13
+
14
+ class TestPackageIndex:
15
+ def test_regex(self):
16
+ hash_url = 'http://other_url?:action=show_md5&amp;'
17
+ hash_url += 'digest=0123456789abcdef0123456789abcdef'
18
+ doc = """
19
+ <a href="http://some_url">Name</a>
20
+ (<a title="MD5 hash"
21
+ href="{hash_url}">md5</a>)
22
+ """.lstrip().format(**locals())
23
+ assert setuptools.package_index.PYPI_MD5.match(doc)
24
+
25
+ def test_bad_url_bad_port(self):
26
+ index = setuptools.package_index.PackageIndex()
27
+ url = 'http://127.0.0.1:0/nonesuch/test_package_index'
28
+ with pytest.raises(Exception, match=re.escape(url)):
29
+ v = index.open_url(url)
30
+ assert isinstance(v, urllib.error.HTTPError)
31
+
32
+ def test_bad_url_typo(self):
33
+ # issue 16
34
+ # easy_install inquant.contentmirror.plone breaks because of a typo
35
+ # in its home URL
36
+ index = setuptools.package_index.PackageIndex(hosts=('www.example.com',))
37
+
38
+ url = 'url:%20https://svn.plone.org/svn/collective/inquant.contentmirror.plone/trunk'
39
+
40
+ with pytest.raises(Exception, match=re.escape(url)):
41
+ v = index.open_url(url)
42
+ assert isinstance(v, urllib.error.HTTPError)
43
+
44
+ def test_bad_url_bad_status_line(self):
45
+ index = setuptools.package_index.PackageIndex(hosts=('www.example.com',))
46
+
47
+ def _urlopen(*args):
48
+ raise http.client.BadStatusLine('line')
49
+
50
+ index.opener = _urlopen
51
+ url = 'http://example.com'
52
+ with pytest.raises(Exception, match=r'line'):
53
+ index.open_url(url)
54
+
55
+ def test_bad_url_double_scheme(self):
56
+ """
57
+ A bad URL with a double scheme should raise a DistutilsError.
58
+ """
59
+ index = setuptools.package_index.PackageIndex(hosts=('www.example.com',))
60
+
61
+ # issue 20
62
+ url = 'http://http://svn.pythonpaste.org/Paste/wphp/trunk'
63
+ try:
64
+ index.open_url(url)
65
+ except distutils.errors.DistutilsError as error:
66
+ msg = str(error)
67
+ assert (
68
+ 'nonnumeric port' in msg
69
+ or 'getaddrinfo failed' in msg
70
+ or 'Name or service not known' in msg
71
+ )
72
+ return
73
+ raise RuntimeError("Did not raise")
74
+
75
+ def test_url_ok(self):
76
+ index = setuptools.package_index.PackageIndex(hosts=('www.example.com',))
77
+ url = 'file:///tmp/test_package_index'
78
+ assert index.url_ok(url, True)
79
+
80
+ def test_parse_bdist_wininst(self):
81
+ parse = setuptools.package_index.parse_bdist_wininst
82
+
83
+ actual = parse('reportlab-2.5.win32-py2.4.exe')
84
+ expected = 'reportlab-2.5', '2.4', 'win32'
85
+ assert actual == expected
86
+
87
+ actual = parse('reportlab-2.5.win32.exe')
88
+ expected = 'reportlab-2.5', None, 'win32'
89
+ assert actual == expected
90
+
91
+ actual = parse('reportlab-2.5.win-amd64-py2.7.exe')
92
+ expected = 'reportlab-2.5', '2.7', 'win-amd64'
93
+ assert actual == expected
94
+
95
+ actual = parse('reportlab-2.5.win-amd64.exe')
96
+ expected = 'reportlab-2.5', None, 'win-amd64'
97
+ assert actual == expected
98
+
99
+ def test__vcs_split_rev_from_url(self):
100
+ """
101
+ Test the basic usage of _vcs_split_rev_from_url
102
+ """
103
+ vsrfu = setuptools.package_index.PackageIndex._vcs_split_rev_from_url
104
+ url, rev = vsrfu('https://example.com/bar@2995')
105
+ assert url == 'https://example.com/bar'
106
+ assert rev == '2995'
107
+
108
+ def test_local_index(self, tmpdir):
109
+ """
110
+ local_open should be able to read an index from the file system.
111
+ """
112
+ index_file = tmpdir / 'index.html'
113
+ with index_file.open('w') as f:
114
+ f.write('<div>content</div>')
115
+ url = 'file:' + urllib.request.pathname2url(str(tmpdir)) + '/'
116
+ res = setuptools.package_index.local_open(url)
117
+ assert 'content' in res.read()
118
+
119
+ def test_egg_fragment(self):
120
+ """
121
+ EGG fragments must comply to PEP 440
122
+ """
123
+ epoch = [
124
+ '',
125
+ '1!',
126
+ ]
127
+ releases = [
128
+ '0',
129
+ '0.0',
130
+ '0.0.0',
131
+ ]
132
+ pre = [
133
+ 'a0',
134
+ 'b0',
135
+ 'rc0',
136
+ ]
137
+ post = ['.post0']
138
+ dev = [
139
+ '.dev0',
140
+ ]
141
+ local = [
142
+ ('', ''),
143
+ ('+ubuntu.0', '+ubuntu.0'),
144
+ ('+ubuntu-0', '+ubuntu.0'),
145
+ ('+ubuntu_0', '+ubuntu.0'),
146
+ ]
147
+ versions = [
148
+ [''.join([e, r, p, loc]) for loc in locs]
149
+ for e in epoch
150
+ for r in releases
151
+ for p in sum([pre, post, dev], [''])
152
+ for locs in local
153
+ ]
154
+ for v, vc in versions:
155
+ dists = list(
156
+ setuptools.package_index.distros_for_url(
157
+ 'http://example.com/example-foo.zip#egg=example-foo-' + v
158
+ )
159
+ )
160
+ assert dists[0].version == ''
161
+ assert dists[1].version == vc
162
+
163
+ def test_download_git_with_rev(self, tmp_path, fp):
164
+ url = 'git+https://github.example/group/project@master#egg=foo'
165
+ index = setuptools.package_index.PackageIndex()
166
+
167
+ expected_dir = tmp_path / 'project@master'
168
+ fp.register([
169
+ 'git',
170
+ 'clone',
171
+ '--quiet',
172
+ 'https://github.example/group/project',
173
+ expected_dir,
174
+ ])
175
+ fp.register(['git', '-C', expected_dir, 'checkout', '--quiet', 'master'])
176
+
177
+ result = index.download(url, tmp_path)
178
+
179
+ assert result == str(expected_dir)
180
+ assert len(fp.calls) == 2
181
+
182
+ def test_download_git_no_rev(self, tmp_path, fp):
183
+ url = 'git+https://github.example/group/project#egg=foo'
184
+ index = setuptools.package_index.PackageIndex()
185
+
186
+ expected_dir = tmp_path / 'project'
187
+ fp.register([
188
+ 'git',
189
+ 'clone',
190
+ '--quiet',
191
+ 'https://github.example/group/project',
192
+ expected_dir,
193
+ ])
194
+ index.download(url, tmp_path)
195
+
196
+ def test_download_svn(self, tmp_path):
197
+ url = 'svn+https://svn.example/project#egg=foo'
198
+ index = setuptools.package_index.PackageIndex()
199
+
200
+ msg = r".*SVN download is not supported.*"
201
+ with pytest.raises(distutils.errors.DistutilsError, match=msg):
202
+ index.download(url, tmp_path)
203
+
204
+
205
+ class TestContentCheckers:
206
+ def test_md5(self):
207
+ checker = setuptools.package_index.HashChecker.from_url(
208
+ 'http://foo/bar#md5=f12895fdffbd45007040d2e44df98478'
209
+ )
210
+ checker.feed('You should probably not be using MD5'.encode('ascii'))
211
+ assert checker.hash.hexdigest() == 'f12895fdffbd45007040d2e44df98478'
212
+ assert checker.is_valid()
213
+
214
+ def test_other_fragment(self):
215
+ "Content checks should succeed silently if no hash is present"
216
+ checker = setuptools.package_index.HashChecker.from_url(
217
+ 'http://foo/bar#something%20completely%20different'
218
+ )
219
+ checker.feed('anything'.encode('ascii'))
220
+ assert checker.is_valid()
221
+
222
+ def test_blank_md5(self):
223
+ "Content checks should succeed if a hash is empty"
224
+ checker = setuptools.package_index.HashChecker.from_url('http://foo/bar#md5=')
225
+ checker.feed('anything'.encode('ascii'))
226
+ assert checker.is_valid()
227
+
228
+ def test_get_hash_name_md5(self):
229
+ checker = setuptools.package_index.HashChecker.from_url(
230
+ 'http://foo/bar#md5=f12895fdffbd45007040d2e44df98478'
231
+ )
232
+ assert checker.hash_name == 'md5'
233
+
234
+ def test_report(self):
235
+ checker = setuptools.package_index.HashChecker.from_url(
236
+ 'http://foo/bar#md5=f12895fdffbd45007040d2e44df98478'
237
+ )
238
+ rep = checker.report(lambda x: x, 'My message about %s')
239
+ assert rep == 'My message about md5'
240
+
241
+
242
+ class TestPyPIConfig:
243
+ def test_percent_in_password(self, tmp_home_dir):
244
+ pypirc = tmp_home_dir / '.pypirc'
245
+ pypirc.write_text(
246
+ cleandoc(
247
+ """
248
+ [pypi]
249
+ repository=https://pypi.org
250
+ username=jaraco
251
+ password=pity%
252
+ """
253
+ ),
254
+ encoding="utf-8",
255
+ )
256
+ cfg = setuptools.package_index.PyPIConfig()
257
+ cred = cfg.creds_by_repository['https://pypi.org']
258
+ assert cred.username == 'jaraco'
259
+ assert cred.password == 'pity%'
260
+
261
+
262
+ @pytest.mark.timeout(1)
263
+ def test_REL_DoS():
264
+ """
265
+ REL should not hang on a contrived attack string.
266
+ """
267
+ setuptools.package_index.REL.search('< rel=' + ' ' * 2**12)
.venv/lib/python3.12/site-packages/setuptools/tests/test_sandbox.py ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """develop tests"""
2
+
3
+ import os
4
+ import types
5
+
6
+ import pytest
7
+
8
+ import pkg_resources
9
+ import setuptools.sandbox
10
+
11
+
12
+ class TestSandbox:
13
+ def test_devnull(self, tmpdir):
14
+ with setuptools.sandbox.DirectorySandbox(str(tmpdir)):
15
+ self._file_writer(os.devnull)
16
+
17
+ @staticmethod
18
+ def _file_writer(path):
19
+ def do_write():
20
+ with open(path, 'w', encoding="utf-8") as f:
21
+ f.write('xxx')
22
+
23
+ return do_write
24
+
25
+ def test_setup_py_with_BOM(self):
26
+ """
27
+ It should be possible to execute a setup.py with a Byte Order Mark
28
+ """
29
+ target = pkg_resources.resource_filename(__name__, 'script-with-bom.py')
30
+ namespace = types.ModuleType('namespace')
31
+ setuptools.sandbox._execfile(target, vars(namespace))
32
+ assert namespace.result == 'passed'
33
+
34
+ def test_setup_py_with_CRLF(self, tmpdir):
35
+ setup_py = tmpdir / 'setup.py'
36
+ with setup_py.open('wb') as stream:
37
+ stream.write(b'"degenerate script"\r\n')
38
+ setuptools.sandbox._execfile(str(setup_py), globals())
39
+
40
+
41
+ class TestExceptionSaver:
42
+ def test_exception_trapped(self):
43
+ with setuptools.sandbox.ExceptionSaver():
44
+ raise ValueError("details")
45
+
46
+ def test_exception_resumed(self):
47
+ with setuptools.sandbox.ExceptionSaver() as saved_exc:
48
+ raise ValueError("details")
49
+
50
+ with pytest.raises(ValueError) as caught:
51
+ saved_exc.resume()
52
+
53
+ assert isinstance(caught.value, ValueError)
54
+ assert str(caught.value) == 'details'
55
+
56
+ def test_exception_reconstructed(self):
57
+ orig_exc = ValueError("details")
58
+
59
+ with setuptools.sandbox.ExceptionSaver() as saved_exc:
60
+ raise orig_exc
61
+
62
+ with pytest.raises(ValueError) as caught:
63
+ saved_exc.resume()
64
+
65
+ assert isinstance(caught.value, ValueError)
66
+ assert caught.value is not orig_exc
67
+
68
+ def test_no_exception_passes_quietly(self):
69
+ with setuptools.sandbox.ExceptionSaver() as saved_exc:
70
+ pass
71
+
72
+ saved_exc.resume()
73
+
74
+ def test_unpickleable_exception(self):
75
+ class CantPickleThis(Exception):
76
+ "This Exception is unpickleable because it's not in globals"
77
+
78
+ def __repr__(self) -> str:
79
+ return f'CantPickleThis{self.args!r}'
80
+
81
+ with setuptools.sandbox.ExceptionSaver() as saved_exc:
82
+ raise CantPickleThis('detail')
83
+
84
+ with pytest.raises(setuptools.sandbox.UnpickleableException) as caught:
85
+ saved_exc.resume()
86
+
87
+ assert str(caught.value) == "CantPickleThis('detail',)"
88
+
89
+ def test_unpickleable_exception_when_hiding_setuptools(self):
90
+ """
91
+ As revealed in #440, an infinite recursion can occur if an unpickleable
92
+ exception while setuptools is hidden. Ensure this doesn't happen.
93
+ """
94
+
95
+ class ExceptionUnderTest(Exception):
96
+ """
97
+ An unpickleable exception (not in globals).
98
+ """
99
+
100
+ with pytest.raises(setuptools.sandbox.UnpickleableException) as caught:
101
+ with setuptools.sandbox.save_modules():
102
+ setuptools.sandbox.hide_setuptools()
103
+ raise ExceptionUnderTest
104
+
105
+ (msg,) = caught.value.args
106
+ assert msg == 'ExceptionUnderTest()'
107
+
108
+ def test_sandbox_violation_raised_hiding_setuptools(self, tmpdir):
109
+ """
110
+ When in a sandbox with setuptools hidden, a SandboxViolation
111
+ should reflect a proper exception and not be wrapped in
112
+ an UnpickleableException.
113
+ """
114
+
115
+ def write_file():
116
+ "Trigger a SandboxViolation by writing outside the sandbox"
117
+ with open('/etc/foo', 'w', encoding="utf-8"):
118
+ pass
119
+
120
+ with pytest.raises(setuptools.sandbox.SandboxViolation) as caught:
121
+ with setuptools.sandbox.save_modules():
122
+ setuptools.sandbox.hide_setuptools()
123
+ with setuptools.sandbox.DirectorySandbox(str(tmpdir)):
124
+ write_file()
125
+
126
+ cmd, args, kwargs = caught.value.args
127
+ assert cmd == 'open'
128
+ assert args == ('/etc/foo', 'w')
129
+ assert kwargs == {"encoding": "utf-8"}
130
+
131
+ msg = str(caught.value)
132
+ assert 'open' in msg
133
+ assert "('/etc/foo', 'w')" in msg
134
+ assert "{'encoding': 'utf-8'}" in msg
.venv/lib/python3.12/site-packages/setuptools/tests/test_sdist.py ADDED
@@ -0,0 +1,984 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """sdist tests"""
2
+
3
+ import contextlib
4
+ import io
5
+ import logging
6
+ import os
7
+ import pathlib
8
+ import sys
9
+ import tarfile
10
+ import tempfile
11
+ import unicodedata
12
+ from inspect import cleandoc
13
+ from pathlib import Path
14
+ from unittest import mock
15
+
16
+ import jaraco.path
17
+ import pytest
18
+
19
+ from setuptools import Command, SetuptoolsDeprecationWarning
20
+ from setuptools._importlib import metadata
21
+ from setuptools.command.egg_info import manifest_maker
22
+ from setuptools.command.sdist import sdist
23
+ from setuptools.dist import Distribution
24
+ from setuptools.extension import Extension
25
+ from setuptools.tests import fail_on_ascii
26
+
27
+ from .text import Filenames
28
+
29
+ import distutils
30
+ from distutils.core import run_setup
31
+
32
+ SETUP_ATTRS = {
33
+ 'name': 'sdist_test',
34
+ 'version': '0.0',
35
+ 'packages': ['sdist_test'],
36
+ 'package_data': {'sdist_test': ['*.txt']},
37
+ 'data_files': [("data", [os.path.join("d", "e.dat")])],
38
+ }
39
+
40
+ SETUP_PY = f"""\
41
+ from setuptools import setup
42
+
43
+ setup(**{SETUP_ATTRS!r})
44
+ """
45
+
46
+ EXTENSION = Extension(
47
+ name="sdist_test.f",
48
+ sources=[os.path.join("sdist_test", "f.c")],
49
+ depends=[os.path.join("sdist_test", "f.h")],
50
+ )
51
+ EXTENSION_SOURCES = EXTENSION.sources + EXTENSION.depends
52
+
53
+
54
+ @contextlib.contextmanager
55
+ def quiet():
56
+ old_stdout, old_stderr = sys.stdout, sys.stderr
57
+ sys.stdout, sys.stderr = io.StringIO(), io.StringIO()
58
+ try:
59
+ yield
60
+ finally:
61
+ sys.stdout, sys.stderr = old_stdout, old_stderr
62
+
63
+
64
+ # Convert to POSIX path
65
+ def posix(path):
66
+ if not isinstance(path, str):
67
+ return path.replace(os.sep.encode('ascii'), b'/')
68
+ else:
69
+ return path.replace(os.sep, '/')
70
+
71
+
72
+ # HFS Plus uses decomposed UTF-8
73
+ def decompose(path):
74
+ if isinstance(path, str):
75
+ return unicodedata.normalize('NFD', path)
76
+ try:
77
+ path = path.decode('utf-8')
78
+ path = unicodedata.normalize('NFD', path)
79
+ path = path.encode('utf-8')
80
+ except UnicodeError:
81
+ pass # Not UTF-8
82
+ return path
83
+
84
+
85
+ def read_all_bytes(filename):
86
+ with open(filename, 'rb') as fp:
87
+ return fp.read()
88
+
89
+
90
+ def latin1_fail():
91
+ try:
92
+ desc, filename = tempfile.mkstemp(suffix=Filenames.latin_1)
93
+ os.close(desc)
94
+ os.remove(filename)
95
+ except Exception:
96
+ return True
97
+
98
+
99
+ fail_on_latin1_encoded_filenames = pytest.mark.xfail(
100
+ latin1_fail(),
101
+ reason="System does not support latin-1 filenames",
102
+ )
103
+
104
+
105
+ skip_under_xdist = pytest.mark.skipif(
106
+ "os.environ.get('PYTEST_XDIST_WORKER')",
107
+ reason="pytest-dev/pytest-xdist#843",
108
+ )
109
+ skip_under_stdlib_distutils = pytest.mark.skipif(
110
+ not distutils.__package__.startswith('setuptools'),
111
+ reason="the test is not supported with stdlib distutils",
112
+ )
113
+
114
+
115
+ def touch(path):
116
+ open(path, 'wb').close()
117
+ return path
118
+
119
+
120
+ def symlink_or_skip_test(src, dst):
121
+ try:
122
+ os.symlink(src, dst)
123
+ except (OSError, NotImplementedError):
124
+ pytest.skip("symlink not supported in OS")
125
+ return None
126
+ return dst
127
+
128
+
129
+ class TestSdistTest:
130
+ @pytest.fixture(autouse=True)
131
+ def source_dir(self, tmpdir):
132
+ tmpdir = tmpdir / "project_root"
133
+ tmpdir.mkdir()
134
+
135
+ (tmpdir / 'setup.py').write_text(SETUP_PY, encoding='utf-8')
136
+
137
+ # Set up the rest of the test package
138
+ test_pkg = tmpdir / 'sdist_test'
139
+ test_pkg.mkdir()
140
+ data_folder = tmpdir / 'd'
141
+ data_folder.mkdir()
142
+ # *.rst was not included in package_data, so c.rst should not be
143
+ # automatically added to the manifest when not under version control
144
+ for fname in ['__init__.py', 'a.txt', 'b.txt', 'c.rst']:
145
+ touch(test_pkg / fname)
146
+ touch(data_folder / 'e.dat')
147
+ # C sources are not included by default, but they will be,
148
+ # if an extension module uses them as sources or depends
149
+ for fname in EXTENSION_SOURCES:
150
+ touch(tmpdir / fname)
151
+
152
+ with tmpdir.as_cwd():
153
+ yield tmpdir
154
+
155
+ def assert_package_data_in_manifest(self, cmd):
156
+ manifest = cmd.filelist.files
157
+ assert os.path.join('sdist_test', 'a.txt') in manifest
158
+ assert os.path.join('sdist_test', 'b.txt') in manifest
159
+ assert os.path.join('sdist_test', 'c.rst') not in manifest
160
+ assert os.path.join('d', 'e.dat') in manifest
161
+
162
+ def setup_with_extension(self):
163
+ setup_attrs = {**SETUP_ATTRS, 'ext_modules': [EXTENSION]}
164
+
165
+ dist = Distribution(setup_attrs)
166
+ dist.script_name = 'setup.py'
167
+ cmd = sdist(dist)
168
+ cmd.ensure_finalized()
169
+
170
+ with quiet():
171
+ cmd.run()
172
+
173
+ return cmd
174
+
175
+ def test_package_data_in_sdist(self):
176
+ """Regression test for pull request #4: ensures that files listed in
177
+ package_data are included in the manifest even if they're not added to
178
+ version control.
179
+ """
180
+
181
+ dist = Distribution(SETUP_ATTRS)
182
+ dist.script_name = 'setup.py'
183
+ cmd = sdist(dist)
184
+ cmd.ensure_finalized()
185
+
186
+ with quiet():
187
+ cmd.run()
188
+
189
+ self.assert_package_data_in_manifest(cmd)
190
+
191
+ def test_package_data_and_include_package_data_in_sdist(self):
192
+ """
193
+ Ensure package_data and include_package_data work
194
+ together.
195
+ """
196
+ setup_attrs = {**SETUP_ATTRS, 'include_package_data': True}
197
+ assert setup_attrs['package_data']
198
+
199
+ dist = Distribution(setup_attrs)
200
+ dist.script_name = 'setup.py'
201
+ cmd = sdist(dist)
202
+ cmd.ensure_finalized()
203
+
204
+ with quiet():
205
+ cmd.run()
206
+
207
+ self.assert_package_data_in_manifest(cmd)
208
+
209
+ def test_extension_sources_in_sdist(self):
210
+ """
211
+ Ensure that the files listed in Extension.sources and Extension.depends
212
+ are automatically included in the manifest.
213
+ """
214
+ cmd = self.setup_with_extension()
215
+ self.assert_package_data_in_manifest(cmd)
216
+ manifest = cmd.filelist.files
217
+ for path in EXTENSION_SOURCES:
218
+ assert path in manifest
219
+
220
+ def test_missing_extension_sources(self):
221
+ """
222
+ Similar to test_extension_sources_in_sdist but the referenced files don't exist.
223
+ Missing files should not be included in distribution (with no error raised).
224
+ """
225
+ for path in EXTENSION_SOURCES:
226
+ os.remove(path)
227
+
228
+ cmd = self.setup_with_extension()
229
+ self.assert_package_data_in_manifest(cmd)
230
+ manifest = cmd.filelist.files
231
+ for path in EXTENSION_SOURCES:
232
+ assert path not in manifest
233
+
234
+ def test_symlinked_extension_sources(self):
235
+ """
236
+ Similar to test_extension_sources_in_sdist but the referenced files are
237
+ instead symbolic links to project-local files. Referenced file paths
238
+ should be included. Symlink targets themselves should NOT be included.
239
+ """
240
+ symlinked = []
241
+ for path in EXTENSION_SOURCES:
242
+ base, ext = os.path.splitext(path)
243
+ target = base + "_target." + ext
244
+
245
+ os.rename(path, target)
246
+ symlink_or_skip_test(os.path.basename(target), path)
247
+ symlinked.append(target)
248
+
249
+ cmd = self.setup_with_extension()
250
+ self.assert_package_data_in_manifest(cmd)
251
+ manifest = cmd.filelist.files
252
+ for path in EXTENSION_SOURCES:
253
+ assert path in manifest
254
+ for path in symlinked:
255
+ assert path not in manifest
256
+
257
+ _INVALID_PATHS = {
258
+ "must be relative": lambda: (
259
+ os.path.abspath(os.path.join("sdist_test", "f.h"))
260
+ ),
261
+ "can't have `..` segments": lambda: (
262
+ os.path.join("sdist_test", "..", "sdist_test", "f.h")
263
+ ),
264
+ "doesn't exist": lambda: (
265
+ os.path.join("sdist_test", "this_file_does_not_exist.h")
266
+ ),
267
+ "must be inside the project root": lambda: (
268
+ symlink_or_skip_test(
269
+ touch(os.path.join("..", "outside_of_project_root.h")),
270
+ "symlink.h",
271
+ )
272
+ ),
273
+ }
274
+
275
+ @skip_under_stdlib_distutils
276
+ @pytest.mark.parametrize("reason", _INVALID_PATHS.keys())
277
+ def test_invalid_extension_depends(self, reason, caplog):
278
+ """
279
+ Due to backwards compatibility reasons, `Extension.depends` should accept
280
+ invalid/weird paths, but then ignore them when building a sdist.
281
+
282
+ This test verifies that the source distribution is still built
283
+ successfully with such paths, but that instead of adding these paths to
284
+ the manifest, we emit an informational message, notifying the user that
285
+ the invalid path won't be automatically included.
286
+ """
287
+ invalid_path = self._INVALID_PATHS[reason]()
288
+ extension = Extension(
289
+ name="sdist_test.f",
290
+ sources=[],
291
+ depends=[invalid_path],
292
+ )
293
+ setup_attrs = {**SETUP_ATTRS, 'ext_modules': [extension]}
294
+
295
+ dist = Distribution(setup_attrs)
296
+ dist.script_name = 'setup.py'
297
+ cmd = sdist(dist)
298
+ cmd.ensure_finalized()
299
+
300
+ with quiet(), caplog.at_level(logging.INFO):
301
+ cmd.run()
302
+
303
+ self.assert_package_data_in_manifest(cmd)
304
+ manifest = cmd.filelist.files
305
+ assert invalid_path not in manifest
306
+
307
+ expected_message = [
308
+ message
309
+ for (logger, level, message) in caplog.record_tuples
310
+ if (
311
+ logger == "root" #
312
+ and level == logging.INFO #
313
+ and invalid_path in message #
314
+ )
315
+ ]
316
+ assert len(expected_message) == 1
317
+ (expected_message,) = expected_message
318
+ assert reason in expected_message
319
+
320
+ def test_custom_build_py(self):
321
+ """
322
+ Ensure projects defining custom build_py don't break
323
+ when creating sdists (issue #2849)
324
+ """
325
+ from distutils.command.build_py import build_py as OrigBuildPy
326
+
327
+ using_custom_command_guard = mock.Mock()
328
+
329
+ class CustomBuildPy(OrigBuildPy):
330
+ """
331
+ Some projects have custom commands inheriting from `distutils`
332
+ """
333
+
334
+ def get_data_files(self):
335
+ using_custom_command_guard()
336
+ return super().get_data_files()
337
+
338
+ setup_attrs = {**SETUP_ATTRS, 'include_package_data': True}
339
+ assert setup_attrs['package_data']
340
+
341
+ dist = Distribution(setup_attrs)
342
+ dist.script_name = 'setup.py'
343
+ cmd = sdist(dist)
344
+ cmd.ensure_finalized()
345
+
346
+ # Make sure we use the custom command
347
+ cmd.cmdclass = {'build_py': CustomBuildPy}
348
+ cmd.distribution.cmdclass = {'build_py': CustomBuildPy}
349
+ assert cmd.distribution.get_command_class('build_py') == CustomBuildPy
350
+
351
+ msg = "setuptools instead of distutils"
352
+ with quiet(), pytest.warns(SetuptoolsDeprecationWarning, match=msg):
353
+ cmd.run()
354
+
355
+ using_custom_command_guard.assert_called()
356
+ self.assert_package_data_in_manifest(cmd)
357
+
358
+ def test_setup_py_exists(self):
359
+ dist = Distribution(SETUP_ATTRS)
360
+ dist.script_name = 'foo.py'
361
+ cmd = sdist(dist)
362
+ cmd.ensure_finalized()
363
+
364
+ with quiet():
365
+ cmd.run()
366
+
367
+ manifest = cmd.filelist.files
368
+ assert 'setup.py' in manifest
369
+
370
+ def test_setup_py_missing(self):
371
+ dist = Distribution(SETUP_ATTRS)
372
+ dist.script_name = 'foo.py'
373
+ cmd = sdist(dist)
374
+ cmd.ensure_finalized()
375
+
376
+ if os.path.exists("setup.py"):
377
+ os.remove("setup.py")
378
+ with quiet():
379
+ cmd.run()
380
+
381
+ manifest = cmd.filelist.files
382
+ assert 'setup.py' not in manifest
383
+
384
+ def test_setup_py_excluded(self):
385
+ with open("MANIFEST.in", "w", encoding="utf-8") as manifest_file:
386
+ manifest_file.write("exclude setup.py")
387
+
388
+ dist = Distribution(SETUP_ATTRS)
389
+ dist.script_name = 'foo.py'
390
+ cmd = sdist(dist)
391
+ cmd.ensure_finalized()
392
+
393
+ with quiet():
394
+ cmd.run()
395
+
396
+ manifest = cmd.filelist.files
397
+ assert 'setup.py' not in manifest
398
+
399
+ def test_defaults_case_sensitivity(self, source_dir):
400
+ """
401
+ Make sure default files (README.*, etc.) are added in a case-sensitive
402
+ way to avoid problems with packages built on Windows.
403
+ """
404
+
405
+ touch(source_dir / 'readme.rst')
406
+ touch(source_dir / 'SETUP.cfg')
407
+
408
+ dist = Distribution(SETUP_ATTRS)
409
+ # the extension deliberately capitalized for this test
410
+ # to make sure the actual filename (not capitalized) gets added
411
+ # to the manifest
412
+ dist.script_name = 'setup.PY'
413
+ cmd = sdist(dist)
414
+ cmd.ensure_finalized()
415
+
416
+ with quiet():
417
+ cmd.run()
418
+
419
+ # lowercase all names so we can test in a
420
+ # case-insensitive way to make sure the files
421
+ # are not included.
422
+ manifest = map(lambda x: x.lower(), cmd.filelist.files)
423
+ assert 'readme.rst' not in manifest, manifest
424
+ assert 'setup.py' not in manifest, manifest
425
+ assert 'setup.cfg' not in manifest, manifest
426
+
427
+ def test_exclude_dev_only_cache_folders(self, source_dir):
428
+ included = {
429
+ # Emulate problem in https://github.com/pypa/setuptools/issues/4601
430
+ "MANIFEST.in": (
431
+ "global-include LICEN[CS]E* COPYING* NOTICE* AUTHORS*\n"
432
+ "global-include *.txt\n"
433
+ ),
434
+ # For the sake of being conservative and limiting unforeseen side-effects
435
+ # we just exclude dev-only cache folders at the root of the repository:
436
+ "test/.venv/lib/python3.9/site-packages/bar-2.dist-info/AUTHORS.rst": "",
437
+ "src/.nox/py/lib/python3.12/site-packages/bar-2.dist-info/COPYING.txt": "",
438
+ "doc/.tox/default/lib/python3.11/site-packages/foo-4.dist-info/LICENSE": "",
439
+ # Let's test against false positives with similarly named files:
440
+ ".venv-requirements.txt": "",
441
+ ".tox-coveragerc.txt": "",
442
+ ".noxy/coveragerc.txt": "",
443
+ }
444
+
445
+ excluded = {
446
+ # .tox/.nox/.venv are well-know folders present at the root of Python repos
447
+ # and therefore should be excluded
448
+ ".tox/release/lib/python3.11/site-packages/foo-4.dist-info/LICENSE": "",
449
+ ".nox/py/lib/python3.12/site-packages/bar-2.dist-info/COPYING.txt": "",
450
+ ".venv/lib/python3.9/site-packages/bar-2.dist-info/AUTHORS.rst": "",
451
+ }
452
+
453
+ for file, content in {**excluded, **included}.items():
454
+ Path(source_dir, file).parent.mkdir(parents=True, exist_ok=True)
455
+ Path(source_dir, file).write_text(content, encoding="utf-8")
456
+
457
+ cmd = self.setup_with_extension()
458
+ self.assert_package_data_in_manifest(cmd)
459
+ manifest = {f.replace(os.sep, '/') for f in cmd.filelist.files}
460
+ for path in excluded:
461
+ assert os.path.exists(path)
462
+ assert path not in manifest, (path, manifest)
463
+ for path in included:
464
+ assert os.path.exists(path)
465
+ assert path in manifest, (path, manifest)
466
+
467
+ @fail_on_ascii
468
+ def test_manifest_is_written_with_utf8_encoding(self):
469
+ # Test for #303.
470
+ dist = Distribution(SETUP_ATTRS)
471
+ dist.script_name = 'setup.py'
472
+ mm = manifest_maker(dist)
473
+ mm.manifest = os.path.join('sdist_test.egg-info', 'SOURCES.txt')
474
+ os.mkdir('sdist_test.egg-info')
475
+
476
+ # UTF-8 filename
477
+ filename = os.path.join('sdist_test', 'smörbröd.py')
478
+
479
+ # Must create the file or it will get stripped.
480
+ touch(filename)
481
+
482
+ # Add UTF-8 filename and write manifest
483
+ with quiet():
484
+ mm.run()
485
+ mm.filelist.append(filename)
486
+ mm.write_manifest()
487
+
488
+ contents = read_all_bytes(mm.manifest)
489
+
490
+ # The manifest should be UTF-8 encoded
491
+ u_contents = contents.decode('UTF-8')
492
+
493
+ # The manifest should contain the UTF-8 filename
494
+ assert posix(filename) in u_contents
495
+
496
+ @fail_on_ascii
497
+ def test_write_manifest_allows_utf8_filenames(self):
498
+ # Test for #303.
499
+ dist = Distribution(SETUP_ATTRS)
500
+ dist.script_name = 'setup.py'
501
+ mm = manifest_maker(dist)
502
+ mm.manifest = os.path.join('sdist_test.egg-info', 'SOURCES.txt')
503
+ os.mkdir('sdist_test.egg-info')
504
+
505
+ filename = os.path.join(b'sdist_test', Filenames.utf_8)
506
+
507
+ # Must touch the file or risk removal
508
+ touch(filename)
509
+
510
+ # Add filename and write manifest
511
+ with quiet():
512
+ mm.run()
513
+ u_filename = filename.decode('utf-8')
514
+ mm.filelist.files.append(u_filename)
515
+ # Re-write manifest
516
+ mm.write_manifest()
517
+
518
+ contents = read_all_bytes(mm.manifest)
519
+
520
+ # The manifest should be UTF-8 encoded
521
+ contents.decode('UTF-8')
522
+
523
+ # The manifest should contain the UTF-8 filename
524
+ assert posix(filename) in contents
525
+
526
+ # The filelist should have been updated as well
527
+ assert u_filename in mm.filelist.files
528
+
529
+ @skip_under_xdist
530
+ def test_write_manifest_skips_non_utf8_filenames(self):
531
+ """
532
+ Files that cannot be encoded to UTF-8 (specifically, those that
533
+ weren't originally successfully decoded and have surrogate
534
+ escapes) should be omitted from the manifest.
535
+ See https://bitbucket.org/tarek/distribute/issue/303 for history.
536
+ """
537
+ dist = Distribution(SETUP_ATTRS)
538
+ dist.script_name = 'setup.py'
539
+ mm = manifest_maker(dist)
540
+ mm.manifest = os.path.join('sdist_test.egg-info', 'SOURCES.txt')
541
+ os.mkdir('sdist_test.egg-info')
542
+
543
+ # Latin-1 filename
544
+ filename = os.path.join(b'sdist_test', Filenames.latin_1)
545
+
546
+ # Add filename with surrogates and write manifest
547
+ with quiet():
548
+ mm.run()
549
+ u_filename = filename.decode('utf-8', 'surrogateescape')
550
+ mm.filelist.append(u_filename)
551
+ # Re-write manifest
552
+ mm.write_manifest()
553
+
554
+ contents = read_all_bytes(mm.manifest)
555
+
556
+ # The manifest should be UTF-8 encoded
557
+ contents.decode('UTF-8')
558
+
559
+ # The Latin-1 filename should have been skipped
560
+ assert posix(filename) not in contents
561
+
562
+ # The filelist should have been updated as well
563
+ assert u_filename not in mm.filelist.files
564
+
565
+ @fail_on_ascii
566
+ def test_manifest_is_read_with_utf8_encoding(self):
567
+ # Test for #303.
568
+ dist = Distribution(SETUP_ATTRS)
569
+ dist.script_name = 'setup.py'
570
+ cmd = sdist(dist)
571
+ cmd.ensure_finalized()
572
+
573
+ # Create manifest
574
+ with quiet():
575
+ cmd.run()
576
+
577
+ # Add UTF-8 filename to manifest
578
+ filename = os.path.join(b'sdist_test', Filenames.utf_8)
579
+ cmd.manifest = os.path.join('sdist_test.egg-info', 'SOURCES.txt')
580
+ manifest = open(cmd.manifest, 'ab')
581
+ manifest.write(b'\n' + filename)
582
+ manifest.close()
583
+
584
+ # The file must exist to be included in the filelist
585
+ touch(filename)
586
+
587
+ # Re-read manifest
588
+ cmd.filelist.files = []
589
+ with quiet():
590
+ cmd.read_manifest()
591
+
592
+ # The filelist should contain the UTF-8 filename
593
+ filename = filename.decode('utf-8')
594
+ assert filename in cmd.filelist.files
595
+
596
+ @fail_on_latin1_encoded_filenames
597
+ def test_read_manifest_skips_non_utf8_filenames(self):
598
+ # Test for #303.
599
+ dist = Distribution(SETUP_ATTRS)
600
+ dist.script_name = 'setup.py'
601
+ cmd = sdist(dist)
602
+ cmd.ensure_finalized()
603
+
604
+ # Create manifest
605
+ with quiet():
606
+ cmd.run()
607
+
608
+ # Add Latin-1 filename to manifest
609
+ filename = os.path.join(b'sdist_test', Filenames.latin_1)
610
+ cmd.manifest = os.path.join('sdist_test.egg-info', 'SOURCES.txt')
611
+ manifest = open(cmd.manifest, 'ab')
612
+ manifest.write(b'\n' + filename)
613
+ manifest.close()
614
+
615
+ # The file must exist to be included in the filelist
616
+ touch(filename)
617
+
618
+ # Re-read manifest
619
+ cmd.filelist.files = []
620
+ with quiet():
621
+ cmd.read_manifest()
622
+
623
+ # The Latin-1 filename should have been skipped
624
+ filename = filename.decode('latin-1')
625
+ assert filename not in cmd.filelist.files
626
+
627
+ @fail_on_ascii
628
+ @fail_on_latin1_encoded_filenames
629
+ def test_sdist_with_utf8_encoded_filename(self):
630
+ # Test for #303.
631
+ dist = Distribution(self.make_strings(SETUP_ATTRS))
632
+ dist.script_name = 'setup.py'
633
+ cmd = sdist(dist)
634
+ cmd.ensure_finalized()
635
+
636
+ filename = os.path.join(b'sdist_test', Filenames.utf_8)
637
+ touch(filename)
638
+
639
+ with quiet():
640
+ cmd.run()
641
+
642
+ if sys.platform == 'darwin':
643
+ filename = decompose(filename)
644
+
645
+ fs_enc = sys.getfilesystemencoding()
646
+
647
+ if sys.platform == 'win32':
648
+ if fs_enc == 'cp1252':
649
+ # Python mangles the UTF-8 filename
650
+ filename = filename.decode('cp1252')
651
+ assert filename in cmd.filelist.files
652
+ else:
653
+ filename = filename.decode('mbcs')
654
+ assert filename in cmd.filelist.files
655
+ else:
656
+ filename = filename.decode('utf-8')
657
+ assert filename in cmd.filelist.files
658
+
659
+ @classmethod
660
+ def make_strings(cls, item):
661
+ if isinstance(item, dict):
662
+ return {key: cls.make_strings(value) for key, value in item.items()}
663
+ if isinstance(item, list):
664
+ return list(map(cls.make_strings, item))
665
+ return str(item)
666
+
667
+ @fail_on_latin1_encoded_filenames
668
+ @skip_under_xdist
669
+ def test_sdist_with_latin1_encoded_filename(self):
670
+ # Test for #303.
671
+ dist = Distribution(self.make_strings(SETUP_ATTRS))
672
+ dist.script_name = 'setup.py'
673
+ cmd = sdist(dist)
674
+ cmd.ensure_finalized()
675
+
676
+ # Latin-1 filename
677
+ filename = os.path.join(b'sdist_test', Filenames.latin_1)
678
+ touch(filename)
679
+ assert os.path.isfile(filename)
680
+
681
+ with quiet():
682
+ cmd.run()
683
+
684
+ # not all windows systems have a default FS encoding of cp1252
685
+ if sys.platform == 'win32':
686
+ # Latin-1 is similar to Windows-1252 however
687
+ # on mbcs filesys it is not in latin-1 encoding
688
+ fs_enc = sys.getfilesystemencoding()
689
+ if fs_enc != 'mbcs':
690
+ fs_enc = 'latin-1'
691
+ filename = filename.decode(fs_enc)
692
+
693
+ assert filename in cmd.filelist.files
694
+ else:
695
+ # The Latin-1 filename should have been skipped
696
+ filename = filename.decode('latin-1')
697
+ assert filename not in cmd.filelist.files
698
+
699
+ _EXAMPLE_DIRECTIVES = {
700
+ "setup.cfg - long_description and version": """
701
+ [metadata]
702
+ name = testing
703
+ version = file: src/VERSION.txt
704
+ license_files = DOWHATYOUWANT
705
+ long_description = file: README.rst, USAGE.rst
706
+ """,
707
+ "pyproject.toml - static readme/license files and dynamic version": """
708
+ [project]
709
+ name = "testing"
710
+ readme = "USAGE.rst"
711
+ license-files = ["DOWHATYOUWANT"]
712
+ dynamic = ["version"]
713
+ [tool.setuptools.dynamic]
714
+ version = {file = ["src/VERSION.txt"]}
715
+ """,
716
+ "pyproject.toml - directive with str instead of list": """
717
+ [project]
718
+ name = "testing"
719
+ readme = "USAGE.rst"
720
+ license-files = ["DOWHATYOUWANT"]
721
+ dynamic = ["version"]
722
+ [tool.setuptools.dynamic]
723
+ version = {file = "src/VERSION.txt"}
724
+ """,
725
+ "pyproject.toml - deprecated license table with file entry": """
726
+ [project]
727
+ name = "testing"
728
+ readme = "USAGE.rst"
729
+ license = {file = "DOWHATYOUWANT"}
730
+ dynamic = ["version"]
731
+ [tool.setuptools.dynamic]
732
+ version = {file = "src/VERSION.txt"}
733
+ """,
734
+ }
735
+
736
+ @pytest.mark.parametrize("config", _EXAMPLE_DIRECTIVES.keys())
737
+ @pytest.mark.filterwarnings(
738
+ "ignore:.project.license. as a TOML table is deprecated"
739
+ )
740
+ def test_add_files_referenced_by_config_directives(self, source_dir, config):
741
+ config_file, _, _ = config.partition(" - ")
742
+ config_text = self._EXAMPLE_DIRECTIVES[config]
743
+ (source_dir / 'src').mkdir()
744
+ (source_dir / 'src/VERSION.txt').write_text("0.42", encoding="utf-8")
745
+ (source_dir / 'README.rst').write_text("hello world!", encoding="utf-8")
746
+ (source_dir / 'USAGE.rst').write_text("hello world!", encoding="utf-8")
747
+ (source_dir / 'DOWHATYOUWANT').write_text("hello world!", encoding="utf-8")
748
+ (source_dir / config_file).write_text(config_text, encoding="utf-8")
749
+
750
+ dist = Distribution({"packages": []})
751
+ dist.script_name = 'setup.py'
752
+ dist.parse_config_files()
753
+
754
+ cmd = sdist(dist)
755
+ cmd.ensure_finalized()
756
+ with quiet():
757
+ cmd.run()
758
+
759
+ assert (
760
+ 'src/VERSION.txt' in cmd.filelist.files
761
+ or 'src\\VERSION.txt' in cmd.filelist.files
762
+ )
763
+ assert 'USAGE.rst' in cmd.filelist.files
764
+ assert 'DOWHATYOUWANT' in cmd.filelist.files
765
+ assert '/' not in cmd.filelist.files
766
+ assert '\\' not in cmd.filelist.files
767
+
768
+ def test_pyproject_toml_in_sdist(self, source_dir):
769
+ """
770
+ Check if pyproject.toml is included in source distribution if present
771
+ """
772
+ touch(source_dir / 'pyproject.toml')
773
+ dist = Distribution(SETUP_ATTRS)
774
+ dist.script_name = 'setup.py'
775
+ cmd = sdist(dist)
776
+ cmd.ensure_finalized()
777
+ with quiet():
778
+ cmd.run()
779
+ manifest = cmd.filelist.files
780
+ assert 'pyproject.toml' in manifest
781
+
782
+ def test_pyproject_toml_excluded(self, source_dir):
783
+ """
784
+ Check that pyproject.toml can excluded even if present
785
+ """
786
+ touch(source_dir / 'pyproject.toml')
787
+ with open('MANIFEST.in', 'w', encoding="utf-8") as mts:
788
+ print('exclude pyproject.toml', file=mts)
789
+ dist = Distribution(SETUP_ATTRS)
790
+ dist.script_name = 'setup.py'
791
+ cmd = sdist(dist)
792
+ cmd.ensure_finalized()
793
+ with quiet():
794
+ cmd.run()
795
+ manifest = cmd.filelist.files
796
+ assert 'pyproject.toml' not in manifest
797
+
798
+ def test_build_subcommand_source_files(self, source_dir):
799
+ touch(source_dir / '.myfile~')
800
+
801
+ # Sanity check: without custom commands file list should not be affected
802
+ dist = Distribution({**SETUP_ATTRS, "script_name": "setup.py"})
803
+ cmd = sdist(dist)
804
+ cmd.ensure_finalized()
805
+ with quiet():
806
+ cmd.run()
807
+ manifest = cmd.filelist.files
808
+ assert '.myfile~' not in manifest
809
+
810
+ # Test: custom command should be able to augment file list
811
+ dist = Distribution({**SETUP_ATTRS, "script_name": "setup.py"})
812
+ build = dist.get_command_obj("build")
813
+ build.sub_commands = [*build.sub_commands, ("build_custom", None)]
814
+
815
+ class build_custom(Command):
816
+ def initialize_options(self): ...
817
+
818
+ def finalize_options(self): ...
819
+
820
+ def run(self): ...
821
+
822
+ def get_source_files(self):
823
+ return ['.myfile~']
824
+
825
+ dist.cmdclass.update(build_custom=build_custom)
826
+
827
+ cmd = sdist(dist)
828
+ cmd.use_defaults = True
829
+ cmd.ensure_finalized()
830
+ with quiet():
831
+ cmd.run()
832
+ manifest = cmd.filelist.files
833
+ assert '.myfile~' in manifest
834
+
835
+ @pytest.mark.skipif("os.environ.get('SETUPTOOLS_USE_DISTUTILS') == 'stdlib'")
836
+ def test_build_base_pathlib(self, source_dir):
837
+ """
838
+ Ensure if build_base is a pathlib.Path, the build still succeeds.
839
+ """
840
+ dist = Distribution({
841
+ **SETUP_ATTRS,
842
+ "script_name": "setup.py",
843
+ "options": {"build": {"build_base": pathlib.Path('build')}},
844
+ })
845
+ cmd = sdist(dist)
846
+ cmd.ensure_finalized()
847
+ with quiet():
848
+ cmd.run()
849
+
850
+
851
+ def test_default_revctrl():
852
+ """
853
+ When _default_revctrl was removed from the `setuptools.command.sdist`
854
+ module in 10.0, it broke some systems which keep an old install of
855
+ setuptools (Distribute) around. Those old versions require that the
856
+ setuptools package continue to implement that interface, so this
857
+ function provides that interface, stubbed. See #320 for details.
858
+
859
+ This interface must be maintained until Ubuntu 12.04 is no longer
860
+ supported (by Setuptools).
861
+ """
862
+ (ep,) = metadata.EntryPoints._from_text(
863
+ """
864
+ [setuptools.file_finders]
865
+ svn_cvs = setuptools.command.sdist:_default_revctrl
866
+ """
867
+ )
868
+ res = ep.load()
869
+ assert hasattr(res, '__iter__')
870
+
871
+
872
+ class TestRegressions:
873
+ """
874
+ Can be removed/changed if the project decides to change how it handles symlinks
875
+ or external files.
876
+ """
877
+
878
+ @staticmethod
879
+ def files_for_symlink_in_extension_depends(tmp_path, dep_path):
880
+ return {
881
+ "external": {
882
+ "dir": {"file.h": ""},
883
+ },
884
+ "project": {
885
+ "setup.py": cleandoc(
886
+ f"""
887
+ from setuptools import Extension, setup
888
+ setup(
889
+ name="myproj",
890
+ version="42",
891
+ ext_modules=[
892
+ Extension(
893
+ "hello", sources=["hello.pyx"],
894
+ depends=[{dep_path!r}]
895
+ )
896
+ ],
897
+ )
898
+ """
899
+ ),
900
+ "hello.pyx": "",
901
+ "MANIFEST.in": "global-include *.h",
902
+ },
903
+ }
904
+
905
+ @pytest.mark.parametrize(
906
+ "dep_path", ("myheaders/dir/file.h", "myheaders/dir/../dir/file.h")
907
+ )
908
+ def test_symlink_in_extension_depends(self, monkeypatch, tmp_path, dep_path):
909
+ # Given a project with a symlinked dir and a "depends" targeting that dir
910
+ files = self.files_for_symlink_in_extension_depends(tmp_path, dep_path)
911
+ jaraco.path.build(files, prefix=str(tmp_path))
912
+ symlink_or_skip_test(tmp_path / "external", tmp_path / "project/myheaders")
913
+
914
+ # When `sdist` runs, there should be no error
915
+ members = run_sdist(monkeypatch, tmp_path / "project")
916
+ # and the sdist should contain the symlinked files
917
+ for expected in (
918
+ "myproj-42/hello.pyx",
919
+ "myproj-42/myheaders/dir/file.h",
920
+ ):
921
+ assert expected in members
922
+
923
+ @staticmethod
924
+ def files_for_external_path_in_extension_depends(tmp_path, dep_path):
925
+ head, _, tail = dep_path.partition("$tmp_path$/")
926
+ dep_path = tmp_path / tail if tail else head
927
+
928
+ return {
929
+ "external": {
930
+ "dir": {"file.h": ""},
931
+ },
932
+ "project": {
933
+ "setup.py": cleandoc(
934
+ f"""
935
+ from setuptools import Extension, setup
936
+ setup(
937
+ name="myproj",
938
+ version="42",
939
+ ext_modules=[
940
+ Extension(
941
+ "hello", sources=["hello.pyx"],
942
+ depends=[{str(dep_path)!r}]
943
+ )
944
+ ],
945
+ )
946
+ """
947
+ ),
948
+ "hello.pyx": "",
949
+ "MANIFEST.in": "global-include *.h",
950
+ },
951
+ }
952
+
953
+ @pytest.mark.parametrize(
954
+ "dep_path", ("$tmp_path$/external/dir/file.h", "../external/dir/file.h")
955
+ )
956
+ def test_external_path_in_extension_depends(self, monkeypatch, tmp_path, dep_path):
957
+ # Given a project with a "depends" targeting an external dir
958
+ files = self.files_for_external_path_in_extension_depends(tmp_path, dep_path)
959
+ jaraco.path.build(files, prefix=str(tmp_path))
960
+ # When `sdist` runs, there should be no error
961
+ members = run_sdist(monkeypatch, tmp_path / "project")
962
+ # and the sdist should not contain the external file
963
+ for name in members:
964
+ assert "file.h" not in name
965
+
966
+
967
+ def run_sdist(monkeypatch, project):
968
+ """Given a project directory, run the sdist and return its contents"""
969
+ monkeypatch.chdir(project)
970
+ with quiet():
971
+ run_setup("setup.py", ["sdist"])
972
+
973
+ archive = next((project / "dist").glob("*.tar.gz"))
974
+ with tarfile.open(str(archive)) as tar:
975
+ return set(tar.getnames())
976
+
977
+
978
+ def test_sanity_check_setuptools_own_sdist(setuptools_sdist):
979
+ with tarfile.open(setuptools_sdist) as tar:
980
+ files = tar.getnames()
981
+
982
+ # setuptools sdist should not include the .tox folder
983
+ tox_files = [name for name in files if ".tox" in name]
984
+ assert len(tox_files) == 0, f"not empty {tox_files}"
.venv/lib/python3.12/site-packages/setuptools/tests/test_setopt.py ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import configparser
2
+
3
+ from setuptools.command import setopt
4
+
5
+
6
+ class TestEdit:
7
+ @staticmethod
8
+ def parse_config(filename):
9
+ parser = configparser.ConfigParser()
10
+ with open(filename, encoding='utf-8') as reader:
11
+ parser.read_file(reader)
12
+ return parser
13
+
14
+ @staticmethod
15
+ def write_text(file, content):
16
+ with open(file, 'wb') as strm:
17
+ strm.write(content.encode('utf-8'))
18
+
19
+ def test_utf8_encoding_retained(self, tmpdir):
20
+ """
21
+ When editing a file, non-ASCII characters encoded in
22
+ UTF-8 should be retained.
23
+ """
24
+ config = tmpdir.join('setup.cfg')
25
+ self.write_text(str(config), '[names]\njaraco=джарако')
26
+ setopt.edit_config(str(config), dict(names=dict(other='yes')))
27
+ parser = self.parse_config(str(config))
28
+ assert parser.get('names', 'jaraco') == 'джарако'
29
+ assert parser.get('names', 'other') == 'yes'
30
+
31
+ def test_case_retained(self, tmpdir):
32
+ """
33
+ When editing a file, case of keys should be retained.
34
+ """
35
+ config = tmpdir.join('setup.cfg')
36
+ self.write_text(str(config), '[names]\nFoO=bAr')
37
+ setopt.edit_config(str(config), dict(names=dict(oTher='yes')))
38
+ actual = config.read_text(encoding='ascii')
39
+ assert 'FoO' in actual
40
+ assert 'oTher' in actual
.venv/lib/python3.12/site-packages/setuptools/tests/test_setuptools.py ADDED
@@ -0,0 +1,290 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Tests for the 'setuptools' package"""
2
+
3
+ import os
4
+ import re
5
+ import sys
6
+ from zipfile import ZipFile
7
+
8
+ import pytest
9
+ from packaging.version import Version
10
+
11
+ import setuptools
12
+ import setuptools.depends as dep
13
+ import setuptools.dist
14
+ from setuptools.depends import Require
15
+
16
+ import distutils.cmd
17
+ import distutils.core
18
+ from distutils.core import Extension
19
+ from distutils.errors import DistutilsSetupError
20
+
21
+
22
+ @pytest.fixture(autouse=True)
23
+ def isolated_dir(tmpdir_cwd):
24
+ return
25
+
26
+
27
+ def makeSetup(**args):
28
+ """Return distribution from 'setup(**args)', without executing commands"""
29
+
30
+ distutils.core._setup_stop_after = "commandline"
31
+
32
+ # Don't let system command line leak into tests!
33
+ args.setdefault('script_args', ['install'])
34
+
35
+ try:
36
+ return setuptools.setup(**args)
37
+ finally:
38
+ distutils.core._setup_stop_after = None
39
+
40
+
41
+ needs_bytecode = pytest.mark.skipif(
42
+ not hasattr(dep, 'get_module_constant'),
43
+ reason="bytecode support not available",
44
+ )
45
+
46
+
47
+ class TestDepends:
48
+ def testExtractConst(self):
49
+ if not hasattr(dep, 'extract_constant'):
50
+ # skip on non-bytecode platforms
51
+ return
52
+
53
+ def f1():
54
+ global x, y, z
55
+ x = "test"
56
+ y = z # pyright: ignore[reportUnboundVariable] # Explicitly testing for this runtime issue
57
+
58
+ fc = f1.__code__
59
+
60
+ # unrecognized name
61
+ assert dep.extract_constant(fc, 'q', -1) is None
62
+
63
+ # constant assigned
64
+ assert dep.extract_constant(fc, 'x', -1) == "test"
65
+
66
+ # expression assigned
67
+ assert dep.extract_constant(fc, 'y', -1) == -1
68
+
69
+ # recognized name, not assigned
70
+ assert dep.extract_constant(fc, 'z', -1) is None
71
+
72
+ def testFindModule(self):
73
+ with pytest.raises(ImportError):
74
+ dep.find_module('no-such.-thing')
75
+ with pytest.raises(ImportError):
76
+ dep.find_module('setuptools.non-existent')
77
+ f, _p, _i = dep.find_module('setuptools.tests')
78
+ f.close()
79
+
80
+ @needs_bytecode
81
+ def testModuleExtract(self):
82
+ from json import __version__
83
+
84
+ assert dep.get_module_constant('json', '__version__') == __version__
85
+ assert dep.get_module_constant('sys', 'version') == sys.version
86
+ assert (
87
+ dep.get_module_constant('setuptools.tests.test_setuptools', '__doc__')
88
+ == __doc__
89
+ )
90
+
91
+ @needs_bytecode
92
+ def testRequire(self):
93
+ req = Require('Json', '1.0.3', 'json')
94
+
95
+ assert req.name == 'Json'
96
+ assert req.module == 'json'
97
+ assert req.requested_version == Version('1.0.3')
98
+ assert req.attribute == '__version__'
99
+ assert req.full_name() == 'Json-1.0.3'
100
+
101
+ from json import __version__
102
+
103
+ assert str(req.get_version()) == __version__
104
+ assert req.version_ok('1.0.9')
105
+ assert not req.version_ok('0.9.1')
106
+ assert not req.version_ok('unknown')
107
+
108
+ assert req.is_present()
109
+ assert req.is_current()
110
+
111
+ req = Require('Do-what-I-mean', '1.0', 'd-w-i-m')
112
+ assert not req.is_present()
113
+ assert not req.is_current()
114
+
115
+ @needs_bytecode
116
+ def test_require_present(self):
117
+ # In #1896, this test was failing for months with the only
118
+ # complaint coming from test runners (not end users).
119
+ # TODO: Evaluate if this code is needed at all.
120
+ req = Require('Tests', None, 'tests', homepage="http://example.com")
121
+ assert req.format is None
122
+ assert req.attribute is None
123
+ assert req.requested_version is None
124
+ assert req.full_name() == 'Tests'
125
+ assert req.homepage == 'http://example.com'
126
+
127
+ from setuptools.tests import __path__
128
+
129
+ paths = [os.path.dirname(p) for p in __path__]
130
+ assert req.is_present(paths)
131
+ assert req.is_current(paths)
132
+
133
+
134
+ class TestDistro:
135
+ def setup_method(self, method):
136
+ self.e1 = Extension('bar.ext', ['bar.c'])
137
+ self.e2 = Extension('c.y', ['y.c'])
138
+
139
+ self.dist = makeSetup(
140
+ packages=['a', 'a.b', 'a.b.c', 'b', 'c'],
141
+ py_modules=['b.d', 'x'],
142
+ ext_modules=(self.e1, self.e2),
143
+ package_dir={},
144
+ )
145
+
146
+ def testDistroType(self):
147
+ assert isinstance(self.dist, setuptools.dist.Distribution)
148
+
149
+ def testExcludePackage(self):
150
+ self.dist.exclude_package('a')
151
+ assert self.dist.packages == ['b', 'c']
152
+
153
+ self.dist.exclude_package('b')
154
+ assert self.dist.packages == ['c']
155
+ assert self.dist.py_modules == ['x']
156
+ assert self.dist.ext_modules == [self.e1, self.e2]
157
+
158
+ self.dist.exclude_package('c')
159
+ assert self.dist.packages == []
160
+ assert self.dist.py_modules == ['x']
161
+ assert self.dist.ext_modules == [self.e1]
162
+
163
+ # test removals from unspecified options
164
+ makeSetup().exclude_package('x')
165
+
166
+ def testIncludeExclude(self):
167
+ # remove an extension
168
+ self.dist.exclude(ext_modules=[self.e1])
169
+ assert self.dist.ext_modules == [self.e2]
170
+
171
+ # add it back in
172
+ self.dist.include(ext_modules=[self.e1])
173
+ assert self.dist.ext_modules == [self.e2, self.e1]
174
+
175
+ # should not add duplicate
176
+ self.dist.include(ext_modules=[self.e1])
177
+ assert self.dist.ext_modules == [self.e2, self.e1]
178
+
179
+ def testExcludePackages(self):
180
+ self.dist.exclude(packages=['c', 'b', 'a'])
181
+ assert self.dist.packages == []
182
+ assert self.dist.py_modules == ['x']
183
+ assert self.dist.ext_modules == [self.e1]
184
+
185
+ def testEmpty(self):
186
+ dist = makeSetup()
187
+ dist.include(packages=['a'], py_modules=['b'], ext_modules=[self.e2])
188
+ dist = makeSetup()
189
+ dist.exclude(packages=['a'], py_modules=['b'], ext_modules=[self.e2])
190
+
191
+ def testContents(self):
192
+ assert self.dist.has_contents_for('a')
193
+ self.dist.exclude_package('a')
194
+ assert not self.dist.has_contents_for('a')
195
+
196
+ assert self.dist.has_contents_for('b')
197
+ self.dist.exclude_package('b')
198
+ assert not self.dist.has_contents_for('b')
199
+
200
+ assert self.dist.has_contents_for('c')
201
+ self.dist.exclude_package('c')
202
+ assert not self.dist.has_contents_for('c')
203
+
204
+ def testInvalidIncludeExclude(self):
205
+ with pytest.raises(DistutilsSetupError):
206
+ self.dist.include(nonexistent_option='x')
207
+ with pytest.raises(DistutilsSetupError):
208
+ self.dist.exclude(nonexistent_option='x')
209
+ with pytest.raises(DistutilsSetupError):
210
+ self.dist.include(packages={'x': 'y'})
211
+ with pytest.raises(DistutilsSetupError):
212
+ self.dist.exclude(packages={'x': 'y'})
213
+ with pytest.raises(DistutilsSetupError):
214
+ self.dist.include(ext_modules={'x': 'y'})
215
+ with pytest.raises(DistutilsSetupError):
216
+ self.dist.exclude(ext_modules={'x': 'y'})
217
+
218
+ with pytest.raises(DistutilsSetupError):
219
+ self.dist.include(package_dir=['q'])
220
+ with pytest.raises(DistutilsSetupError):
221
+ self.dist.exclude(package_dir=['q'])
222
+
223
+
224
+ @pytest.fixture
225
+ def example_source(tmpdir):
226
+ tmpdir.mkdir('foo')
227
+ (tmpdir / 'foo/bar.py').write('')
228
+ (tmpdir / 'readme.txt').write('')
229
+ return tmpdir
230
+
231
+
232
+ def test_findall(example_source):
233
+ found = list(setuptools.findall(str(example_source)))
234
+ expected = ['readme.txt', 'foo/bar.py']
235
+ expected = [example_source.join(fn) for fn in expected]
236
+ assert found == expected
237
+
238
+
239
+ def test_findall_curdir(example_source):
240
+ with example_source.as_cwd():
241
+ found = list(setuptools.findall())
242
+ expected = ['readme.txt', os.path.join('foo', 'bar.py')]
243
+ assert found == expected
244
+
245
+
246
+ @pytest.fixture
247
+ def can_symlink(tmpdir):
248
+ """
249
+ Skip if cannot create a symbolic link
250
+ """
251
+ link_fn = 'link'
252
+ target_fn = 'target'
253
+ try:
254
+ os.symlink(target_fn, link_fn)
255
+ except (OSError, NotImplementedError, AttributeError):
256
+ pytest.skip("Cannot create symbolic links")
257
+ os.remove(link_fn)
258
+
259
+
260
+ @pytest.mark.usefixtures("can_symlink")
261
+ def test_findall_missing_symlink(tmpdir):
262
+ with tmpdir.as_cwd():
263
+ os.symlink('foo', 'bar')
264
+ found = list(setuptools.findall())
265
+ assert found == []
266
+
267
+
268
+ @pytest.mark.xfail(reason="unable to exclude tests; #4475 #3260")
269
+ def test_its_own_wheel_does_not_contain_tests(setuptools_wheel):
270
+ with ZipFile(setuptools_wheel) as zipfile:
271
+ contents = [f.replace(os.sep, '/') for f in zipfile.namelist()]
272
+
273
+ for member in contents:
274
+ assert '/tests/' not in member
275
+
276
+
277
+ def test_wheel_includes_cli_scripts(setuptools_wheel):
278
+ with ZipFile(setuptools_wheel) as zipfile:
279
+ contents = [f.replace(os.sep, '/') for f in zipfile.namelist()]
280
+
281
+ assert any('cli-64.exe' in member for member in contents)
282
+
283
+
284
+ def test_wheel_includes_vendored_metadata(setuptools_wheel):
285
+ with ZipFile(setuptools_wheel) as zipfile:
286
+ contents = [f.replace(os.sep, '/') for f in zipfile.namelist()]
287
+
288
+ assert any(
289
+ re.search(r'_vendor/.*\.dist-info/METADATA', member) for member in contents
290
+ )
.venv/lib/python3.12/site-packages/setuptools/tests/test_shutil_wrapper.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import stat
2
+ import sys
3
+ from unittest.mock import Mock
4
+
5
+ from setuptools import _shutil
6
+
7
+
8
+ def test_rmtree_readonly(monkeypatch, tmp_path):
9
+ """Verify onerr works as expected"""
10
+
11
+ tmp_dir = tmp_path / "with_readonly"
12
+ tmp_dir.mkdir()
13
+ some_file = tmp_dir.joinpath("file.txt")
14
+ some_file.touch()
15
+ some_file.chmod(stat.S_IREAD)
16
+
17
+ expected_count = 1 if sys.platform.startswith("win") else 0
18
+ chmod_fn = Mock(wraps=_shutil.attempt_chmod_verbose)
19
+ monkeypatch.setattr(_shutil, "attempt_chmod_verbose", chmod_fn)
20
+
21
+ _shutil.rmtree(tmp_dir)
22
+ assert chmod_fn.call_count == expected_count
23
+ assert not tmp_dir.is_dir()
.venv/lib/python3.12/site-packages/setuptools/tests/test_unicode_utils.py ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ from setuptools import unicode_utils
2
+
3
+
4
+ def test_filesys_decode_fs_encoding_is_None(monkeypatch):
5
+ """
6
+ Test filesys_decode does not raise TypeError when
7
+ getfilesystemencoding returns None.
8
+ """
9
+ monkeypatch.setattr('sys.getfilesystemencoding', lambda: None)
10
+ unicode_utils.filesys_decode(b'test')
.venv/lib/python3.12/site-packages/setuptools/tests/test_virtualenv.py ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import subprocess
3
+ import sys
4
+ from urllib.error import URLError
5
+ from urllib.request import urlopen
6
+
7
+ import pytest
8
+
9
+
10
+ @pytest.fixture(autouse=True)
11
+ def pytest_virtualenv_works(venv):
12
+ """
13
+ pytest_virtualenv may not work. if it doesn't, skip these
14
+ tests. See #1284.
15
+ """
16
+ venv_prefix = venv.run(["python", "-c", "import sys; print(sys.prefix)"]).strip()
17
+ if venv_prefix == sys.prefix:
18
+ pytest.skip("virtualenv is broken (see pypa/setuptools#1284)")
19
+
20
+
21
+ def test_clean_env_install(venv_without_setuptools, setuptools_wheel):
22
+ """
23
+ Check setuptools can be installed in a clean environment.
24
+ """
25
+ cmd = ["python", "-m", "pip", "install", str(setuptools_wheel)]
26
+ venv_without_setuptools.run(cmd)
27
+
28
+
29
+ def access_pypi():
30
+ # Detect if tests are being run without connectivity
31
+ if not os.environ.get('NETWORK_REQUIRED', False): # pragma: nocover
32
+ try:
33
+ urlopen('https://pypi.org', timeout=1)
34
+ except URLError:
35
+ # No network, disable most of these tests
36
+ return False
37
+
38
+ return True
39
+
40
+
41
+ @pytest.mark.skipif(
42
+ 'platform.python_implementation() == "PyPy"',
43
+ reason="https://github.com/pypa/setuptools/pull/2865#issuecomment-965834995",
44
+ )
45
+ @pytest.mark.skipif(not access_pypi(), reason="no network")
46
+ # ^-- Even when it is not necessary to install a different version of `pip`
47
+ # the build process will still try to download `wheel`, see #3147 and #2986.
48
+ @pytest.mark.parametrize(
49
+ 'pip_version',
50
+ [
51
+ None,
52
+ pytest.param(
53
+ 'pip<20.1',
54
+ marks=pytest.mark.xfail(
55
+ 'sys.version_info >= (3, 12)',
56
+ reason="pip 23.1.2 required for Python 3.12 and later",
57
+ ),
58
+ ),
59
+ pytest.param(
60
+ 'pip<21',
61
+ marks=pytest.mark.xfail(
62
+ 'sys.version_info >= (3, 12)',
63
+ reason="pip 23.1.2 required for Python 3.12 and later",
64
+ ),
65
+ ),
66
+ pytest.param(
67
+ 'pip<22',
68
+ marks=pytest.mark.xfail(
69
+ 'sys.version_info >= (3, 12)',
70
+ reason="pip 23.1.2 required for Python 3.12 and later",
71
+ ),
72
+ ),
73
+ pytest.param(
74
+ 'pip<23',
75
+ marks=pytest.mark.xfail(
76
+ 'sys.version_info >= (3, 12)',
77
+ reason="pip 23.1.2 required for Python 3.12 and later",
78
+ ),
79
+ ),
80
+ pytest.param(
81
+ 'https://github.com/pypa/pip/archive/main.zip',
82
+ marks=pytest.mark.xfail(reason='#2975'),
83
+ ),
84
+ ],
85
+ )
86
+ def test_pip_upgrade_from_source(
87
+ pip_version, venv_without_setuptools, setuptools_wheel, setuptools_sdist
88
+ ):
89
+ """
90
+ Check pip can upgrade setuptools from source.
91
+ """
92
+ # Install pip/wheel, in a venv without setuptools (as it
93
+ # should not be needed for bootstrapping from source)
94
+ venv = venv_without_setuptools
95
+ venv.run(["pip", "install", "-U", "wheel"])
96
+ if pip_version is not None:
97
+ venv.run(["python", "-m", "pip", "install", "-U", pip_version, "--retries=1"])
98
+ with pytest.raises(subprocess.CalledProcessError):
99
+ # Meta-test to make sure setuptools is not installed
100
+ venv.run(["python", "-c", "import setuptools"])
101
+
102
+ # Then install from wheel.
103
+ venv.run(["pip", "install", str(setuptools_wheel)])
104
+ # And finally try to upgrade from source.
105
+ venv.run(["pip", "install", "--no-cache-dir", "--upgrade", str(setuptools_sdist)])
106
+
107
+
108
+ def test_no_missing_dependencies(bare_venv, request):
109
+ """
110
+ Quick and dirty test to ensure all external dependencies are vendored.
111
+ """
112
+ setuptools_dir = request.config.rootdir
113
+ bare_venv.run(['python', 'setup.py', '--help'], cwd=setuptools_dir)
.venv/lib/python3.12/site-packages/setuptools/tests/test_warnings.py ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from inspect import cleandoc
2
+
3
+ import pytest
4
+
5
+ from setuptools.warnings import SetuptoolsDeprecationWarning, SetuptoolsWarning
6
+
7
+ _EXAMPLES = {
8
+ "default": dict(
9
+ args=("Hello {x}", "\n\t{target} {v:.1f}"),
10
+ kwargs={"x": 5, "v": 3, "target": "World"},
11
+ expected="""
12
+ Hello 5
13
+ !!
14
+
15
+ ********************************************************************************
16
+ World 3.0
17
+ ********************************************************************************
18
+
19
+ !!
20
+ """,
21
+ ),
22
+ "futue_due_date": dict(
23
+ args=("Summary", "Lorem ipsum"),
24
+ kwargs={"due_date": (9999, 11, 22)},
25
+ expected="""
26
+ Summary
27
+ !!
28
+
29
+ ********************************************************************************
30
+ Lorem ipsum
31
+
32
+ By 9999-Nov-22, you need to update your project and remove deprecated calls
33
+ or your builds will no longer be supported.
34
+ ********************************************************************************
35
+
36
+ !!
37
+ """,
38
+ ),
39
+ "past_due_date_with_docs": dict(
40
+ args=("Summary", "Lorem ipsum"),
41
+ kwargs={"due_date": (2000, 11, 22), "see_docs": "some_page.html"},
42
+ expected="""
43
+ Summary
44
+ !!
45
+
46
+ ********************************************************************************
47
+ Lorem ipsum
48
+
49
+ This deprecation is overdue, please update your project and remove deprecated
50
+ calls to avoid build errors in the future.
51
+
52
+ See https://setuptools.pypa.io/en/latest/some_page.html for details.
53
+ ********************************************************************************
54
+
55
+ !!
56
+ """,
57
+ ),
58
+ }
59
+
60
+
61
+ @pytest.mark.parametrize("example_name", _EXAMPLES.keys())
62
+ def test_formatting(monkeypatch, example_name):
63
+ """
64
+ It should automatically handle indentation, interpolation and things like due date.
65
+ """
66
+ args = _EXAMPLES[example_name]["args"]
67
+ kwargs = _EXAMPLES[example_name]["kwargs"]
68
+ expected = _EXAMPLES[example_name]["expected"]
69
+
70
+ monkeypatch.setenv("SETUPTOOLS_ENFORCE_DEPRECATION", "false")
71
+ with pytest.warns(SetuptoolsWarning) as warn_info:
72
+ SetuptoolsWarning.emit(*args, **kwargs)
73
+ assert _get_message(warn_info) == cleandoc(expected)
74
+
75
+
76
+ def test_due_date_enforcement(monkeypatch):
77
+ class _MyDeprecation(SetuptoolsDeprecationWarning):
78
+ _SUMMARY = "Summary"
79
+ _DETAILS = "Lorem ipsum"
80
+ _DUE_DATE = (2000, 11, 22)
81
+ _SEE_DOCS = "some_page.html"
82
+
83
+ monkeypatch.setenv("SETUPTOOLS_ENFORCE_DEPRECATION", "true")
84
+ with pytest.raises(SetuptoolsDeprecationWarning) as exc_info:
85
+ _MyDeprecation.emit()
86
+
87
+ expected = """
88
+ Summary
89
+ !!
90
+
91
+ ********************************************************************************
92
+ Lorem ipsum
93
+
94
+ This deprecation is overdue, please update your project and remove deprecated
95
+ calls to avoid build errors in the future.
96
+
97
+ See https://setuptools.pypa.io/en/latest/some_page.html for details.
98
+ ********************************************************************************
99
+
100
+ !!
101
+ """
102
+ assert str(exc_info.value) == cleandoc(expected)
103
+
104
+
105
+ def _get_message(warn_info):
106
+ return next(warn.message.args[0] for warn in warn_info)
.venv/lib/python3.12/site-packages/setuptools/tests/test_wheel.py ADDED
@@ -0,0 +1,714 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """wheel tests"""
2
+
3
+ from __future__ import annotations
4
+
5
+ import contextlib
6
+ import glob
7
+ import inspect
8
+ import os
9
+ import pathlib
10
+ import shutil
11
+ import stat
12
+ import subprocess
13
+ import sys
14
+ import zipfile
15
+ from typing import Any
16
+
17
+ import pytest
18
+ from jaraco import path
19
+ from packaging.tags import parse_tag
20
+ from packaging.utils import canonicalize_name
21
+
22
+ from pkg_resources import PY_MAJOR, Distribution, PathMetadata
23
+ from setuptools.wheel import Wheel
24
+
25
+ from .contexts import tempdir
26
+ from .textwrap import DALS
27
+
28
+ from distutils.sysconfig import get_config_var
29
+ from distutils.util import get_platform
30
+
31
+ WHEEL_INFO_TESTS = (
32
+ ('invalid.whl', ValueError),
33
+ (
34
+ 'simplewheel-2.0-1-py2.py3-none-any.whl',
35
+ {
36
+ 'project_name': 'simplewheel',
37
+ 'version': '2.0',
38
+ 'build': '1',
39
+ 'py_version': 'py2.py3',
40
+ 'abi': 'none',
41
+ 'platform': 'any',
42
+ },
43
+ ),
44
+ (
45
+ 'simple.dist-0.1-py2.py3-none-any.whl',
46
+ {
47
+ 'project_name': 'simple.dist',
48
+ 'version': '0.1',
49
+ 'build': None,
50
+ 'py_version': 'py2.py3',
51
+ 'abi': 'none',
52
+ 'platform': 'any',
53
+ },
54
+ ),
55
+ (
56
+ 'example_pkg_a-1-py3-none-any.whl',
57
+ {
58
+ 'project_name': 'example_pkg_a',
59
+ 'version': '1',
60
+ 'build': None,
61
+ 'py_version': 'py3',
62
+ 'abi': 'none',
63
+ 'platform': 'any',
64
+ },
65
+ ),
66
+ (
67
+ 'PyQt5-5.9-5.9.1-cp35.cp36.cp37-abi3-manylinux1_x86_64.whl',
68
+ {
69
+ 'project_name': 'PyQt5',
70
+ 'version': '5.9',
71
+ 'build': '5.9.1',
72
+ 'py_version': 'cp35.cp36.cp37',
73
+ 'abi': 'abi3',
74
+ 'platform': 'manylinux1_x86_64',
75
+ },
76
+ ),
77
+ )
78
+
79
+
80
+ @pytest.mark.parametrize(
81
+ ('filename', 'info'), WHEEL_INFO_TESTS, ids=[t[0] for t in WHEEL_INFO_TESTS]
82
+ )
83
+ def test_wheel_info(filename, info):
84
+ if inspect.isclass(info):
85
+ with pytest.raises(info):
86
+ Wheel(filename)
87
+ return
88
+ w = Wheel(filename)
89
+ assert {k: getattr(w, k) for k in info.keys()} == info
90
+
91
+
92
+ @contextlib.contextmanager
93
+ def build_wheel(extra_file_defs=None, **kwargs):
94
+ file_defs = {
95
+ 'setup.py': (
96
+ DALS(
97
+ """
98
+ # -*- coding: utf-8 -*-
99
+ from setuptools import setup
100
+ import setuptools
101
+ setup(**%r)
102
+ """
103
+ )
104
+ % kwargs
105
+ ).encode('utf-8'),
106
+ }
107
+ if extra_file_defs:
108
+ file_defs.update(extra_file_defs)
109
+ with tempdir() as source_dir:
110
+ path.build(file_defs, source_dir)
111
+ subprocess.check_call(
112
+ (sys.executable, 'setup.py', '-q', 'bdist_wheel'), cwd=source_dir
113
+ )
114
+ yield glob.glob(os.path.join(source_dir, 'dist', '*.whl'))[0]
115
+
116
+
117
+ def tree_set(root):
118
+ contents = set()
119
+ for dirpath, dirnames, filenames in os.walk(root):
120
+ for filename in filenames:
121
+ contents.add(os.path.join(os.path.relpath(dirpath, root), filename))
122
+ return contents
123
+
124
+
125
+ def flatten_tree(tree):
126
+ """Flatten nested dicts and lists into a full list of paths"""
127
+ output = set()
128
+ for node, contents in tree.items():
129
+ if isinstance(contents, dict):
130
+ contents = flatten_tree(contents)
131
+
132
+ for elem in contents:
133
+ if isinstance(elem, dict):
134
+ output |= {os.path.join(node, val) for val in flatten_tree(elem)}
135
+ else:
136
+ output.add(os.path.join(node, elem))
137
+ return output
138
+
139
+
140
+ def format_install_tree(tree):
141
+ return {
142
+ x.format(
143
+ py_version=PY_MAJOR,
144
+ platform=get_platform(),
145
+ shlib_ext=get_config_var('EXT_SUFFIX') or get_config_var('SO'),
146
+ )
147
+ for x in tree
148
+ }
149
+
150
+
151
+ def _check_wheel_install(
152
+ filename, install_dir, install_tree_includes, project_name, version, requires_txt
153
+ ):
154
+ w = Wheel(filename)
155
+ egg_path = os.path.join(install_dir, w.egg_name())
156
+ w.install_as_egg(egg_path)
157
+ if install_tree_includes is not None:
158
+ install_tree = format_install_tree(install_tree_includes)
159
+ exp = tree_set(install_dir)
160
+ assert install_tree.issubset(exp), install_tree - exp
161
+
162
+ metadata = PathMetadata(egg_path, os.path.join(egg_path, 'EGG-INFO'))
163
+ dist = Distribution.from_filename(egg_path, metadata=metadata)
164
+ assert dist.project_name == project_name
165
+ assert dist.version == version
166
+ if requires_txt is None:
167
+ assert not dist.has_metadata('requires.txt')
168
+ else:
169
+ # Order must match to ensure reproducibility.
170
+ assert requires_txt == dist.get_metadata('requires.txt').lstrip()
171
+
172
+
173
+ class Record:
174
+ def __init__(self, id, **kwargs):
175
+ self._id = id
176
+ self._fields = kwargs
177
+
178
+ def __repr__(self) -> str:
179
+ return f'{self._id}(**{self._fields!r})'
180
+
181
+
182
+ # Using Any to avoid possible type union issues later in test
183
+ # making a TypedDict is not worth in a test and anonymous/inline TypedDict are experimental
184
+ # https://github.com/python/mypy/issues/9884
185
+ WHEEL_INSTALL_TESTS: tuple[dict[str, Any], ...] = (
186
+ dict(
187
+ id='basic',
188
+ file_defs={'foo': {'__init__.py': ''}},
189
+ setup_kwargs=dict(
190
+ packages=['foo'],
191
+ ),
192
+ install_tree=flatten_tree({
193
+ 'foo-1.0-py{py_version}.egg': {
194
+ 'EGG-INFO': ['PKG-INFO', 'RECORD', 'WHEEL', 'top_level.txt'],
195
+ 'foo': ['__init__.py'],
196
+ }
197
+ }),
198
+ ),
199
+ dict(
200
+ id='utf-8',
201
+ setup_kwargs=dict(
202
+ description='Description accentuée',
203
+ ),
204
+ ),
205
+ dict(
206
+ id='data',
207
+ file_defs={
208
+ 'data.txt': DALS(
209
+ """
210
+ Some data...
211
+ """
212
+ ),
213
+ },
214
+ setup_kwargs=dict(
215
+ data_files=[('data_dir', ['data.txt'])],
216
+ ),
217
+ install_tree=flatten_tree({
218
+ 'foo-1.0-py{py_version}.egg': {
219
+ 'EGG-INFO': ['PKG-INFO', 'RECORD', 'WHEEL', 'top_level.txt'],
220
+ 'data_dir': ['data.txt'],
221
+ }
222
+ }),
223
+ ),
224
+ dict(
225
+ id='extension',
226
+ file_defs={
227
+ 'extension.c': DALS(
228
+ """
229
+ #include "Python.h"
230
+
231
+ #if PY_MAJOR_VERSION >= 3
232
+
233
+ static struct PyModuleDef moduledef = {
234
+ PyModuleDef_HEAD_INIT,
235
+ "extension",
236
+ NULL,
237
+ 0,
238
+ NULL,
239
+ NULL,
240
+ NULL,
241
+ NULL,
242
+ NULL
243
+ };
244
+
245
+ #define INITERROR return NULL
246
+
247
+ PyMODINIT_FUNC PyInit_extension(void)
248
+
249
+ #else
250
+
251
+ #define INITERROR return
252
+
253
+ void initextension(void)
254
+
255
+ #endif
256
+ {
257
+ #if PY_MAJOR_VERSION >= 3
258
+ PyObject *module = PyModule_Create(&moduledef);
259
+ #else
260
+ PyObject *module = Py_InitModule("extension", NULL);
261
+ #endif
262
+ if (module == NULL)
263
+ INITERROR;
264
+ #if PY_MAJOR_VERSION >= 3
265
+ return module;
266
+ #endif
267
+ }
268
+ """
269
+ ),
270
+ },
271
+ setup_kwargs=dict(
272
+ ext_modules=[
273
+ Record(
274
+ 'setuptools.Extension', name='extension', sources=['extension.c']
275
+ )
276
+ ],
277
+ ),
278
+ install_tree=flatten_tree({
279
+ 'foo-1.0-py{py_version}-{platform}.egg': [
280
+ 'extension{shlib_ext}',
281
+ {
282
+ 'EGG-INFO': [
283
+ 'PKG-INFO',
284
+ 'RECORD',
285
+ 'WHEEL',
286
+ 'top_level.txt',
287
+ ]
288
+ },
289
+ ]
290
+ }),
291
+ ),
292
+ dict(
293
+ id='header',
294
+ file_defs={
295
+ 'header.h': DALS(
296
+ """
297
+ """
298
+ ),
299
+ },
300
+ setup_kwargs=dict(
301
+ headers=['header.h'],
302
+ ),
303
+ install_tree=flatten_tree({
304
+ 'foo-1.0-py{py_version}.egg': [
305
+ 'header.h',
306
+ {
307
+ 'EGG-INFO': [
308
+ 'PKG-INFO',
309
+ 'RECORD',
310
+ 'WHEEL',
311
+ 'top_level.txt',
312
+ ]
313
+ },
314
+ ]
315
+ }),
316
+ ),
317
+ dict(
318
+ id='script',
319
+ file_defs={
320
+ 'script.py': DALS(
321
+ """
322
+ #/usr/bin/python
323
+ print('hello world!')
324
+ """
325
+ ),
326
+ 'script.sh': DALS(
327
+ """
328
+ #/bin/sh
329
+ echo 'hello world!'
330
+ """
331
+ ),
332
+ },
333
+ setup_kwargs=dict(
334
+ scripts=['script.py', 'script.sh'],
335
+ ),
336
+ install_tree=flatten_tree({
337
+ 'foo-1.0-py{py_version}.egg': {
338
+ 'EGG-INFO': [
339
+ 'PKG-INFO',
340
+ 'RECORD',
341
+ 'WHEEL',
342
+ 'top_level.txt',
343
+ {'scripts': ['script.py', 'script.sh']},
344
+ ]
345
+ }
346
+ }),
347
+ ),
348
+ dict(
349
+ id='requires1',
350
+ install_requires='foobar==2.0',
351
+ install_tree=flatten_tree({
352
+ 'foo-1.0-py{py_version}.egg': {
353
+ 'EGG-INFO': [
354
+ 'PKG-INFO',
355
+ 'RECORD',
356
+ 'WHEEL',
357
+ 'requires.txt',
358
+ 'top_level.txt',
359
+ ]
360
+ }
361
+ }),
362
+ requires_txt=DALS(
363
+ """
364
+ foobar==2.0
365
+ """
366
+ ),
367
+ ),
368
+ dict(
369
+ id='requires2',
370
+ install_requires=f"""
371
+ bar
372
+ foo<=2.0; {sys.platform!r} in sys_platform
373
+ """,
374
+ requires_txt=DALS(
375
+ """
376
+ bar
377
+ foo<=2.0
378
+ """
379
+ ),
380
+ ),
381
+ dict(
382
+ id='requires3',
383
+ install_requires=f"""
384
+ bar; {sys.platform!r} != sys_platform
385
+ """,
386
+ ),
387
+ dict(
388
+ id='requires4',
389
+ install_requires="""
390
+ foo
391
+ """,
392
+ extras_require={
393
+ 'extra': 'foobar>3',
394
+ },
395
+ requires_txt=DALS(
396
+ """
397
+ foo
398
+
399
+ [extra]
400
+ foobar>3
401
+ """
402
+ ),
403
+ ),
404
+ dict(
405
+ id='requires5',
406
+ extras_require={
407
+ 'extra': f'foobar; {sys.platform!r} != sys_platform',
408
+ },
409
+ requires_txt=DALS(
410
+ """
411
+ [extra]
412
+ """
413
+ ),
414
+ ),
415
+ dict(
416
+ id='requires_ensure_order',
417
+ install_requires="""
418
+ foo
419
+ bar
420
+ baz
421
+ qux
422
+ """,
423
+ extras_require={
424
+ 'extra': """
425
+ foobar>3
426
+ barbaz>4
427
+ bazqux>5
428
+ quxzap>6
429
+ """,
430
+ },
431
+ requires_txt=DALS(
432
+ """
433
+ foo
434
+ bar
435
+ baz
436
+ qux
437
+
438
+ [extra]
439
+ foobar>3
440
+ barbaz>4
441
+ bazqux>5
442
+ quxzap>6
443
+ """
444
+ ),
445
+ ),
446
+ dict(
447
+ id='namespace_package',
448
+ file_defs={
449
+ 'foo': {
450
+ 'bar': {'__init__.py': ''},
451
+ },
452
+ },
453
+ setup_kwargs=dict(
454
+ namespace_packages=['foo'],
455
+ packages=['foo.bar'],
456
+ ),
457
+ install_tree=flatten_tree({
458
+ 'foo-1.0-py{py_version}.egg': [
459
+ 'foo-1.0-py{py_version}-nspkg.pth',
460
+ {
461
+ 'EGG-INFO': [
462
+ 'PKG-INFO',
463
+ 'RECORD',
464
+ 'WHEEL',
465
+ 'namespace_packages.txt',
466
+ 'top_level.txt',
467
+ ]
468
+ },
469
+ {
470
+ 'foo': [
471
+ '__init__.py',
472
+ {'bar': ['__init__.py']},
473
+ ]
474
+ },
475
+ ]
476
+ }),
477
+ ),
478
+ dict(
479
+ id='empty_namespace_package',
480
+ file_defs={
481
+ 'foobar': {
482
+ '__init__.py': (
483
+ "__import__('pkg_resources').declare_namespace(__name__)"
484
+ )
485
+ },
486
+ },
487
+ setup_kwargs=dict(
488
+ namespace_packages=['foobar'],
489
+ packages=['foobar'],
490
+ ),
491
+ install_tree=flatten_tree({
492
+ 'foo-1.0-py{py_version}.egg': [
493
+ 'foo-1.0-py{py_version}-nspkg.pth',
494
+ {
495
+ 'EGG-INFO': [
496
+ 'PKG-INFO',
497
+ 'RECORD',
498
+ 'WHEEL',
499
+ 'namespace_packages.txt',
500
+ 'top_level.txt',
501
+ ]
502
+ },
503
+ {
504
+ 'foobar': [
505
+ '__init__.py',
506
+ ]
507
+ },
508
+ ]
509
+ }),
510
+ ),
511
+ dict(
512
+ id='data_in_package',
513
+ file_defs={
514
+ 'foo': {
515
+ '__init__.py': '',
516
+ 'data_dir': {
517
+ 'data.txt': DALS(
518
+ """
519
+ Some data...
520
+ """
521
+ ),
522
+ },
523
+ }
524
+ },
525
+ setup_kwargs=dict(
526
+ packages=['foo'],
527
+ data_files=[('foo/data_dir', ['foo/data_dir/data.txt'])],
528
+ ),
529
+ install_tree=flatten_tree({
530
+ 'foo-1.0-py{py_version}.egg': {
531
+ 'EGG-INFO': [
532
+ 'PKG-INFO',
533
+ 'RECORD',
534
+ 'WHEEL',
535
+ 'top_level.txt',
536
+ ],
537
+ 'foo': [
538
+ '__init__.py',
539
+ {
540
+ 'data_dir': [
541
+ 'data.txt',
542
+ ]
543
+ },
544
+ ],
545
+ }
546
+ }),
547
+ ),
548
+ )
549
+
550
+
551
+ @pytest.mark.parametrize(
552
+ 'params',
553
+ WHEEL_INSTALL_TESTS,
554
+ ids=[params['id'] for params in WHEEL_INSTALL_TESTS],
555
+ )
556
+ def test_wheel_install(params):
557
+ project_name = params.get('name', 'foo')
558
+ version = params.get('version', '1.0')
559
+ install_requires = params.get('install_requires', [])
560
+ extras_require = params.get('extras_require', {})
561
+ requires_txt = params.get('requires_txt', None)
562
+ install_tree = params.get('install_tree')
563
+ file_defs = params.get('file_defs', {})
564
+ setup_kwargs = params.get('setup_kwargs', {})
565
+ with (
566
+ build_wheel(
567
+ name=project_name,
568
+ version=version,
569
+ install_requires=install_requires,
570
+ extras_require=extras_require,
571
+ extra_file_defs=file_defs,
572
+ **setup_kwargs,
573
+ ) as filename,
574
+ tempdir() as install_dir,
575
+ ):
576
+ _check_wheel_install(
577
+ filename, install_dir, install_tree, project_name, version, requires_txt
578
+ )
579
+
580
+
581
+ def test_wheel_install_pep_503():
582
+ project_name = 'Foo_Bar' # PEP 503 canonicalized name is "foo-bar"
583
+ version = '1.0'
584
+ with (
585
+ build_wheel(
586
+ name=project_name,
587
+ version=version,
588
+ ) as filename,
589
+ tempdir() as install_dir,
590
+ ):
591
+ new_filename = filename.replace(project_name, canonicalize_name(project_name))
592
+ shutil.move(filename, new_filename)
593
+ _check_wheel_install(
594
+ new_filename,
595
+ install_dir,
596
+ None,
597
+ canonicalize_name(project_name),
598
+ version,
599
+ None,
600
+ )
601
+
602
+
603
+ def test_wheel_no_dist_dir():
604
+ project_name = 'nodistinfo'
605
+ version = '1.0'
606
+ wheel_name = f'{project_name}-{version}-py2.py3-none-any.whl'
607
+ with tempdir() as source_dir:
608
+ wheel_path = os.path.join(source_dir, wheel_name)
609
+ # create an empty zip file
610
+ zipfile.ZipFile(wheel_path, 'w').close()
611
+ with tempdir() as install_dir:
612
+ with pytest.raises(ValueError):
613
+ _check_wheel_install(
614
+ wheel_path, install_dir, None, project_name, version, None
615
+ )
616
+
617
+
618
+ def test_wheel_is_compatible(monkeypatch):
619
+ def sys_tags():
620
+ return {
621
+ (t.interpreter, t.abi, t.platform)
622
+ for t in parse_tag('cp36-cp36m-manylinux1_x86_64')
623
+ }
624
+
625
+ monkeypatch.setattr('setuptools.wheel._get_supported_tags', sys_tags)
626
+ assert Wheel('onnxruntime-0.1.2-cp36-cp36m-manylinux1_x86_64.whl').is_compatible()
627
+
628
+
629
+ def test_wheel_mode():
630
+ @contextlib.contextmanager
631
+ def build_wheel(extra_file_defs=None, **kwargs):
632
+ file_defs = {
633
+ 'setup.py': (
634
+ DALS(
635
+ """
636
+ # -*- coding: utf-8 -*-
637
+ from setuptools import setup
638
+ import setuptools
639
+ setup(**%r)
640
+ """
641
+ )
642
+ % kwargs
643
+ ).encode('utf-8'),
644
+ }
645
+ if extra_file_defs:
646
+ file_defs.update(extra_file_defs)
647
+ with tempdir() as source_dir:
648
+ path.build(file_defs, source_dir)
649
+ runsh = pathlib.Path(source_dir) / "script.sh"
650
+ os.chmod(runsh, 0o777)
651
+ subprocess.check_call(
652
+ (sys.executable, 'setup.py', '-q', 'bdist_wheel'), cwd=source_dir
653
+ )
654
+ yield glob.glob(os.path.join(source_dir, 'dist', '*.whl'))[0]
655
+
656
+ params = dict(
657
+ id='script',
658
+ file_defs={
659
+ 'script.py': DALS(
660
+ """
661
+ #/usr/bin/python
662
+ print('hello world!')
663
+ """
664
+ ),
665
+ 'script.sh': DALS(
666
+ """
667
+ #/bin/sh
668
+ echo 'hello world!'
669
+ """
670
+ ),
671
+ },
672
+ setup_kwargs=dict(
673
+ scripts=['script.py', 'script.sh'],
674
+ ),
675
+ install_tree=flatten_tree({
676
+ 'foo-1.0-py{py_version}.egg': {
677
+ 'EGG-INFO': [
678
+ 'PKG-INFO',
679
+ 'RECORD',
680
+ 'WHEEL',
681
+ 'top_level.txt',
682
+ {'scripts': ['script.py', 'script.sh']},
683
+ ]
684
+ }
685
+ }),
686
+ )
687
+
688
+ project_name = params.get('name', 'foo')
689
+ version = params.get('version', '1.0')
690
+ install_tree = params.get('install_tree')
691
+ file_defs = params.get('file_defs', {})
692
+ setup_kwargs = params.get('setup_kwargs', {})
693
+
694
+ with (
695
+ build_wheel(
696
+ name=project_name,
697
+ version=version,
698
+ install_requires=[],
699
+ extras_require={},
700
+ extra_file_defs=file_defs,
701
+ **setup_kwargs,
702
+ ) as filename,
703
+ tempdir() as install_dir,
704
+ ):
705
+ _check_wheel_install(
706
+ filename, install_dir, install_tree, project_name, version, None
707
+ )
708
+ w = Wheel(filename)
709
+ base = pathlib.Path(install_dir) / w.egg_name()
710
+ script_sh = base / "EGG-INFO" / "scripts" / "script.sh"
711
+ assert script_sh.exists()
712
+ if sys.platform != 'win32':
713
+ # Editable file mode has no effect on Windows
714
+ assert oct(stat.S_IMODE(script_sh.stat().st_mode)) == "0o777"
.venv/lib/python3.12/site-packages/setuptools/tests/test_windows_wrappers.py ADDED
@@ -0,0 +1,259 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Python Script Wrapper for Windows
3
+ =================================
4
+
5
+ setuptools includes wrappers for Python scripts that allows them to be
6
+ executed like regular windows programs. There are 2 wrappers, one
7
+ for command-line programs, cli.exe, and one for graphical programs,
8
+ gui.exe. These programs are almost identical, function pretty much
9
+ the same way, and are generated from the same source file. The
10
+ wrapper programs are used by copying them to the directory containing
11
+ the script they are to wrap and with the same name as the script they
12
+ are to wrap.
13
+ """
14
+
15
+ import pathlib
16
+ import platform
17
+ import subprocess
18
+ import sys
19
+ import textwrap
20
+
21
+ import pytest
22
+
23
+ import pkg_resources
24
+ from setuptools.command.easy_install import nt_quote_arg
25
+
26
+ pytestmark = pytest.mark.skipif(sys.platform != 'win32', reason="Windows only")
27
+
28
+
29
+ class WrapperTester:
30
+ @classmethod
31
+ def prep_script(cls, template):
32
+ python_exe = nt_quote_arg(sys.executable)
33
+ return template % locals()
34
+
35
+ @classmethod
36
+ def create_script(cls, tmpdir):
37
+ """
38
+ Create a simple script, foo-script.py
39
+
40
+ Note that the script starts with a Unix-style '#!' line saying which
41
+ Python executable to run. The wrapper will use this line to find the
42
+ correct Python executable.
43
+ """
44
+
45
+ script = cls.prep_script(cls.script_tmpl)
46
+
47
+ with (tmpdir / cls.script_name).open('w') as f:
48
+ f.write(script)
49
+
50
+ # also copy cli.exe to the sample directory
51
+ with (tmpdir / cls.wrapper_name).open('wb') as f:
52
+ w = pkg_resources.resource_string('setuptools', cls.wrapper_source)
53
+ f.write(w)
54
+
55
+
56
+ def win_launcher_exe(prefix):
57
+ """A simple routine to select launcher script based on platform."""
58
+ assert prefix in ('cli', 'gui')
59
+ if platform.machine() == "ARM64":
60
+ return f"{prefix}-arm64.exe"
61
+ else:
62
+ return f"{prefix}-32.exe"
63
+
64
+
65
+ class TestCLI(WrapperTester):
66
+ script_name = 'foo-script.py'
67
+ wrapper_name = 'foo.exe'
68
+ wrapper_source = win_launcher_exe('cli')
69
+
70
+ script_tmpl = textwrap.dedent(
71
+ """
72
+ #!%(python_exe)s
73
+ import sys
74
+ input = repr(sys.stdin.read())
75
+ print(sys.argv[0][-14:])
76
+ print(sys.argv[1:])
77
+ print(input)
78
+ if __debug__:
79
+ print('non-optimized')
80
+ """
81
+ ).lstrip()
82
+
83
+ def test_basic(self, tmpdir):
84
+ """
85
+ When the copy of cli.exe, foo.exe in this example, runs, it examines
86
+ the path name it was run with and computes a Python script path name
87
+ by removing the '.exe' suffix and adding the '-script.py' suffix. (For
88
+ GUI programs, the suffix '-script.pyw' is added.) This is why we
89
+ named out script the way we did. Now we can run out script by running
90
+ the wrapper:
91
+
92
+ This example was a little pathological in that it exercised windows
93
+ (MS C runtime) quoting rules:
94
+
95
+ - Strings containing spaces are surrounded by double quotes.
96
+
97
+ - Double quotes in strings need to be escaped by preceding them with
98
+ back slashes.
99
+
100
+ - One or more backslashes preceding double quotes need to be escaped
101
+ by preceding each of them with back slashes.
102
+ """
103
+ self.create_script(tmpdir)
104
+ cmd = [
105
+ str(tmpdir / 'foo.exe'),
106
+ 'arg1',
107
+ 'arg 2',
108
+ 'arg "2\\"',
109
+ 'arg 4\\',
110
+ 'arg5 a\\\\b',
111
+ ]
112
+ proc = subprocess.Popen(
113
+ cmd,
114
+ stdout=subprocess.PIPE,
115
+ stdin=subprocess.PIPE,
116
+ text=True,
117
+ encoding="utf-8",
118
+ )
119
+ stdout, _stderr = proc.communicate('hello\nworld\n')
120
+ actual = stdout.replace('\r\n', '\n')
121
+ expected = textwrap.dedent(
122
+ r"""
123
+ \foo-script.py
124
+ ['arg1', 'arg 2', 'arg "2\\"', 'arg 4\\', 'arg5 a\\\\b']
125
+ 'hello\nworld\n'
126
+ non-optimized
127
+ """
128
+ ).lstrip()
129
+ assert actual == expected
130
+
131
+ def test_symlink(self, tmpdir):
132
+ """
133
+ Ensure that symlink for the foo.exe is working correctly.
134
+ """
135
+ script_dir = tmpdir / "script_dir"
136
+ script_dir.mkdir()
137
+ self.create_script(script_dir)
138
+ symlink = pathlib.Path(tmpdir / "foo.exe")
139
+ symlink.symlink_to(script_dir / "foo.exe")
140
+
141
+ cmd = [
142
+ str(tmpdir / 'foo.exe'),
143
+ 'arg1',
144
+ 'arg 2',
145
+ 'arg "2\\"',
146
+ 'arg 4\\',
147
+ 'arg5 a\\\\b',
148
+ ]
149
+ proc = subprocess.Popen(
150
+ cmd,
151
+ stdout=subprocess.PIPE,
152
+ stdin=subprocess.PIPE,
153
+ text=True,
154
+ encoding="utf-8",
155
+ )
156
+ stdout, _stderr = proc.communicate('hello\nworld\n')
157
+ actual = stdout.replace('\r\n', '\n')
158
+ expected = textwrap.dedent(
159
+ r"""
160
+ \foo-script.py
161
+ ['arg1', 'arg 2', 'arg "2\\"', 'arg 4\\', 'arg5 a\\\\b']
162
+ 'hello\nworld\n'
163
+ non-optimized
164
+ """
165
+ ).lstrip()
166
+ assert actual == expected
167
+
168
+ def test_with_options(self, tmpdir):
169
+ """
170
+ Specifying Python Command-line Options
171
+ --------------------------------------
172
+
173
+ You can specify a single argument on the '#!' line. This can be used
174
+ to specify Python options like -O, to run in optimized mode or -i
175
+ to start the interactive interpreter. You can combine multiple
176
+ options as usual. For example, to run in optimized mode and
177
+ enter the interpreter after running the script, you could use -Oi:
178
+ """
179
+ self.create_script(tmpdir)
180
+ tmpl = textwrap.dedent(
181
+ """
182
+ #!%(python_exe)s -Oi
183
+ import sys
184
+ input = repr(sys.stdin.read())
185
+ print(sys.argv[0][-14:])
186
+ print(sys.argv[1:])
187
+ print(input)
188
+ if __debug__:
189
+ print('non-optimized')
190
+ sys.ps1 = '---'
191
+ """
192
+ ).lstrip()
193
+ with (tmpdir / 'foo-script.py').open('w') as f:
194
+ f.write(self.prep_script(tmpl))
195
+ cmd = [str(tmpdir / 'foo.exe')]
196
+ proc = subprocess.Popen(
197
+ cmd,
198
+ stdout=subprocess.PIPE,
199
+ stdin=subprocess.PIPE,
200
+ stderr=subprocess.STDOUT,
201
+ text=True,
202
+ encoding="utf-8",
203
+ )
204
+ stdout, _stderr = proc.communicate()
205
+ actual = stdout.replace('\r\n', '\n')
206
+ expected = textwrap.dedent(
207
+ r"""
208
+ \foo-script.py
209
+ []
210
+ ''
211
+ ---
212
+ """
213
+ ).lstrip()
214
+ assert actual == expected
215
+
216
+
217
+ class TestGUI(WrapperTester):
218
+ """
219
+ Testing the GUI Version
220
+ -----------------------
221
+ """
222
+
223
+ script_name = 'bar-script.pyw'
224
+ wrapper_source = win_launcher_exe('gui')
225
+ wrapper_name = 'bar.exe'
226
+
227
+ script_tmpl = textwrap.dedent(
228
+ """
229
+ #!%(python_exe)s
230
+ import sys
231
+ f = open(sys.argv[1], 'wb')
232
+ bytes_written = f.write(repr(sys.argv[2]).encode('utf-8'))
233
+ f.close()
234
+ """
235
+ ).strip()
236
+
237
+ def test_basic(self, tmpdir):
238
+ """Test the GUI version with the simple script, bar-script.py"""
239
+ self.create_script(tmpdir)
240
+
241
+ cmd = [
242
+ str(tmpdir / 'bar.exe'),
243
+ str(tmpdir / 'test_output.txt'),
244
+ 'Test Argument',
245
+ ]
246
+ proc = subprocess.Popen(
247
+ cmd,
248
+ stdout=subprocess.PIPE,
249
+ stdin=subprocess.PIPE,
250
+ stderr=subprocess.STDOUT,
251
+ text=True,
252
+ encoding="utf-8",
253
+ )
254
+ stdout, stderr = proc.communicate()
255
+ assert not stdout
256
+ assert not stderr
257
+ with (tmpdir / 'test_output.txt').open('rb') as f_out:
258
+ actual = f_out.read().decode('ascii')
259
+ assert actual == repr('Test Argument')
.venv/lib/python3.12/site-packages/setuptools/tests/text.py ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ class Filenames:
2
+ unicode = 'smörbröd.py'
3
+ latin_1 = unicode.encode('latin-1')
4
+ utf_8 = unicode.encode('utf-8')
.venv/lib/python3.12/site-packages/setuptools/tests/textwrap.py ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ import textwrap
2
+
3
+
4
+ def DALS(s):
5
+ "dedent and left-strip"
6
+ return textwrap.dedent(s).lstrip()
.venv/lib/python3.12/site-packages/setuptools/unicode_utils.py ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import sys
2
+ import unicodedata
3
+ from configparser import RawConfigParser
4
+
5
+ from .compat import py39
6
+ from .warnings import SetuptoolsDeprecationWarning
7
+
8
+
9
+ # HFS Plus uses decomposed UTF-8
10
+ def decompose(path):
11
+ if isinstance(path, str):
12
+ return unicodedata.normalize('NFD', path)
13
+ try:
14
+ path = path.decode('utf-8')
15
+ path = unicodedata.normalize('NFD', path)
16
+ path = path.encode('utf-8')
17
+ except UnicodeError:
18
+ pass # Not UTF-8
19
+ return path
20
+
21
+
22
+ def filesys_decode(path):
23
+ """
24
+ Ensure that the given path is decoded,
25
+ ``None`` when no expected encoding works
26
+ """
27
+
28
+ if isinstance(path, str):
29
+ return path
30
+
31
+ fs_enc = sys.getfilesystemencoding() or 'utf-8'
32
+ candidates = fs_enc, 'utf-8'
33
+
34
+ for enc in candidates:
35
+ try:
36
+ return path.decode(enc)
37
+ except UnicodeDecodeError:
38
+ continue
39
+
40
+ return None
41
+
42
+
43
+ def try_encode(string, enc):
44
+ "turn unicode encoding into a functional routine"
45
+ try:
46
+ return string.encode(enc)
47
+ except UnicodeEncodeError:
48
+ return None
49
+
50
+
51
+ def _read_utf8_with_fallback(file: str, fallback_encoding=py39.LOCALE_ENCODING) -> str:
52
+ """
53
+ First try to read the file with UTF-8, if there is an error fallback to a
54
+ different encoding ("locale" by default). Returns the content of the file.
55
+ Also useful when reading files that might have been produced by an older version of
56
+ setuptools.
57
+ """
58
+ try:
59
+ with open(file, "r", encoding="utf-8") as f:
60
+ return f.read()
61
+ except UnicodeDecodeError: # pragma: no cover
62
+ _Utf8EncodingNeeded.emit(file=file, fallback_encoding=fallback_encoding)
63
+ with open(file, "r", encoding=fallback_encoding) as f:
64
+ return f.read()
65
+
66
+
67
+ def _cfg_read_utf8_with_fallback(
68
+ cfg: RawConfigParser, file: str, fallback_encoding=py39.LOCALE_ENCODING
69
+ ) -> None:
70
+ """Same idea as :func:`_read_utf8_with_fallback`, but for the
71
+ :meth:`RawConfigParser.read` method.
72
+
73
+ This method may call ``cfg.clear()``.
74
+ """
75
+ try:
76
+ cfg.read(file, encoding="utf-8")
77
+ except UnicodeDecodeError: # pragma: no cover
78
+ _Utf8EncodingNeeded.emit(file=file, fallback_encoding=fallback_encoding)
79
+ cfg.clear()
80
+ cfg.read(file, encoding=fallback_encoding)
81
+
82
+
83
+ class _Utf8EncodingNeeded(SetuptoolsDeprecationWarning):
84
+ _SUMMARY = """
85
+ `encoding="utf-8"` fails with {file!r}, trying `encoding={fallback_encoding!r}`.
86
+ """
87
+
88
+ _DETAILS = """
89
+ Fallback behavior for UTF-8 is considered **deprecated** and future versions of
90
+ `setuptools` may not implement it.
91
+
92
+ Please encode {file!r} with "utf-8" to ensure future builds will succeed.
93
+
94
+ If this file was produced by `setuptools` itself, cleaning up the cached files
95
+ and re-building/re-installing the package with a newer version of `setuptools`
96
+ (e.g. by updating `build-system.requires` in its `pyproject.toml`)
97
+ might solve the problem.
98
+ """
99
+ # TODO: Add a deadline?
100
+ # Will we be able to remove this?
101
+ # The question comes to mind mainly because of sdists that have been produced
102
+ # by old versions of setuptools and published to PyPI...
.venv/lib/python3.12/site-packages/setuptools/version.py ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ from ._importlib import metadata
2
+
3
+ try:
4
+ __version__ = metadata.version('setuptools') or '0.dev0+unknown'
5
+ except Exception:
6
+ __version__ = '0.dev0+unknown'
.venv/lib/python3.12/site-packages/setuptools/warnings.py ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Provide basic warnings used by setuptools modules.
2
+
3
+ Using custom classes (other than ``UserWarning``) allow users to set
4
+ ``PYTHONWARNINGS`` filters to run tests and prepare for upcoming changes in
5
+ setuptools.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ import os
11
+ import warnings
12
+ from datetime import date
13
+ from inspect import cleandoc
14
+ from textwrap import indent
15
+ from typing import TYPE_CHECKING
16
+
17
+ if TYPE_CHECKING:
18
+ from typing_extensions import TypeAlias
19
+
20
+ _DueDate: TypeAlias = tuple[int, int, int] # time tuple
21
+ _INDENT = 8 * " "
22
+ _TEMPLATE = f"""{80 * '*'}\n{{details}}\n{80 * '*'}"""
23
+
24
+
25
+ class SetuptoolsWarning(UserWarning):
26
+ """Base class in ``setuptools`` warning hierarchy."""
27
+
28
+ @classmethod
29
+ def emit(
30
+ cls,
31
+ summary: str | None = None,
32
+ details: str | None = None,
33
+ due_date: _DueDate | None = None,
34
+ see_docs: str | None = None,
35
+ see_url: str | None = None,
36
+ stacklevel: int = 2,
37
+ **kwargs,
38
+ ) -> None:
39
+ """Private: reserved for ``setuptools`` internal use only"""
40
+ # Default values:
41
+ summary_ = summary or getattr(cls, "_SUMMARY", None) or ""
42
+ details_ = details or getattr(cls, "_DETAILS", None) or ""
43
+ due_date = due_date or getattr(cls, "_DUE_DATE", None)
44
+ docs_ref = see_docs or getattr(cls, "_SEE_DOCS", None)
45
+ docs_url = docs_ref and f"https://setuptools.pypa.io/en/latest/{docs_ref}"
46
+ see_url = see_url or getattr(cls, "_SEE_URL", None)
47
+ due = date(*due_date) if due_date else None
48
+
49
+ text = cls._format(summary_, details_, due, see_url or docs_url, kwargs)
50
+ if due and due < date.today() and _should_enforce():
51
+ raise cls(text)
52
+ warnings.warn(text, cls, stacklevel=stacklevel + 1)
53
+
54
+ @classmethod
55
+ def _format(
56
+ cls,
57
+ summary: str,
58
+ details: str,
59
+ due_date: date | None = None,
60
+ see_url: str | None = None,
61
+ format_args: dict | None = None,
62
+ ) -> str:
63
+ """Private: reserved for ``setuptools`` internal use only"""
64
+ today = date.today()
65
+ summary = cleandoc(summary).format_map(format_args or {})
66
+ possible_parts = [
67
+ cleandoc(details).format_map(format_args or {}),
68
+ (
69
+ f"\nBy {due_date:%Y-%b-%d}, you need to update your project and remove "
70
+ "deprecated calls\nor your builds will no longer be supported."
71
+ if due_date and due_date > today
72
+ else None
73
+ ),
74
+ (
75
+ "\nThis deprecation is overdue, please update your project and remove "
76
+ "deprecated\ncalls to avoid build errors in the future."
77
+ if due_date and due_date < today
78
+ else None
79
+ ),
80
+ (f"\nSee {see_url} for details." if see_url else None),
81
+ ]
82
+ parts = [x for x in possible_parts if x]
83
+ if parts:
84
+ body = indent(_TEMPLATE.format(details="\n".join(parts)), _INDENT)
85
+ return "\n".join([summary, "!!\n", body, "\n!!"])
86
+ return summary
87
+
88
+
89
+ class InformationOnly(SetuptoolsWarning):
90
+ """Currently there is no clear way of displaying messages to the users
91
+ that use the setuptools backend directly via ``pip``.
92
+ The only thing that might work is a warning, although it is not the
93
+ most appropriate tool for the job...
94
+
95
+ See pypa/packaging-problems#558.
96
+ """
97
+
98
+
99
+ class SetuptoolsDeprecationWarning(SetuptoolsWarning):
100
+ """
101
+ Base class for warning deprecations in ``setuptools``
102
+
103
+ This class is not derived from ``DeprecationWarning``, and as such is
104
+ visible by default.
105
+ """
106
+
107
+
108
+ def _should_enforce():
109
+ enforce = os.getenv("SETUPTOOLS_ENFORCE_DEPRECATION", "false").lower()
110
+ return enforce in ("true", "on", "ok", "1")
.venv/lib/python3.12/site-packages/setuptools/wheel.py ADDED
@@ -0,0 +1,236 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Wheels support."""
2
+
3
+ import contextlib
4
+ import email
5
+ import functools
6
+ import itertools
7
+ import os
8
+ import posixpath
9
+ import re
10
+ import zipfile
11
+
12
+ from packaging.tags import sys_tags
13
+ from packaging.utils import canonicalize_name
14
+ from packaging.version import Version as parse_version
15
+
16
+ import setuptools
17
+ from setuptools.archive_util import _unpack_zipfile_obj
18
+ from setuptools.command.egg_info import _egg_basename, write_requirements
19
+
20
+ from .unicode_utils import _read_utf8_with_fallback
21
+
22
+ from distutils.util import get_platform
23
+
24
+ WHEEL_NAME = re.compile(
25
+ r"""^(?P<project_name>.+?)-(?P<version>\d.*?)
26
+ ((-(?P<build>\d.*?))?-(?P<py_version>.+?)-(?P<abi>.+?)-(?P<platform>.+?)
27
+ )\.whl$""",
28
+ re.VERBOSE,
29
+ ).match
30
+
31
+ NAMESPACE_PACKAGE_INIT = "__import__('pkg_resources').declare_namespace(__name__)\n"
32
+
33
+
34
+ @functools.cache
35
+ def _get_supported_tags():
36
+ # We calculate the supported tags only once, otherwise calling
37
+ # this method on thousands of wheels takes seconds instead of
38
+ # milliseconds.
39
+ return {(t.interpreter, t.abi, t.platform) for t in sys_tags()}
40
+
41
+
42
+ def unpack(src_dir, dst_dir) -> None:
43
+ """Move everything under `src_dir` to `dst_dir`, and delete the former."""
44
+ for dirpath, dirnames, filenames in os.walk(src_dir):
45
+ subdir = os.path.relpath(dirpath, src_dir)
46
+ for f in filenames:
47
+ src = os.path.join(dirpath, f)
48
+ dst = os.path.join(dst_dir, subdir, f)
49
+ os.renames(src, dst)
50
+ for n, d in reversed(list(enumerate(dirnames))):
51
+ src = os.path.join(dirpath, d)
52
+ dst = os.path.join(dst_dir, subdir, d)
53
+ if not os.path.exists(dst):
54
+ # Directory does not exist in destination,
55
+ # rename it and prune it from os.walk list.
56
+ os.renames(src, dst)
57
+ del dirnames[n]
58
+ # Cleanup.
59
+ for dirpath, dirnames, filenames in os.walk(src_dir, topdown=True):
60
+ assert not filenames
61
+ os.rmdir(dirpath)
62
+
63
+
64
+ @contextlib.contextmanager
65
+ def disable_info_traces():
66
+ """
67
+ Temporarily disable info traces.
68
+ """
69
+ from distutils import log
70
+
71
+ saved = log.set_threshold(log.WARN)
72
+ try:
73
+ yield
74
+ finally:
75
+ log.set_threshold(saved)
76
+
77
+
78
+ class Wheel:
79
+ def __init__(self, filename) -> None:
80
+ match = WHEEL_NAME(os.path.basename(filename))
81
+ if match is None:
82
+ raise ValueError(f'invalid wheel name: {filename!r}')
83
+ self.filename = filename
84
+ for k, v in match.groupdict().items():
85
+ setattr(self, k, v)
86
+
87
+ def tags(self):
88
+ """List tags (py_version, abi, platform) supported by this wheel."""
89
+ return itertools.product(
90
+ self.py_version.split('.'),
91
+ self.abi.split('.'),
92
+ self.platform.split('.'),
93
+ )
94
+
95
+ def is_compatible(self):
96
+ """Is the wheel compatible with the current platform?"""
97
+ return next((True for t in self.tags() if t in _get_supported_tags()), False)
98
+
99
+ def egg_name(self):
100
+ return (
101
+ _egg_basename(
102
+ self.project_name,
103
+ self.version,
104
+ platform=(None if self.platform == 'any' else get_platform()),
105
+ )
106
+ + ".egg"
107
+ )
108
+
109
+ def get_dist_info(self, zf):
110
+ # find the correct name of the .dist-info dir in the wheel file
111
+ for member in zf.namelist():
112
+ dirname = posixpath.dirname(member)
113
+ if dirname.endswith('.dist-info') and canonicalize_name(dirname).startswith(
114
+ canonicalize_name(self.project_name)
115
+ ):
116
+ return dirname
117
+ raise ValueError("unsupported wheel format. .dist-info not found")
118
+
119
+ def install_as_egg(self, destination_eggdir) -> None:
120
+ """Install wheel as an egg directory."""
121
+ with zipfile.ZipFile(self.filename) as zf:
122
+ self._install_as_egg(destination_eggdir, zf)
123
+
124
+ def _install_as_egg(self, destination_eggdir, zf):
125
+ dist_basename = f'{self.project_name}-{self.version}'
126
+ dist_info = self.get_dist_info(zf)
127
+ dist_data = f'{dist_basename}.data'
128
+ egg_info = os.path.join(destination_eggdir, 'EGG-INFO')
129
+
130
+ self._convert_metadata(zf, destination_eggdir, dist_info, egg_info)
131
+ self._move_data_entries(destination_eggdir, dist_data)
132
+ self._fix_namespace_packages(egg_info, destination_eggdir)
133
+
134
+ @staticmethod
135
+ def _convert_metadata(zf, destination_eggdir, dist_info, egg_info):
136
+ import pkg_resources
137
+
138
+ def get_metadata(name):
139
+ with zf.open(posixpath.join(dist_info, name)) as fp:
140
+ value = fp.read().decode('utf-8')
141
+ return email.parser.Parser().parsestr(value)
142
+
143
+ wheel_metadata = get_metadata('WHEEL')
144
+ # Check wheel format version is supported.
145
+ wheel_version = parse_version(wheel_metadata.get('Wheel-Version'))
146
+ wheel_v1 = parse_version('1.0') <= wheel_version < parse_version('2.0dev0')
147
+ if not wheel_v1:
148
+ raise ValueError(f'unsupported wheel format version: {wheel_version}')
149
+ # Extract to target directory.
150
+ _unpack_zipfile_obj(zf, destination_eggdir)
151
+ # Convert metadata.
152
+ dist_info = os.path.join(destination_eggdir, dist_info)
153
+ dist = pkg_resources.Distribution.from_location(
154
+ destination_eggdir,
155
+ dist_info,
156
+ metadata=pkg_resources.PathMetadata(destination_eggdir, dist_info),
157
+ )
158
+
159
+ # Note: Evaluate and strip markers now,
160
+ # as it's difficult to convert back from the syntax:
161
+ # foobar; "linux" in sys_platform and extra == 'test'
162
+ def raw_req(req):
163
+ req.marker = None
164
+ return str(req)
165
+
166
+ install_requires = list(map(raw_req, dist.requires()))
167
+ extras_require = {
168
+ extra: [
169
+ req
170
+ for req in map(raw_req, dist.requires((extra,)))
171
+ if req not in install_requires
172
+ ]
173
+ for extra in dist.extras
174
+ }
175
+ os.rename(dist_info, egg_info)
176
+ os.rename(
177
+ os.path.join(egg_info, 'METADATA'),
178
+ os.path.join(egg_info, 'PKG-INFO'),
179
+ )
180
+ setup_dist = setuptools.Distribution(
181
+ attrs=dict(
182
+ install_requires=install_requires,
183
+ extras_require=extras_require,
184
+ ),
185
+ )
186
+ with disable_info_traces():
187
+ write_requirements(
188
+ setup_dist.get_command_obj('egg_info'),
189
+ None,
190
+ os.path.join(egg_info, 'requires.txt'),
191
+ )
192
+
193
+ @staticmethod
194
+ def _move_data_entries(destination_eggdir, dist_data):
195
+ """Move data entries to their correct location."""
196
+ dist_data = os.path.join(destination_eggdir, dist_data)
197
+ dist_data_scripts = os.path.join(dist_data, 'scripts')
198
+ if os.path.exists(dist_data_scripts):
199
+ egg_info_scripts = os.path.join(destination_eggdir, 'EGG-INFO', 'scripts')
200
+ os.mkdir(egg_info_scripts)
201
+ for entry in os.listdir(dist_data_scripts):
202
+ # Remove bytecode, as it's not properly handled
203
+ # during easy_install scripts install phase.
204
+ if entry.endswith('.pyc'):
205
+ os.unlink(os.path.join(dist_data_scripts, entry))
206
+ else:
207
+ os.rename(
208
+ os.path.join(dist_data_scripts, entry),
209
+ os.path.join(egg_info_scripts, entry),
210
+ )
211
+ os.rmdir(dist_data_scripts)
212
+ for subdir in filter(
213
+ os.path.exists,
214
+ (
215
+ os.path.join(dist_data, d)
216
+ for d in ('data', 'headers', 'purelib', 'platlib')
217
+ ),
218
+ ):
219
+ unpack(subdir, destination_eggdir)
220
+ if os.path.exists(dist_data):
221
+ os.rmdir(dist_data)
222
+
223
+ @staticmethod
224
+ def _fix_namespace_packages(egg_info, destination_eggdir):
225
+ namespace_packages = os.path.join(egg_info, 'namespace_packages.txt')
226
+ if os.path.exists(namespace_packages):
227
+ namespace_packages = _read_utf8_with_fallback(namespace_packages).split()
228
+
229
+ for mod in namespace_packages:
230
+ mod_dir = os.path.join(destination_eggdir, *mod.split('.'))
231
+ mod_init = os.path.join(mod_dir, '__init__.py')
232
+ if not os.path.exists(mod_dir):
233
+ os.mkdir(mod_dir)
234
+ if not os.path.exists(mod_init):
235
+ with open(mod_init, 'w', encoding="utf-8") as fp:
236
+ fp.write(NAMESPACE_PACKAGE_INIT)
.venv/lib/python3.12/site-packages/setuptools/windows_support.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import platform
2
+
3
+
4
+ def windows_only(func):
5
+ if platform.system() != 'Windows':
6
+ return lambda *args, **kwargs: None
7
+ return func
8
+
9
+
10
+ @windows_only
11
+ def hide_file(path: str) -> None:
12
+ """
13
+ Set the hidden attribute on a file or directory.
14
+
15
+ From https://stackoverflow.com/questions/19622133/
16
+
17
+ `path` must be text.
18
+ """
19
+ import ctypes
20
+ import ctypes.wintypes
21
+
22
+ SetFileAttributes = ctypes.windll.kernel32.SetFileAttributesW
23
+ SetFileAttributes.argtypes = ctypes.wintypes.LPWSTR, ctypes.wintypes.DWORD
24
+ SetFileAttributes.restype = ctypes.wintypes.BOOL
25
+
26
+ FILE_ATTRIBUTE_HIDDEN = 0x02
27
+
28
+ ret = SetFileAttributes(path, FILE_ATTRIBUTE_HIDDEN)
29
+ if not ret:
30
+ raise ctypes.WinError()
.venv/lib/python3.12/site-packages/six-1.17.0.dist-info/INSTALLER ADDED
@@ -0,0 +1 @@
 
 
1
+ pip
.venv/lib/python3.12/site-packages/six-1.17.0.dist-info/LICENSE ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright (c) 2010-2024 Benjamin Peterson
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ this software and associated documentation files (the "Software"), to deal in
5
+ the Software without restriction, including without limitation the rights to
6
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7
+ the Software, and to permit persons to whom the Software is furnished to do so,
8
+ subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
.venv/lib/python3.12/site-packages/six-1.17.0.dist-info/METADATA ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Metadata-Version: 2.1
2
+ Name: six
3
+ Version: 1.17.0
4
+ Summary: Python 2 and 3 compatibility utilities
5
+ Home-page: https://github.com/benjaminp/six
6
+ Author: Benjamin Peterson
7
+ Author-email: benjamin@python.org
8
+ License: MIT
9
+ Classifier: Development Status :: 5 - Production/Stable
10
+ Classifier: Programming Language :: Python :: 2
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Topic :: Software Development :: Libraries
15
+ Classifier: Topic :: Utilities
16
+ Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*
17
+ License-File: LICENSE
18
+
19
+ .. image:: https://img.shields.io/pypi/v/six.svg
20
+ :target: https://pypi.org/project/six/
21
+ :alt: six on PyPI
22
+
23
+ .. image:: https://readthedocs.org/projects/six/badge/?version=latest
24
+ :target: https://six.readthedocs.io/
25
+ :alt: six's documentation on Read the Docs
26
+
27
+ .. image:: https://img.shields.io/badge/license-MIT-green.svg
28
+ :target: https://github.com/benjaminp/six/blob/master/LICENSE
29
+ :alt: MIT License badge
30
+
31
+ Six is a Python 2 and 3 compatibility library. It provides utility functions
32
+ for smoothing over the differences between the Python versions with the goal of
33
+ writing Python code that is compatible on both Python versions. See the
34
+ documentation for more information on what is provided.
35
+
36
+ Six supports Python 2.7 and 3.3+. It is contained in only one Python
37
+ file, so it can be easily copied into your project. (The copyright and license
38
+ notice must be retained.)
39
+
40
+ Online documentation is at https://six.readthedocs.io/.
41
+
42
+ Bugs can be reported to https://github.com/benjaminp/six. The code can also
43
+ be found there.
.venv/lib/python3.12/site-packages/six-1.17.0.dist-info/RECORD ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ __pycache__/six.cpython-312.pyc,,
2
+ six-1.17.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
3
+ six-1.17.0.dist-info/LICENSE,sha256=Q3W6IOK5xsTnytKUCmKP2Q6VzD1Q7pKq51VxXYuh-9A,1066
4
+ six-1.17.0.dist-info/METADATA,sha256=ViBCB4wnUlSfbYp8htvF3XCAiKe-bYBnLsewcQC3JGg,1658
5
+ six-1.17.0.dist-info/RECORD,,
6
+ six-1.17.0.dist-info/WHEEL,sha256=pxeNX5JdtCe58PUSYP9upmc7jdRPgvT0Gm9kb1SHlVw,109
7
+ six-1.17.0.dist-info/top_level.txt,sha256=_iVH_iYEtEXnD8nYGQYpYFUvkUW9sEO1GYbkeKSAais,4
8
+ six.py,sha256=xRyR9wPT1LNpbJI8tf7CE-BeddkhU5O--sfy-mo5BN8,34703
.venv/lib/python3.12/site-packages/six-1.17.0.dist-info/WHEEL ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (75.6.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py2-none-any
5
+ Tag: py3-none-any
6
+
.venv/lib/python3.12/site-packages/six-1.17.0.dist-info/top_level.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ six
.venv/lib/python3.12/site-packages/six.py ADDED
@@ -0,0 +1,1003 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (c) 2010-2024 Benjamin Peterson
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in all
11
+ # copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ # SOFTWARE.
20
+
21
+ """Utilities for writing code that runs on Python 2 and 3"""
22
+
23
+ from __future__ import absolute_import
24
+
25
+ import functools
26
+ import itertools
27
+ import operator
28
+ import sys
29
+ import types
30
+
31
+ __author__ = "Benjamin Peterson <benjamin@python.org>"
32
+ __version__ = "1.17.0"
33
+
34
+
35
+ # Useful for very coarse version differentiation.
36
+ PY2 = sys.version_info[0] == 2
37
+ PY3 = sys.version_info[0] == 3
38
+ PY34 = sys.version_info[0:2] >= (3, 4)
39
+
40
+ if PY3:
41
+ string_types = str,
42
+ integer_types = int,
43
+ class_types = type,
44
+ text_type = str
45
+ binary_type = bytes
46
+
47
+ MAXSIZE = sys.maxsize
48
+ else:
49
+ string_types = basestring,
50
+ integer_types = (int, long)
51
+ class_types = (type, types.ClassType)
52
+ text_type = unicode
53
+ binary_type = str
54
+
55
+ if sys.platform.startswith("java"):
56
+ # Jython always uses 32 bits.
57
+ MAXSIZE = int((1 << 31) - 1)
58
+ else:
59
+ # It's possible to have sizeof(long) != sizeof(Py_ssize_t).
60
+ class X(object):
61
+
62
+ def __len__(self):
63
+ return 1 << 31
64
+ try:
65
+ len(X())
66
+ except OverflowError:
67
+ # 32-bit
68
+ MAXSIZE = int((1 << 31) - 1)
69
+ else:
70
+ # 64-bit
71
+ MAXSIZE = int((1 << 63) - 1)
72
+ del X
73
+
74
+ if PY34:
75
+ from importlib.util import spec_from_loader
76
+ else:
77
+ spec_from_loader = None
78
+
79
+
80
+ def _add_doc(func, doc):
81
+ """Add documentation to a function."""
82
+ func.__doc__ = doc
83
+
84
+
85
+ def _import_module(name):
86
+ """Import module, returning the module after the last dot."""
87
+ __import__(name)
88
+ return sys.modules[name]
89
+
90
+
91
+ class _LazyDescr(object):
92
+
93
+ def __init__(self, name):
94
+ self.name = name
95
+
96
+ def __get__(self, obj, tp):
97
+ result = self._resolve()
98
+ setattr(obj, self.name, result) # Invokes __set__.
99
+ try:
100
+ # This is a bit ugly, but it avoids running this again by
101
+ # removing this descriptor.
102
+ delattr(obj.__class__, self.name)
103
+ except AttributeError:
104
+ pass
105
+ return result
106
+
107
+
108
+ class MovedModule(_LazyDescr):
109
+
110
+ def __init__(self, name, old, new=None):
111
+ super(MovedModule, self).__init__(name)
112
+ if PY3:
113
+ if new is None:
114
+ new = name
115
+ self.mod = new
116
+ else:
117
+ self.mod = old
118
+
119
+ def _resolve(self):
120
+ return _import_module(self.mod)
121
+
122
+ def __getattr__(self, attr):
123
+ _module = self._resolve()
124
+ value = getattr(_module, attr)
125
+ setattr(self, attr, value)
126
+ return value
127
+
128
+
129
+ class _LazyModule(types.ModuleType):
130
+
131
+ def __init__(self, name):
132
+ super(_LazyModule, self).__init__(name)
133
+ self.__doc__ = self.__class__.__doc__
134
+
135
+ def __dir__(self):
136
+ attrs = ["__doc__", "__name__"]
137
+ attrs += [attr.name for attr in self._moved_attributes]
138
+ return attrs
139
+
140
+ # Subclasses should override this
141
+ _moved_attributes = []
142
+
143
+
144
+ class MovedAttribute(_LazyDescr):
145
+
146
+ def __init__(self, name, old_mod, new_mod, old_attr=None, new_attr=None):
147
+ super(MovedAttribute, self).__init__(name)
148
+ if PY3:
149
+ if new_mod is None:
150
+ new_mod = name
151
+ self.mod = new_mod
152
+ if new_attr is None:
153
+ if old_attr is None:
154
+ new_attr = name
155
+ else:
156
+ new_attr = old_attr
157
+ self.attr = new_attr
158
+ else:
159
+ self.mod = old_mod
160
+ if old_attr is None:
161
+ old_attr = name
162
+ self.attr = old_attr
163
+
164
+ def _resolve(self):
165
+ module = _import_module(self.mod)
166
+ return getattr(module, self.attr)
167
+
168
+
169
+ class _SixMetaPathImporter(object):
170
+
171
+ """
172
+ A meta path importer to import six.moves and its submodules.
173
+
174
+ This class implements a PEP302 finder and loader. It should be compatible
175
+ with Python 2.5 and all existing versions of Python3
176
+ """
177
+
178
+ def __init__(self, six_module_name):
179
+ self.name = six_module_name
180
+ self.known_modules = {}
181
+
182
+ def _add_module(self, mod, *fullnames):
183
+ for fullname in fullnames:
184
+ self.known_modules[self.name + "." + fullname] = mod
185
+
186
+ def _get_module(self, fullname):
187
+ return self.known_modules[self.name + "." + fullname]
188
+
189
+ def find_module(self, fullname, path=None):
190
+ if fullname in self.known_modules:
191
+ return self
192
+ return None
193
+
194
+ def find_spec(self, fullname, path, target=None):
195
+ if fullname in self.known_modules:
196
+ return spec_from_loader(fullname, self)
197
+ return None
198
+
199
+ def __get_module(self, fullname):
200
+ try:
201
+ return self.known_modules[fullname]
202
+ except KeyError:
203
+ raise ImportError("This loader does not know module " + fullname)
204
+
205
+ def load_module(self, fullname):
206
+ try:
207
+ # in case of a reload
208
+ return sys.modules[fullname]
209
+ except KeyError:
210
+ pass
211
+ mod = self.__get_module(fullname)
212
+ if isinstance(mod, MovedModule):
213
+ mod = mod._resolve()
214
+ else:
215
+ mod.__loader__ = self
216
+ sys.modules[fullname] = mod
217
+ return mod
218
+
219
+ def is_package(self, fullname):
220
+ """
221
+ Return true, if the named module is a package.
222
+
223
+ We need this method to get correct spec objects with
224
+ Python 3.4 (see PEP451)
225
+ """
226
+ return hasattr(self.__get_module(fullname), "__path__")
227
+
228
+ def get_code(self, fullname):
229
+ """Return None
230
+
231
+ Required, if is_package is implemented"""
232
+ self.__get_module(fullname) # eventually raises ImportError
233
+ return None
234
+ get_source = get_code # same as get_code
235
+
236
+ def create_module(self, spec):
237
+ return self.load_module(spec.name)
238
+
239
+ def exec_module(self, module):
240
+ pass
241
+
242
+ _importer = _SixMetaPathImporter(__name__)
243
+
244
+
245
+ class _MovedItems(_LazyModule):
246
+
247
+ """Lazy loading of moved objects"""
248
+ __path__ = [] # mark as package
249
+
250
+
251
+ _moved_attributes = [
252
+ MovedAttribute("cStringIO", "cStringIO", "io", "StringIO"),
253
+ MovedAttribute("filter", "itertools", "builtins", "ifilter", "filter"),
254
+ MovedAttribute("filterfalse", "itertools", "itertools", "ifilterfalse", "filterfalse"),
255
+ MovedAttribute("input", "__builtin__", "builtins", "raw_input", "input"),
256
+ MovedAttribute("intern", "__builtin__", "sys"),
257
+ MovedAttribute("map", "itertools", "builtins", "imap", "map"),
258
+ MovedAttribute("getcwd", "os", "os", "getcwdu", "getcwd"),
259
+ MovedAttribute("getcwdb", "os", "os", "getcwd", "getcwdb"),
260
+ MovedAttribute("getoutput", "commands", "subprocess"),
261
+ MovedAttribute("range", "__builtin__", "builtins", "xrange", "range"),
262
+ MovedAttribute("reload_module", "__builtin__", "importlib" if PY34 else "imp", "reload"),
263
+ MovedAttribute("reduce", "__builtin__", "functools"),
264
+ MovedAttribute("shlex_quote", "pipes", "shlex", "quote"),
265
+ MovedAttribute("StringIO", "StringIO", "io"),
266
+ MovedAttribute("UserDict", "UserDict", "collections", "IterableUserDict", "UserDict"),
267
+ MovedAttribute("UserList", "UserList", "collections"),
268
+ MovedAttribute("UserString", "UserString", "collections"),
269
+ MovedAttribute("xrange", "__builtin__", "builtins", "xrange", "range"),
270
+ MovedAttribute("zip", "itertools", "builtins", "izip", "zip"),
271
+ MovedAttribute("zip_longest", "itertools", "itertools", "izip_longest", "zip_longest"),
272
+ MovedModule("builtins", "__builtin__"),
273
+ MovedModule("configparser", "ConfigParser"),
274
+ MovedModule("collections_abc", "collections", "collections.abc" if sys.version_info >= (3, 3) else "collections"),
275
+ MovedModule("copyreg", "copy_reg"),
276
+ MovedModule("dbm_gnu", "gdbm", "dbm.gnu"),
277
+ MovedModule("dbm_ndbm", "dbm", "dbm.ndbm"),
278
+ MovedModule("_dummy_thread", "dummy_thread", "_dummy_thread" if sys.version_info < (3, 9) else "_thread"),
279
+ MovedModule("http_cookiejar", "cookielib", "http.cookiejar"),
280
+ MovedModule("http_cookies", "Cookie", "http.cookies"),
281
+ MovedModule("html_entities", "htmlentitydefs", "html.entities"),
282
+ MovedModule("html_parser", "HTMLParser", "html.parser"),
283
+ MovedModule("http_client", "httplib", "http.client"),
284
+ MovedModule("email_mime_base", "email.MIMEBase", "email.mime.base"),
285
+ MovedModule("email_mime_image", "email.MIMEImage", "email.mime.image"),
286
+ MovedModule("email_mime_multipart", "email.MIMEMultipart", "email.mime.multipart"),
287
+ MovedModule("email_mime_nonmultipart", "email.MIMENonMultipart", "email.mime.nonmultipart"),
288
+ MovedModule("email_mime_text", "email.MIMEText", "email.mime.text"),
289
+ MovedModule("BaseHTTPServer", "BaseHTTPServer", "http.server"),
290
+ MovedModule("CGIHTTPServer", "CGIHTTPServer", "http.server"),
291
+ MovedModule("SimpleHTTPServer", "SimpleHTTPServer", "http.server"),
292
+ MovedModule("cPickle", "cPickle", "pickle"),
293
+ MovedModule("queue", "Queue"),
294
+ MovedModule("reprlib", "repr"),
295
+ MovedModule("socketserver", "SocketServer"),
296
+ MovedModule("_thread", "thread", "_thread"),
297
+ MovedModule("tkinter", "Tkinter"),
298
+ MovedModule("tkinter_dialog", "Dialog", "tkinter.dialog"),
299
+ MovedModule("tkinter_filedialog", "FileDialog", "tkinter.filedialog"),
300
+ MovedModule("tkinter_scrolledtext", "ScrolledText", "tkinter.scrolledtext"),
301
+ MovedModule("tkinter_simpledialog", "SimpleDialog", "tkinter.simpledialog"),
302
+ MovedModule("tkinter_tix", "Tix", "tkinter.tix"),
303
+ MovedModule("tkinter_ttk", "ttk", "tkinter.ttk"),
304
+ MovedModule("tkinter_constants", "Tkconstants", "tkinter.constants"),
305
+ MovedModule("tkinter_dnd", "Tkdnd", "tkinter.dnd"),
306
+ MovedModule("tkinter_colorchooser", "tkColorChooser",
307
+ "tkinter.colorchooser"),
308
+ MovedModule("tkinter_commondialog", "tkCommonDialog",
309
+ "tkinter.commondialog"),
310
+ MovedModule("tkinter_tkfiledialog", "tkFileDialog", "tkinter.filedialog"),
311
+ MovedModule("tkinter_font", "tkFont", "tkinter.font"),
312
+ MovedModule("tkinter_messagebox", "tkMessageBox", "tkinter.messagebox"),
313
+ MovedModule("tkinter_tksimpledialog", "tkSimpleDialog",
314
+ "tkinter.simpledialog"),
315
+ MovedModule("urllib_parse", __name__ + ".moves.urllib_parse", "urllib.parse"),
316
+ MovedModule("urllib_error", __name__ + ".moves.urllib_error", "urllib.error"),
317
+ MovedModule("urllib", __name__ + ".moves.urllib", __name__ + ".moves.urllib"),
318
+ MovedModule("urllib_robotparser", "robotparser", "urllib.robotparser"),
319
+ MovedModule("xmlrpc_client", "xmlrpclib", "xmlrpc.client"),
320
+ MovedModule("xmlrpc_server", "SimpleXMLRPCServer", "xmlrpc.server"),
321
+ ]
322
+ # Add windows specific modules.
323
+ if sys.platform == "win32":
324
+ _moved_attributes += [
325
+ MovedModule("winreg", "_winreg"),
326
+ ]
327
+
328
+ for attr in _moved_attributes:
329
+ setattr(_MovedItems, attr.name, attr)
330
+ if isinstance(attr, MovedModule):
331
+ _importer._add_module(attr, "moves." + attr.name)
332
+ del attr
333
+
334
+ _MovedItems._moved_attributes = _moved_attributes
335
+
336
+ moves = _MovedItems(__name__ + ".moves")
337
+ _importer._add_module(moves, "moves")
338
+
339
+
340
+ class Module_six_moves_urllib_parse(_LazyModule):
341
+
342
+ """Lazy loading of moved objects in six.moves.urllib_parse"""
343
+
344
+
345
+ _urllib_parse_moved_attributes = [
346
+ MovedAttribute("ParseResult", "urlparse", "urllib.parse"),
347
+ MovedAttribute("SplitResult", "urlparse", "urllib.parse"),
348
+ MovedAttribute("parse_qs", "urlparse", "urllib.parse"),
349
+ MovedAttribute("parse_qsl", "urlparse", "urllib.parse"),
350
+ MovedAttribute("urldefrag", "urlparse", "urllib.parse"),
351
+ MovedAttribute("urljoin", "urlparse", "urllib.parse"),
352
+ MovedAttribute("urlparse", "urlparse", "urllib.parse"),
353
+ MovedAttribute("urlsplit", "urlparse", "urllib.parse"),
354
+ MovedAttribute("urlunparse", "urlparse", "urllib.parse"),
355
+ MovedAttribute("urlunsplit", "urlparse", "urllib.parse"),
356
+ MovedAttribute("quote", "urllib", "urllib.parse"),
357
+ MovedAttribute("quote_plus", "urllib", "urllib.parse"),
358
+ MovedAttribute("unquote", "urllib", "urllib.parse"),
359
+ MovedAttribute("unquote_plus", "urllib", "urllib.parse"),
360
+ MovedAttribute("unquote_to_bytes", "urllib", "urllib.parse", "unquote", "unquote_to_bytes"),
361
+ MovedAttribute("urlencode", "urllib", "urllib.parse"),
362
+ MovedAttribute("splitquery", "urllib", "urllib.parse"),
363
+ MovedAttribute("splittag", "urllib", "urllib.parse"),
364
+ MovedAttribute("splituser", "urllib", "urllib.parse"),
365
+ MovedAttribute("splitvalue", "urllib", "urllib.parse"),
366
+ MovedAttribute("uses_fragment", "urlparse", "urllib.parse"),
367
+ MovedAttribute("uses_netloc", "urlparse", "urllib.parse"),
368
+ MovedAttribute("uses_params", "urlparse", "urllib.parse"),
369
+ MovedAttribute("uses_query", "urlparse", "urllib.parse"),
370
+ MovedAttribute("uses_relative", "urlparse", "urllib.parse"),
371
+ ]
372
+ for attr in _urllib_parse_moved_attributes:
373
+ setattr(Module_six_moves_urllib_parse, attr.name, attr)
374
+ del attr
375
+
376
+ Module_six_moves_urllib_parse._moved_attributes = _urllib_parse_moved_attributes
377
+
378
+ _importer._add_module(Module_six_moves_urllib_parse(__name__ + ".moves.urllib_parse"),
379
+ "moves.urllib_parse", "moves.urllib.parse")
380
+
381
+
382
+ class Module_six_moves_urllib_error(_LazyModule):
383
+
384
+ """Lazy loading of moved objects in six.moves.urllib_error"""
385
+
386
+
387
+ _urllib_error_moved_attributes = [
388
+ MovedAttribute("URLError", "urllib2", "urllib.error"),
389
+ MovedAttribute("HTTPError", "urllib2", "urllib.error"),
390
+ MovedAttribute("ContentTooShortError", "urllib", "urllib.error"),
391
+ ]
392
+ for attr in _urllib_error_moved_attributes:
393
+ setattr(Module_six_moves_urllib_error, attr.name, attr)
394
+ del attr
395
+
396
+ Module_six_moves_urllib_error._moved_attributes = _urllib_error_moved_attributes
397
+
398
+ _importer._add_module(Module_six_moves_urllib_error(__name__ + ".moves.urllib.error"),
399
+ "moves.urllib_error", "moves.urllib.error")
400
+
401
+
402
+ class Module_six_moves_urllib_request(_LazyModule):
403
+
404
+ """Lazy loading of moved objects in six.moves.urllib_request"""
405
+
406
+
407
+ _urllib_request_moved_attributes = [
408
+ MovedAttribute("urlopen", "urllib2", "urllib.request"),
409
+ MovedAttribute("install_opener", "urllib2", "urllib.request"),
410
+ MovedAttribute("build_opener", "urllib2", "urllib.request"),
411
+ MovedAttribute("pathname2url", "urllib", "urllib.request"),
412
+ MovedAttribute("url2pathname", "urllib", "urllib.request"),
413
+ MovedAttribute("getproxies", "urllib", "urllib.request"),
414
+ MovedAttribute("Request", "urllib2", "urllib.request"),
415
+ MovedAttribute("OpenerDirector", "urllib2", "urllib.request"),
416
+ MovedAttribute("HTTPDefaultErrorHandler", "urllib2", "urllib.request"),
417
+ MovedAttribute("HTTPRedirectHandler", "urllib2", "urllib.request"),
418
+ MovedAttribute("HTTPCookieProcessor", "urllib2", "urllib.request"),
419
+ MovedAttribute("ProxyHandler", "urllib2", "urllib.request"),
420
+ MovedAttribute("BaseHandler", "urllib2", "urllib.request"),
421
+ MovedAttribute("HTTPPasswordMgr", "urllib2", "urllib.request"),
422
+ MovedAttribute("HTTPPasswordMgrWithDefaultRealm", "urllib2", "urllib.request"),
423
+ MovedAttribute("AbstractBasicAuthHandler", "urllib2", "urllib.request"),
424
+ MovedAttribute("HTTPBasicAuthHandler", "urllib2", "urllib.request"),
425
+ MovedAttribute("ProxyBasicAuthHandler", "urllib2", "urllib.request"),
426
+ MovedAttribute("AbstractDigestAuthHandler", "urllib2", "urllib.request"),
427
+ MovedAttribute("HTTPDigestAuthHandler", "urllib2", "urllib.request"),
428
+ MovedAttribute("ProxyDigestAuthHandler", "urllib2", "urllib.request"),
429
+ MovedAttribute("HTTPHandler", "urllib2", "urllib.request"),
430
+ MovedAttribute("HTTPSHandler", "urllib2", "urllib.request"),
431
+ MovedAttribute("FileHandler", "urllib2", "urllib.request"),
432
+ MovedAttribute("FTPHandler", "urllib2", "urllib.request"),
433
+ MovedAttribute("CacheFTPHandler", "urllib2", "urllib.request"),
434
+ MovedAttribute("UnknownHandler", "urllib2", "urllib.request"),
435
+ MovedAttribute("HTTPErrorProcessor", "urllib2", "urllib.request"),
436
+ MovedAttribute("urlretrieve", "urllib", "urllib.request"),
437
+ MovedAttribute("urlcleanup", "urllib", "urllib.request"),
438
+ MovedAttribute("proxy_bypass", "urllib", "urllib.request"),
439
+ MovedAttribute("parse_http_list", "urllib2", "urllib.request"),
440
+ MovedAttribute("parse_keqv_list", "urllib2", "urllib.request"),
441
+ ]
442
+ if sys.version_info[:2] < (3, 14):
443
+ _urllib_request_moved_attributes.extend(
444
+ [
445
+ MovedAttribute("URLopener", "urllib", "urllib.request"),
446
+ MovedAttribute("FancyURLopener", "urllib", "urllib.request"),
447
+ ]
448
+ )
449
+ for attr in _urllib_request_moved_attributes:
450
+ setattr(Module_six_moves_urllib_request, attr.name, attr)
451
+ del attr
452
+
453
+ Module_six_moves_urllib_request._moved_attributes = _urllib_request_moved_attributes
454
+
455
+ _importer._add_module(Module_six_moves_urllib_request(__name__ + ".moves.urllib.request"),
456
+ "moves.urllib_request", "moves.urllib.request")
457
+
458
+
459
+ class Module_six_moves_urllib_response(_LazyModule):
460
+
461
+ """Lazy loading of moved objects in six.moves.urllib_response"""
462
+
463
+
464
+ _urllib_response_moved_attributes = [
465
+ MovedAttribute("addbase", "urllib", "urllib.response"),
466
+ MovedAttribute("addclosehook", "urllib", "urllib.response"),
467
+ MovedAttribute("addinfo", "urllib", "urllib.response"),
468
+ MovedAttribute("addinfourl", "urllib", "urllib.response"),
469
+ ]
470
+ for attr in _urllib_response_moved_attributes:
471
+ setattr(Module_six_moves_urllib_response, attr.name, attr)
472
+ del attr
473
+
474
+ Module_six_moves_urllib_response._moved_attributes = _urllib_response_moved_attributes
475
+
476
+ _importer._add_module(Module_six_moves_urllib_response(__name__ + ".moves.urllib.response"),
477
+ "moves.urllib_response", "moves.urllib.response")
478
+
479
+
480
+ class Module_six_moves_urllib_robotparser(_LazyModule):
481
+
482
+ """Lazy loading of moved objects in six.moves.urllib_robotparser"""
483
+
484
+
485
+ _urllib_robotparser_moved_attributes = [
486
+ MovedAttribute("RobotFileParser", "robotparser", "urllib.robotparser"),
487
+ ]
488
+ for attr in _urllib_robotparser_moved_attributes:
489
+ setattr(Module_six_moves_urllib_robotparser, attr.name, attr)
490
+ del attr
491
+
492
+ Module_six_moves_urllib_robotparser._moved_attributes = _urllib_robotparser_moved_attributes
493
+
494
+ _importer._add_module(Module_six_moves_urllib_robotparser(__name__ + ".moves.urllib.robotparser"),
495
+ "moves.urllib_robotparser", "moves.urllib.robotparser")
496
+
497
+
498
+ class Module_six_moves_urllib(types.ModuleType):
499
+
500
+ """Create a six.moves.urllib namespace that resembles the Python 3 namespace"""
501
+ __path__ = [] # mark as package
502
+ parse = _importer._get_module("moves.urllib_parse")
503
+ error = _importer._get_module("moves.urllib_error")
504
+ request = _importer._get_module("moves.urllib_request")
505
+ response = _importer._get_module("moves.urllib_response")
506
+ robotparser = _importer._get_module("moves.urllib_robotparser")
507
+
508
+ def __dir__(self):
509
+ return ['parse', 'error', 'request', 'response', 'robotparser']
510
+
511
+ _importer._add_module(Module_six_moves_urllib(__name__ + ".moves.urllib"),
512
+ "moves.urllib")
513
+
514
+
515
+ def add_move(move):
516
+ """Add an item to six.moves."""
517
+ setattr(_MovedItems, move.name, move)
518
+
519
+
520
+ def remove_move(name):
521
+ """Remove item from six.moves."""
522
+ try:
523
+ delattr(_MovedItems, name)
524
+ except AttributeError:
525
+ try:
526
+ del moves.__dict__[name]
527
+ except KeyError:
528
+ raise AttributeError("no such move, %r" % (name,))
529
+
530
+
531
+ if PY3:
532
+ _meth_func = "__func__"
533
+ _meth_self = "__self__"
534
+
535
+ _func_closure = "__closure__"
536
+ _func_code = "__code__"
537
+ _func_defaults = "__defaults__"
538
+ _func_globals = "__globals__"
539
+ else:
540
+ _meth_func = "im_func"
541
+ _meth_self = "im_self"
542
+
543
+ _func_closure = "func_closure"
544
+ _func_code = "func_code"
545
+ _func_defaults = "func_defaults"
546
+ _func_globals = "func_globals"
547
+
548
+
549
+ try:
550
+ advance_iterator = next
551
+ except NameError:
552
+ def advance_iterator(it):
553
+ return it.next()
554
+ next = advance_iterator
555
+
556
+
557
+ try:
558
+ callable = callable
559
+ except NameError:
560
+ def callable(obj):
561
+ return any("__call__" in klass.__dict__ for klass in type(obj).__mro__)
562
+
563
+
564
+ if PY3:
565
+ def get_unbound_function(unbound):
566
+ return unbound
567
+
568
+ create_bound_method = types.MethodType
569
+
570
+ def create_unbound_method(func, cls):
571
+ return func
572
+
573
+ Iterator = object
574
+ else:
575
+ def get_unbound_function(unbound):
576
+ return unbound.im_func
577
+
578
+ def create_bound_method(func, obj):
579
+ return types.MethodType(func, obj, obj.__class__)
580
+
581
+ def create_unbound_method(func, cls):
582
+ return types.MethodType(func, None, cls)
583
+
584
+ class Iterator(object):
585
+
586
+ def next(self):
587
+ return type(self).__next__(self)
588
+
589
+ callable = callable
590
+ _add_doc(get_unbound_function,
591
+ """Get the function out of a possibly unbound function""")
592
+
593
+
594
+ get_method_function = operator.attrgetter(_meth_func)
595
+ get_method_self = operator.attrgetter(_meth_self)
596
+ get_function_closure = operator.attrgetter(_func_closure)
597
+ get_function_code = operator.attrgetter(_func_code)
598
+ get_function_defaults = operator.attrgetter(_func_defaults)
599
+ get_function_globals = operator.attrgetter(_func_globals)
600
+
601
+
602
+ if PY3:
603
+ def iterkeys(d, **kw):
604
+ return iter(d.keys(**kw))
605
+
606
+ def itervalues(d, **kw):
607
+ return iter(d.values(**kw))
608
+
609
+ def iteritems(d, **kw):
610
+ return iter(d.items(**kw))
611
+
612
+ def iterlists(d, **kw):
613
+ return iter(d.lists(**kw))
614
+
615
+ viewkeys = operator.methodcaller("keys")
616
+
617
+ viewvalues = operator.methodcaller("values")
618
+
619
+ viewitems = operator.methodcaller("items")
620
+ else:
621
+ def iterkeys(d, **kw):
622
+ return d.iterkeys(**kw)
623
+
624
+ def itervalues(d, **kw):
625
+ return d.itervalues(**kw)
626
+
627
+ def iteritems(d, **kw):
628
+ return d.iteritems(**kw)
629
+
630
+ def iterlists(d, **kw):
631
+ return d.iterlists(**kw)
632
+
633
+ viewkeys = operator.methodcaller("viewkeys")
634
+
635
+ viewvalues = operator.methodcaller("viewvalues")
636
+
637
+ viewitems = operator.methodcaller("viewitems")
638
+
639
+ _add_doc(iterkeys, "Return an iterator over the keys of a dictionary.")
640
+ _add_doc(itervalues, "Return an iterator over the values of a dictionary.")
641
+ _add_doc(iteritems,
642
+ "Return an iterator over the (key, value) pairs of a dictionary.")
643
+ _add_doc(iterlists,
644
+ "Return an iterator over the (key, [values]) pairs of a dictionary.")
645
+
646
+
647
+ if PY3:
648
+ def b(s):
649
+ return s.encode("latin-1")
650
+
651
+ def u(s):
652
+ return s
653
+ unichr = chr
654
+ import struct
655
+ int2byte = struct.Struct(">B").pack
656
+ del struct
657
+ byte2int = operator.itemgetter(0)
658
+ indexbytes = operator.getitem
659
+ iterbytes = iter
660
+ import io
661
+ StringIO = io.StringIO
662
+ BytesIO = io.BytesIO
663
+ del io
664
+ _assertCountEqual = "assertCountEqual"
665
+ if sys.version_info[1] <= 1:
666
+ _assertRaisesRegex = "assertRaisesRegexp"
667
+ _assertRegex = "assertRegexpMatches"
668
+ _assertNotRegex = "assertNotRegexpMatches"
669
+ else:
670
+ _assertRaisesRegex = "assertRaisesRegex"
671
+ _assertRegex = "assertRegex"
672
+ _assertNotRegex = "assertNotRegex"
673
+ else:
674
+ def b(s):
675
+ return s
676
+ # Workaround for standalone backslash
677
+
678
+ def u(s):
679
+ return unicode(s.replace(r'\\', r'\\\\'), "unicode_escape")
680
+ unichr = unichr
681
+ int2byte = chr
682
+
683
+ def byte2int(bs):
684
+ return ord(bs[0])
685
+
686
+ def indexbytes(buf, i):
687
+ return ord(buf[i])
688
+ iterbytes = functools.partial(itertools.imap, ord)
689
+ import StringIO
690
+ StringIO = BytesIO = StringIO.StringIO
691
+ _assertCountEqual = "assertItemsEqual"
692
+ _assertRaisesRegex = "assertRaisesRegexp"
693
+ _assertRegex = "assertRegexpMatches"
694
+ _assertNotRegex = "assertNotRegexpMatches"
695
+ _add_doc(b, """Byte literal""")
696
+ _add_doc(u, """Text literal""")
697
+
698
+
699
+ def assertCountEqual(self, *args, **kwargs):
700
+ return getattr(self, _assertCountEqual)(*args, **kwargs)
701
+
702
+
703
+ def assertRaisesRegex(self, *args, **kwargs):
704
+ return getattr(self, _assertRaisesRegex)(*args, **kwargs)
705
+
706
+
707
+ def assertRegex(self, *args, **kwargs):
708
+ return getattr(self, _assertRegex)(*args, **kwargs)
709
+
710
+
711
+ def assertNotRegex(self, *args, **kwargs):
712
+ return getattr(self, _assertNotRegex)(*args, **kwargs)
713
+
714
+
715
+ if PY3:
716
+ exec_ = getattr(moves.builtins, "exec")
717
+
718
+ def reraise(tp, value, tb=None):
719
+ try:
720
+ if value is None:
721
+ value = tp()
722
+ if value.__traceback__ is not tb:
723
+ raise value.with_traceback(tb)
724
+ raise value
725
+ finally:
726
+ value = None
727
+ tb = None
728
+
729
+ else:
730
+ def exec_(_code_, _globs_=None, _locs_=None):
731
+ """Execute code in a namespace."""
732
+ if _globs_ is None:
733
+ frame = sys._getframe(1)
734
+ _globs_ = frame.f_globals
735
+ if _locs_ is None:
736
+ _locs_ = frame.f_locals
737
+ del frame
738
+ elif _locs_ is None:
739
+ _locs_ = _globs_
740
+ exec("""exec _code_ in _globs_, _locs_""")
741
+
742
+ exec_("""def reraise(tp, value, tb=None):
743
+ try:
744
+ raise tp, value, tb
745
+ finally:
746
+ tb = None
747
+ """)
748
+
749
+
750
+ if sys.version_info[:2] > (3,):
751
+ exec_("""def raise_from(value, from_value):
752
+ try:
753
+ raise value from from_value
754
+ finally:
755
+ value = None
756
+ """)
757
+ else:
758
+ def raise_from(value, from_value):
759
+ raise value
760
+
761
+
762
+ print_ = getattr(moves.builtins, "print", None)
763
+ if print_ is None:
764
+ def print_(*args, **kwargs):
765
+ """The new-style print function for Python 2.4 and 2.5."""
766
+ fp = kwargs.pop("file", sys.stdout)
767
+ if fp is None:
768
+ return
769
+
770
+ def write(data):
771
+ if not isinstance(data, basestring):
772
+ data = str(data)
773
+ # If the file has an encoding, encode unicode with it.
774
+ if (isinstance(fp, file) and
775
+ isinstance(data, unicode) and
776
+ fp.encoding is not None):
777
+ errors = getattr(fp, "errors", None)
778
+ if errors is None:
779
+ errors = "strict"
780
+ data = data.encode(fp.encoding, errors)
781
+ fp.write(data)
782
+ want_unicode = False
783
+ sep = kwargs.pop("sep", None)
784
+ if sep is not None:
785
+ if isinstance(sep, unicode):
786
+ want_unicode = True
787
+ elif not isinstance(sep, str):
788
+ raise TypeError("sep must be None or a string")
789
+ end = kwargs.pop("end", None)
790
+ if end is not None:
791
+ if isinstance(end, unicode):
792
+ want_unicode = True
793
+ elif not isinstance(end, str):
794
+ raise TypeError("end must be None or a string")
795
+ if kwargs:
796
+ raise TypeError("invalid keyword arguments to print()")
797
+ if not want_unicode:
798
+ for arg in args:
799
+ if isinstance(arg, unicode):
800
+ want_unicode = True
801
+ break
802
+ if want_unicode:
803
+ newline = unicode("\n")
804
+ space = unicode(" ")
805
+ else:
806
+ newline = "\n"
807
+ space = " "
808
+ if sep is None:
809
+ sep = space
810
+ if end is None:
811
+ end = newline
812
+ for i, arg in enumerate(args):
813
+ if i:
814
+ write(sep)
815
+ write(arg)
816
+ write(end)
817
+ if sys.version_info[:2] < (3, 3):
818
+ _print = print_
819
+
820
+ def print_(*args, **kwargs):
821
+ fp = kwargs.get("file", sys.stdout)
822
+ flush = kwargs.pop("flush", False)
823
+ _print(*args, **kwargs)
824
+ if flush and fp is not None:
825
+ fp.flush()
826
+
827
+ _add_doc(reraise, """Reraise an exception.""")
828
+
829
+ if sys.version_info[0:2] < (3, 4):
830
+ # This does exactly the same what the :func:`py3:functools.update_wrapper`
831
+ # function does on Python versions after 3.2. It sets the ``__wrapped__``
832
+ # attribute on ``wrapper`` object and it doesn't raise an error if any of
833
+ # the attributes mentioned in ``assigned`` and ``updated`` are missing on
834
+ # ``wrapped`` object.
835
+ def _update_wrapper(wrapper, wrapped,
836
+ assigned=functools.WRAPPER_ASSIGNMENTS,
837
+ updated=functools.WRAPPER_UPDATES):
838
+ for attr in assigned:
839
+ try:
840
+ value = getattr(wrapped, attr)
841
+ except AttributeError:
842
+ continue
843
+ else:
844
+ setattr(wrapper, attr, value)
845
+ for attr in updated:
846
+ getattr(wrapper, attr).update(getattr(wrapped, attr, {}))
847
+ wrapper.__wrapped__ = wrapped
848
+ return wrapper
849
+ _update_wrapper.__doc__ = functools.update_wrapper.__doc__
850
+
851
+ def wraps(wrapped, assigned=functools.WRAPPER_ASSIGNMENTS,
852
+ updated=functools.WRAPPER_UPDATES):
853
+ return functools.partial(_update_wrapper, wrapped=wrapped,
854
+ assigned=assigned, updated=updated)
855
+ wraps.__doc__ = functools.wraps.__doc__
856
+
857
+ else:
858
+ wraps = functools.wraps
859
+
860
+
861
+ def with_metaclass(meta, *bases):
862
+ """Create a base class with a metaclass."""
863
+ # This requires a bit of explanation: the basic idea is to make a dummy
864
+ # metaclass for one level of class instantiation that replaces itself with
865
+ # the actual metaclass.
866
+ class metaclass(type):
867
+
868
+ def __new__(cls, name, this_bases, d):
869
+ if sys.version_info[:2] >= (3, 7):
870
+ # This version introduced PEP 560 that requires a bit
871
+ # of extra care (we mimic what is done by __build_class__).
872
+ resolved_bases = types.resolve_bases(bases)
873
+ if resolved_bases is not bases:
874
+ d['__orig_bases__'] = bases
875
+ else:
876
+ resolved_bases = bases
877
+ return meta(name, resolved_bases, d)
878
+
879
+ @classmethod
880
+ def __prepare__(cls, name, this_bases):
881
+ return meta.__prepare__(name, bases)
882
+ return type.__new__(metaclass, 'temporary_class', (), {})
883
+
884
+
885
+ def add_metaclass(metaclass):
886
+ """Class decorator for creating a class with a metaclass."""
887
+ def wrapper(cls):
888
+ orig_vars = cls.__dict__.copy()
889
+ slots = orig_vars.get('__slots__')
890
+ if slots is not None:
891
+ if isinstance(slots, str):
892
+ slots = [slots]
893
+ for slots_var in slots:
894
+ orig_vars.pop(slots_var)
895
+ orig_vars.pop('__dict__', None)
896
+ orig_vars.pop('__weakref__', None)
897
+ if hasattr(cls, '__qualname__'):
898
+ orig_vars['__qualname__'] = cls.__qualname__
899
+ return metaclass(cls.__name__, cls.__bases__, orig_vars)
900
+ return wrapper
901
+
902
+
903
+ def ensure_binary(s, encoding='utf-8', errors='strict'):
904
+ """Coerce **s** to six.binary_type.
905
+
906
+ For Python 2:
907
+ - `unicode` -> encoded to `str`
908
+ - `str` -> `str`
909
+
910
+ For Python 3:
911
+ - `str` -> encoded to `bytes`
912
+ - `bytes` -> `bytes`
913
+ """
914
+ if isinstance(s, binary_type):
915
+ return s
916
+ if isinstance(s, text_type):
917
+ return s.encode(encoding, errors)
918
+ raise TypeError("not expecting type '%s'" % type(s))
919
+
920
+
921
+ def ensure_str(s, encoding='utf-8', errors='strict'):
922
+ """Coerce *s* to `str`.
923
+
924
+ For Python 2:
925
+ - `unicode` -> encoded to `str`
926
+ - `str` -> `str`
927
+
928
+ For Python 3:
929
+ - `str` -> `str`
930
+ - `bytes` -> decoded to `str`
931
+ """
932
+ # Optimization: Fast return for the common case.
933
+ if type(s) is str:
934
+ return s
935
+ if PY2 and isinstance(s, text_type):
936
+ return s.encode(encoding, errors)
937
+ elif PY3 and isinstance(s, binary_type):
938
+ return s.decode(encoding, errors)
939
+ elif not isinstance(s, (text_type, binary_type)):
940
+ raise TypeError("not expecting type '%s'" % type(s))
941
+ return s
942
+
943
+
944
+ def ensure_text(s, encoding='utf-8', errors='strict'):
945
+ """Coerce *s* to six.text_type.
946
+
947
+ For Python 2:
948
+ - `unicode` -> `unicode`
949
+ - `str` -> `unicode`
950
+
951
+ For Python 3:
952
+ - `str` -> `str`
953
+ - `bytes` -> decoded to `str`
954
+ """
955
+ if isinstance(s, binary_type):
956
+ return s.decode(encoding, errors)
957
+ elif isinstance(s, text_type):
958
+ return s
959
+ else:
960
+ raise TypeError("not expecting type '%s'" % type(s))
961
+
962
+
963
+ def python_2_unicode_compatible(klass):
964
+ """
965
+ A class decorator that defines __unicode__ and __str__ methods under Python 2.
966
+ Under Python 3 it does nothing.
967
+
968
+ To support Python 2 and 3 with a single code base, define a __str__ method
969
+ returning text and apply this decorator to the class.
970
+ """
971
+ if PY2:
972
+ if '__str__' not in klass.__dict__:
973
+ raise ValueError("@python_2_unicode_compatible cannot be applied "
974
+ "to %s because it doesn't define __str__()." %
975
+ klass.__name__)
976
+ klass.__unicode__ = klass.__str__
977
+ klass.__str__ = lambda self: self.__unicode__().encode('utf-8')
978
+ return klass
979
+
980
+
981
+ # Complete the moves implementation.
982
+ # This code is at the end of this module to speed up module loading.
983
+ # Turn this module into a package.
984
+ __path__ = [] # required for PEP 302 and PEP 451
985
+ __package__ = __name__ # see PEP 366 @ReservedAssignment
986
+ if globals().get("__spec__") is not None:
987
+ __spec__.submodule_search_locations = [] # PEP 451 @UndefinedVariable
988
+ # Remove other six meta path importers, since they cause problems. This can
989
+ # happen if six is removed from sys.modules and then reloaded. (Setuptools does
990
+ # this for some reason.)
991
+ if sys.meta_path:
992
+ for i, importer in enumerate(sys.meta_path):
993
+ # Here's some real nastiness: Another "instance" of the six module might
994
+ # be floating around. Therefore, we can't use isinstance() to check for
995
+ # the six meta path importer, since the other six instance will have
996
+ # inserted an importer with different class.
997
+ if (type(importer).__name__ == "_SixMetaPathImporter" and
998
+ importer.name == __name__):
999
+ del sys.meta_path[i]
1000
+ break
1001
+ del i, importer
1002
+ # Finally, add the importer to the meta path import hook.
1003
+ sys.meta_path.append(_importer)