pex 2.54.2__py2.py3-none-any.whl → 2.69.0__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of pex might be problematic. Click here for more details.

Files changed (180) hide show
  1. pex/auth.py +1 -1
  2. pex/bin/pex.py +15 -2
  3. pex/build_backend/configuration.py +5 -5
  4. pex/build_backend/wrap.py +27 -23
  5. pex/build_system/pep_517.py +4 -1
  6. pex/cache/dirs.py +17 -12
  7. pex/cli/commands/lock.py +302 -165
  8. pex/cli/commands/pip/core.py +4 -12
  9. pex/cli/commands/pip/wheel.py +1 -1
  10. pex/cli/commands/run.py +13 -20
  11. pex/cli/commands/venv.py +85 -16
  12. pex/cli/pex.py +11 -4
  13. pex/common.py +57 -7
  14. pex/compatibility.py +1 -1
  15. pex/dependency_configuration.py +87 -15
  16. pex/dist_metadata.py +143 -25
  17. pex/docs/html/_pagefind/fragment/en_4250138.pf_fragment +0 -0
  18. pex/docs/html/_pagefind/fragment/en_7125dad.pf_fragment +0 -0
  19. pex/docs/html/_pagefind/fragment/en_785d562.pf_fragment +0 -0
  20. pex/docs/html/_pagefind/fragment/en_8e94bb8.pf_fragment +0 -0
  21. pex/docs/html/_pagefind/fragment/en_a0396bb.pf_fragment +0 -0
  22. pex/docs/html/_pagefind/fragment/en_a8a3588.pf_fragment +0 -0
  23. pex/docs/html/_pagefind/fragment/en_c07d988.pf_fragment +0 -0
  24. pex/docs/html/_pagefind/fragment/en_d718411.pf_fragment +0 -0
  25. pex/docs/html/_pagefind/index/en_a2e3c5e.pf_index +0 -0
  26. pex/docs/html/_pagefind/pagefind-entry.json +1 -1
  27. pex/docs/html/_pagefind/pagefind.en_4ce1afa9e3.pf_meta +0 -0
  28. pex/docs/html/_static/documentation_options.js +1 -1
  29. pex/docs/html/_static/pygments.css +164 -146
  30. pex/docs/html/_static/styles/furo.css +1 -1
  31. pex/docs/html/_static/styles/furo.css.map +1 -1
  32. pex/docs/html/api/vars.html +25 -34
  33. pex/docs/html/buildingpex.html +25 -34
  34. pex/docs/html/genindex.html +24 -33
  35. pex/docs/html/index.html +25 -34
  36. pex/docs/html/recipes.html +25 -34
  37. pex/docs/html/scie.html +25 -34
  38. pex/docs/html/search.html +24 -33
  39. pex/docs/html/whatispex.html +25 -34
  40. pex/entry_points_txt.py +98 -0
  41. pex/environment.py +54 -33
  42. pex/finders.py +1 -1
  43. pex/hashing.py +71 -9
  44. pex/installed_wheel.py +141 -0
  45. pex/interpreter.py +41 -38
  46. pex/interpreter_constraints.py +25 -25
  47. pex/interpreter_implementation.py +40 -0
  48. pex/jobs.py +13 -6
  49. pex/pep_376.py +68 -384
  50. pex/pep_425.py +11 -2
  51. pex/pep_427.py +937 -205
  52. pex/pep_508.py +4 -5
  53. pex/pex_builder.py +5 -8
  54. pex/pex_info.py +14 -9
  55. pex/pip/dependencies/__init__.py +85 -13
  56. pex/pip/dependencies/requires.py +38 -3
  57. pex/pip/foreign_platform/__init__.py +4 -3
  58. pex/pip/installation.py +2 -2
  59. pex/pip/local_project.py +6 -14
  60. pex/pip/package_repositories/__init__.py +78 -0
  61. pex/pip/package_repositories/link_collector.py +96 -0
  62. pex/pip/tool.py +139 -33
  63. pex/pip/vcs.py +109 -43
  64. pex/pip/version.py +8 -1
  65. pex/requirements.py +121 -16
  66. pex/resolve/config.py +5 -1
  67. pex/resolve/configured_resolve.py +32 -10
  68. pex/resolve/configured_resolver.py +10 -39
  69. pex/resolve/downloads.py +4 -3
  70. pex/resolve/lock_downloader.py +16 -23
  71. pex/resolve/lock_resolver.py +41 -51
  72. pex/resolve/locked_resolve.py +89 -32
  73. pex/resolve/locker.py +145 -101
  74. pex/resolve/locker_patches.py +123 -197
  75. pex/resolve/lockfile/create.py +232 -87
  76. pex/resolve/lockfile/download_manager.py +5 -1
  77. pex/resolve/lockfile/json_codec.py +103 -28
  78. pex/resolve/lockfile/model.py +13 -35
  79. pex/resolve/lockfile/pep_751.py +117 -98
  80. pex/resolve/lockfile/requires_dist.py +17 -262
  81. pex/resolve/lockfile/subset.py +11 -0
  82. pex/resolve/lockfile/targets.py +445 -0
  83. pex/resolve/lockfile/updater.py +22 -10
  84. pex/resolve/package_repository.py +406 -0
  85. pex/resolve/pex_repository_resolver.py +1 -1
  86. pex/resolve/pre_resolved_resolver.py +19 -16
  87. pex/resolve/project.py +233 -47
  88. pex/resolve/requirement_configuration.py +28 -10
  89. pex/resolve/resolver_configuration.py +18 -32
  90. pex/resolve/resolver_options.py +234 -28
  91. pex/resolve/resolvers.py +3 -12
  92. pex/resolve/target_options.py +18 -2
  93. pex/resolve/target_system.py +908 -0
  94. pex/resolve/venv_resolver.py +670 -0
  95. pex/resolver.py +673 -209
  96. pex/scie/__init__.py +40 -1
  97. pex/scie/model.py +2 -0
  98. pex/scie/science.py +25 -3
  99. pex/sdist.py +219 -0
  100. pex/sh_boot.py +24 -21
  101. pex/sysconfig.py +5 -3
  102. pex/targets.py +31 -10
  103. pex/third_party/__init__.py +1 -1
  104. pex/tools/commands/repository.py +48 -25
  105. pex/vendor/__init__.py +4 -9
  106. pex/vendor/__main__.py +65 -41
  107. pex/vendor/_vendored/ansicolors/.layout.json +1 -1
  108. pex/vendor/_vendored/ansicolors/ansicolors-1.1.8.dist-info/RECORD +11 -0
  109. pex/vendor/_vendored/ansicolors/ansicolors-1.1.8.pex-info/original-whl-info.json +1 -0
  110. pex/vendor/_vendored/appdirs/.layout.json +1 -1
  111. pex/vendor/_vendored/appdirs/appdirs-1.4.4.dist-info/RECORD +7 -0
  112. pex/vendor/_vendored/appdirs/appdirs-1.4.4.pex-info/original-whl-info.json +1 -0
  113. pex/vendor/_vendored/attrs/.layout.json +1 -1
  114. pex/vendor/_vendored/attrs/attrs-21.5.0.dev0.dist-info/RECORD +37 -0
  115. pex/vendor/_vendored/attrs/attrs-21.5.0.dev0.pex-info/original-whl-info.json +1 -0
  116. pex/vendor/_vendored/packaging_20_9/.layout.json +1 -1
  117. pex/vendor/_vendored/packaging_20_9/packaging-20.9.dist-info/RECORD +20 -0
  118. pex/vendor/_vendored/packaging_20_9/packaging-20.9.pex-info/original-whl-info.json +1 -0
  119. pex/vendor/_vendored/packaging_20_9/pyparsing-2.4.7.dist-info/RECORD +7 -0
  120. pex/vendor/_vendored/packaging_20_9/pyparsing-2.4.7.pex-info/original-whl-info.json +1 -0
  121. pex/vendor/_vendored/packaging_21_3/.layout.json +1 -1
  122. pex/vendor/_vendored/packaging_21_3/packaging-21.3.dist-info/RECORD +20 -0
  123. pex/vendor/_vendored/packaging_21_3/packaging-21.3.pex-info/original-whl-info.json +1 -0
  124. pex/vendor/_vendored/packaging_21_3/pyparsing-3.0.7.dist-info/RECORD +18 -0
  125. pex/vendor/_vendored/packaging_21_3/pyparsing-3.0.7.pex-info/original-whl-info.json +1 -0
  126. pex/vendor/_vendored/packaging_24_0/.layout.json +1 -1
  127. pex/vendor/_vendored/packaging_24_0/packaging-24.0.dist-info/RECORD +22 -0
  128. pex/vendor/_vendored/packaging_24_0/packaging-24.0.pex-info/original-whl-info.json +1 -0
  129. pex/vendor/_vendored/packaging_25_0/.layout.json +1 -1
  130. pex/vendor/_vendored/packaging_25_0/packaging-25.0.dist-info/RECORD +24 -0
  131. pex/vendor/_vendored/packaging_25_0/packaging-25.0.pex-info/original-whl-info.json +1 -0
  132. pex/vendor/_vendored/pip/.layout.json +1 -1
  133. pex/vendor/_vendored/pip/pip/_vendor/certifi/cacert.pem +63 -1
  134. pex/vendor/_vendored/pip/pip-20.3.4.dist-info/RECORD +388 -0
  135. pex/vendor/_vendored/pip/pip-20.3.4.pex-info/original-whl-info.json +1 -0
  136. pex/vendor/_vendored/setuptools/.layout.json +1 -1
  137. pex/vendor/_vendored/setuptools/setuptools-44.0.0+3acb925dd708430aeaf197ea53ac8a752f7c1863.dist-info/RECORD +107 -0
  138. pex/vendor/_vendored/setuptools/setuptools-44.0.0+3acb925dd708430aeaf197ea53ac8a752f7c1863.pex-info/original-whl-info.json +1 -0
  139. pex/vendor/_vendored/toml/.layout.json +1 -1
  140. pex/vendor/_vendored/toml/toml-0.10.2.dist-info/RECORD +11 -0
  141. pex/vendor/_vendored/toml/toml-0.10.2.pex-info/original-whl-info.json +1 -0
  142. pex/vendor/_vendored/tomli/.layout.json +1 -1
  143. pex/vendor/_vendored/tomli/tomli-2.0.1.dist-info/RECORD +10 -0
  144. pex/vendor/_vendored/tomli/tomli-2.0.1.pex-info/original-whl-info.json +1 -0
  145. pex/venv/installer.py +46 -19
  146. pex/venv/venv_pex.py +6 -3
  147. pex/version.py +1 -1
  148. pex/wheel.py +188 -40
  149. pex/whl.py +67 -0
  150. pex/windows/__init__.py +14 -11
  151. {pex-2.54.2.dist-info → pex-2.69.0.dist-info}/METADATA +6 -5
  152. {pex-2.54.2.dist-info → pex-2.69.0.dist-info}/RECORD +157 -133
  153. {pex-2.54.2.dist-info → pex-2.69.0.dist-info}/entry_points.txt +1 -0
  154. {pex-2.54.2.dist-info → pex-2.69.0.dist-info}/pylock/pylock.toml +1 -1
  155. pex/docs/html/_pagefind/fragment/en_42c9d8c.pf_fragment +0 -0
  156. pex/docs/html/_pagefind/fragment/en_45dd5a2.pf_fragment +0 -0
  157. pex/docs/html/_pagefind/fragment/en_4ca74d2.pf_fragment +0 -0
  158. pex/docs/html/_pagefind/fragment/en_77273d5.pf_fragment +0 -0
  159. pex/docs/html/_pagefind/fragment/en_87a59c5.pf_fragment +0 -0
  160. pex/docs/html/_pagefind/fragment/en_8dc89b5.pf_fragment +0 -0
  161. pex/docs/html/_pagefind/fragment/en_9d1319b.pf_fragment +0 -0
  162. pex/docs/html/_pagefind/fragment/en_e55df9d.pf_fragment +0 -0
  163. pex/docs/html/_pagefind/index/en_1e98c6f.pf_index +0 -0
  164. pex/docs/html/_pagefind/pagefind.en_d1c488ecae.pf_meta +0 -0
  165. pex/vendor/_vendored/ansicolors/ansicolors-1.1.8.dist-info/INSTALLER +0 -1
  166. pex/vendor/_vendored/appdirs/appdirs-1.4.4.dist-info/INSTALLER +0 -1
  167. pex/vendor/_vendored/attrs/attrs-21.5.0.dev0.dist-info/INSTALLER +0 -1
  168. pex/vendor/_vendored/packaging_20_9/packaging-20.9.dist-info/INSTALLER +0 -1
  169. pex/vendor/_vendored/packaging_20_9/pyparsing-2.4.7.dist-info/INSTALLER +0 -1
  170. pex/vendor/_vendored/packaging_21_3/packaging-21.3.dist-info/INSTALLER +0 -1
  171. pex/vendor/_vendored/packaging_21_3/pyparsing-3.0.7.dist-info/INSTALLER +0 -1
  172. pex/vendor/_vendored/packaging_24_0/packaging-24.0.dist-info/INSTALLER +0 -1
  173. pex/vendor/_vendored/packaging_25_0/packaging-25.0.dist-info/INSTALLER +0 -1
  174. pex/vendor/_vendored/pip/pip-20.3.4.dist-info/INSTALLER +0 -1
  175. pex/vendor/_vendored/setuptools/setuptools-44.0.0+3acb925dd708430aeaf197ea53ac8a752f7c1863.dist-info/INSTALLER +0 -1
  176. pex/vendor/_vendored/toml/toml-0.10.2.dist-info/INSTALLER +0 -1
  177. pex/vendor/_vendored/tomli/tomli-2.0.1.dist-info/INSTALLER +0 -1
  178. {pex-2.54.2.dist-info → pex-2.69.0.dist-info}/WHEEL +0 -0
  179. {pex-2.54.2.dist-info → pex-2.69.0.dist-info}/licenses/LICENSE +0 -0
  180. {pex-2.54.2.dist-info → pex-2.69.0.dist-info}/top_level.txt +0 -0
pex/auth.py CHANGED
@@ -64,7 +64,7 @@ class Machine(object):
64
64
  class PasswordEntry(object):
65
65
  @classmethod
66
66
  def maybe_extract_from_url(cls, url):
67
- # type: (str) -> Optional[PasswordEntry]
67
+ # type: (Text) -> Optional[PasswordEntry]
68
68
  url_info = urlparse.urlparse(url)
69
69
  if not url_info.username or not url_info.password:
70
70
  return None
pex/bin/pex.py CHANGED
@@ -24,6 +24,7 @@ from pex.commands.command import (
24
24
  register_global_arguments,
25
25
  )
26
26
  from pex.common import CopyMode, die, is_pyc_dir, is_pyc_file
27
+ from pex.compatibility import commonpath
27
28
  from pex.dependency_configuration import DependencyConfiguration
28
29
  from pex.dependency_manager import DependencyManager
29
30
  from pex.dist_metadata import Requirement
@@ -144,6 +145,7 @@ def configure_clp_pex_resolution(parser):
144
145
  include_pex_lock=True,
145
146
  include_pylock=True,
146
147
  include_pre_resolved=True,
148
+ include_venv_repository=True,
147
149
  )
148
150
 
149
151
  group.add_argument(
@@ -757,7 +759,8 @@ def configure_clp_sources(parser):
757
759
  parser,
758
760
  project_help=(
759
761
  "Add the local project at the specified path to the generated .pex file along with "
760
- "its transitive dependencies."
762
+ "its transitive dependencies. The path can be that of a project directory, a project"
763
+ "sdist or a pre-built project wheel."
761
764
  ),
762
765
  )
763
766
 
@@ -800,6 +803,16 @@ class PositionalArgumentFromFileParser(object):
800
803
 
801
804
  def configure_clp():
802
805
  # type: () -> PositionalArgumentFromFileParser
806
+
807
+ prog = sys.argv[0]
808
+ if os.path.isabs(prog):
809
+ entries = os.environ.get("PATH", os.defpath).split(os.pathsep)
810
+ entries.append(os.getcwd())
811
+ for entry in entries:
812
+ if os.path.isabs(entry) and entry == commonpath((entry, prog)):
813
+ prog = os.path.relpath(prog, entry)
814
+ break
815
+
803
816
  usage = (
804
817
  "%(prog)s [-o OUTPUT.PEX] [options] [-- arg1 arg2 ...]\n\n"
805
818
  "%(prog)s builds a PEX (Python Executable) file based on the given specifications: "
@@ -809,7 +822,7 @@ def configure_clp():
809
822
  "with an @ symbol. These files must contain one argument per line."
810
823
  )
811
824
 
812
- parser = ArgumentParser(usage=usage, formatter_class=ArgumentDefaultsHelpFormatter)
825
+ parser = ArgumentParser(prog=prog, usage=usage, formatter_class=ArgumentDefaultsHelpFormatter)
813
826
  parser.add_argument("-V", "--version", action="version", version=__version__)
814
827
 
815
828
  configure_clp_pex_resolution(parser)
@@ -63,8 +63,8 @@ class Plugin(object):
63
63
 
64
64
  return cls(modify_sdist=modify_sdist, modify_wheel=modify_wheel)
65
65
 
66
- _modify_sdist = attr.ib() # type: Optional[Callable[[str], None]]
67
- _modify_wheel = attr.ib() # type: Optional[Callable[[str, str], None]]
66
+ _modify_sdist = attr.ib() # type: Optional[Callable[[Text], None]]
67
+ _modify_wheel = attr.ib() # type: Optional[Callable[[Text, Text], None]]
68
68
 
69
69
  @property
70
70
  def modifies_sdists(self):
@@ -72,7 +72,7 @@ class Plugin(object):
72
72
  return self._modify_sdist is not None
73
73
 
74
74
  def modify_sdist(self, sdist_dir):
75
- # type: (str) -> Any
75
+ # type: (Text) -> Any
76
76
  if self._modify_sdist:
77
77
  return self._modify_sdist(sdist_dir)
78
78
  return None
@@ -84,8 +84,8 @@ class Plugin(object):
84
84
 
85
85
  def modify_wheel(
86
86
  self,
87
- wheel_dir, # type: str
88
- dist_info_dir_relpath, # type: str
87
+ wheel_dir, # type: Text
88
+ dist_info_dir_relpath, # type: Text
89
89
  ):
90
90
  # type: (...) -> Any
91
91
  if self._modify_wheel:
pex/build_backend/wrap.py CHANGED
@@ -11,6 +11,7 @@ import io
11
11
  import os
12
12
  import tarfile
13
13
 
14
+ from pex import sdist
14
15
  from pex.build_backend import BuildError
15
16
  from pex.build_backend.configuration import load_config
16
17
  from pex.build_backend.pylock import ScriptLocks
@@ -22,10 +23,11 @@ from pex.common import (
22
23
  open_zip,
23
24
  safe_mkdtemp,
24
25
  )
26
+ from pex.compatibility import PY2
25
27
  from pex.typing import TYPE_CHECKING, cast
26
28
 
27
29
  if TYPE_CHECKING:
28
- from typing import Any, Dict, Iterator, Optional
30
+ from typing import Any, Callable, Dict, Iterator, Optional, Sequence, Tuple
29
31
 
30
32
 
31
33
  _CONFIG = load_config(internal_plugins=[(ScriptLocks.CONFIG_KEY, ScriptLocks)])
@@ -62,25 +64,7 @@ def build_sdist(
62
64
 
63
65
  sdist_path = os.path.join(sdist_directory, sdist_name)
64
66
  build_dir = _build_dir("sdist")
65
-
66
- with tarfile.open(sdist_path) as tf:
67
- tf.extractall(build_dir)
68
-
69
- entries = os.listdir(build_dir)
70
- if len(entries) != 1:
71
- raise BuildError(
72
- "Calling `{backend}.build_sdist` produced an sdist with unexpected contents.\n"
73
- "Expected expected one top-level <project>-<version> directory but found {count}:\n"
74
- "{entries}".format(
75
- backend=_CONFIG.delegate_build_backend,
76
- count=len(entries),
77
- entries="\n".join(entries),
78
- )
79
- )
80
-
81
- tarball_root_dir_name = entries[0]
82
- tarball_root_dir = os.path.join(build_dir, tarball_root_dir_name)
83
-
67
+ tarball_root_dir = sdist.extract_tarball(sdist_path, dest_dir=build_dir)
84
68
  for plugin in plugins:
85
69
  plugin.modify_sdist(tarball_root_dir)
86
70
 
@@ -96,6 +80,27 @@ def build_sdist(
96
80
  return sdist_name
97
81
 
98
82
 
83
+ if TYPE_CHECKING:
84
+ from typing import Protocol
85
+
86
+ class CSVWriter(Protocol):
87
+ def writerow(self, row):
88
+ # type: (Sequence[Any]) -> None
89
+ pass
90
+
91
+
92
+ def csv_output():
93
+ # type: () -> Tuple[CSVWriter, Callable[[], bytes]]
94
+ if PY2:
95
+ record = io.BytesIO()
96
+ csv_writer = csv.writer(record, delimiter=",", quotechar='"', lineterminator="\n")
97
+ return csv_writer, record.getvalue
98
+ else:
99
+ record = io.StringIO()
100
+ csv_writer = csv.writer(record, delimiter=",", quotechar='"', lineterminator="\n")
101
+ return csv_writer, lambda: record.getvalue().encode("utf-8")
102
+
103
+
99
104
  def build_wheel(
100
105
  wheel_directory, # type: str
101
106
  config_settings=None, # type: Optional[Dict[str, Any]]
@@ -142,8 +147,7 @@ def build_wheel(
142
147
  record_zinfo, _ = ZipFileEx.zip_info_from_file(
143
148
  os.path.join(build_dir, record_relpath), arcname=record_relpath, date_time=date_time
144
149
  )
145
- record = io.StringIO()
146
- csv_writer = csv.writer(record, delimiter=",", quotechar='"', lineterminator="\n")
150
+ csv_writer, get_csv_bytes = csv_output()
147
151
  with open_zip(wheel_path, "w") as zf:
148
152
  for path in _iter_files_deterministic(build_dir):
149
153
  if path == record_relpath:
@@ -162,6 +166,6 @@ def build_wheel(
162
166
  )
163
167
 
164
168
  csv_writer.writerow((record_relpath, None, None))
165
- zf.writestr(record_zinfo, record.getvalue().encode("utf-8"))
169
+ zf.writestr(record_zinfo, get_csv_bytes())
166
170
 
167
171
  return wheel_name
@@ -11,7 +11,7 @@ from textwrap import dedent
11
11
  from pex import third_party
12
12
  from pex.build_system import DEFAULT_BUILD_BACKEND
13
13
  from pex.build_system.pep_518 import BuildSystem, load_build_system
14
- from pex.common import safe_mkdtemp
14
+ from pex.common import safe_mkdir, safe_mkdtemp
15
15
  from pex.dist_metadata import DistMetadata, Distribution, MetadataType
16
16
  from pex.jobs import Job, SpawnedJob
17
17
  from pex.pip.version import PipVersion, PipVersionValue
@@ -227,6 +227,9 @@ def build_sdist(
227
227
  "{stderr}".format(project_directory=project_directory, err=e, stderr=e.stderr)
228
228
  )
229
229
 
230
+ # N.B.: Although it's not clear the spec mandates this, ensure the dist dir exists before
231
+ # handing it to the back end. See: https://github.com/pex-tool/pex/issues/2913 for motivation.
232
+ safe_mkdir(dist_dir)
230
233
  spawned_job_or_error = _invoke_build_hook(
231
234
  project_directory,
232
235
  target,
pex/cache/dirs.py CHANGED
@@ -144,7 +144,7 @@ class CacheDir(Enum["CacheDir.Value"]):
144
144
 
145
145
  INSTALLED_WHEELS = Value(
146
146
  "installed_wheels",
147
- version=0,
147
+ version=2,
148
148
  name="Pre-installed Wheels",
149
149
  description=(
150
150
  "Pre-installed wheel chroots used to both build PEXes and serve as runtime `sys.path` "
@@ -178,7 +178,7 @@ class CacheDir(Enum["CacheDir.Value"]):
178
178
 
179
179
  PIP = Value(
180
180
  "pip",
181
- version=1,
181
+ version=3,
182
182
  name="Pip Versions",
183
183
  description="Isolated Pip caches and Pip PEXes Pex uses to resolve distributions.",
184
184
  dependencies=[INSTALLED_WHEELS],
@@ -193,6 +193,16 @@ class CacheDir(Enum["CacheDir.Value"]):
193
193
  ),
194
194
  )
195
195
 
196
+ REPACKED_WHEELS = Value(
197
+ "repacked_wheels",
198
+ version=0,
199
+ name="Reconstituted Wheels",
200
+ description=(
201
+ "Wheels that have been reconstituted from {installed_wheels!r}, as well as from wheels "
202
+ "installed in venvs.".format(installed_wheels=INSTALLED_WHEELS.rel_path())
203
+ ),
204
+ )
205
+
196
206
  RUN = Value(
197
207
  "run",
198
208
  version=0,
@@ -226,7 +236,7 @@ class CacheDir(Enum["CacheDir.Value"]):
226
236
 
227
237
  UNZIPPED_PEXES = Value(
228
238
  "unzipped_pexes",
229
- version=1,
239
+ version=3,
230
240
  name="Unzipped PEXes",
231
241
  description="The unzipped PEX files executed on this machine.",
232
242
  dependencies=[BOOTSTRAPS, USER_CODE, INSTALLED_WHEELS],
@@ -234,7 +244,7 @@ class CacheDir(Enum["CacheDir.Value"]):
234
244
 
235
245
  VENVS = Value(
236
246
  "venvs",
237
- version=1,
247
+ version=3,
238
248
  name="Virtual Environments",
239
249
  description="Virtual environments generated at runtime for `--venv` mode PEXes.",
240
250
  dependencies=[INSTALLED_WHEELS],
@@ -719,7 +729,7 @@ class BuiltWheelDir(AtomicCacheDir):
719
729
 
720
730
  from pex.dist_metadata import ProjectNameAndVersion, UnrecognizedDistributionFormat
721
731
 
722
- for path in glob.glob(CacheDir.BUILT_WHEELS.path("sdists", "*", "*")):
732
+ for path in glob.glob(CacheDir.BUILT_WHEELS.path("sdists", "*", "*", pex_root=pex_root)):
723
733
  sdist, fingerprint = os.path.split(path)
724
734
  try:
725
735
  pnav = ProjectNameAndVersion.from_filename(sdist)
@@ -735,7 +745,7 @@ class BuiltWheelDir(AtomicCacheDir):
735
745
  yield BuiltWheelDir(path=dist_dir, dist_dir=dist_dir, file_name=file_name)
736
746
 
737
747
  for built_wheel in glob.glob(
738
- CacheDir.BUILT_WHEELS.path("local_projects", "*", "*", "*", "*")
748
+ CacheDir.BUILT_WHEELS.path("local_projects", "*", "*", "*", "*", pex_root=pex_root)
739
749
  ):
740
750
  file_name = os.path.basename(built_wheel)
741
751
  dist_dir = os.path.dirname(built_wheel)
@@ -745,26 +755,21 @@ class BuiltWheelDir(AtomicCacheDir):
745
755
  def create(
746
756
  cls,
747
757
  sdist, # type: str
748
- fingerprint=None, # type: Optional[str]
758
+ fingerprint, # type: str
749
759
  pnav=None, # type: Optional[ProjectNameAndVersion]
750
760
  target=None, # type: Optional[Target]
751
761
  pex_root=ENV, # type: Union[str, Variables]
752
762
  ):
753
763
  # type: (...) -> BuiltWheelDir
754
764
 
755
- import hashlib
756
-
757
765
  from pex import targets
758
766
  from pex.dist_metadata import is_sdist
759
- from pex.util import CacheHelper
760
767
 
761
768
  if is_sdist(sdist):
762
769
  dist_type = "sdists"
763
- fingerprint = fingerprint or CacheHelper.hash(sdist, hasher=hashlib.sha256)
764
770
  file_name = os.path.basename(sdist)
765
771
  else:
766
772
  dist_type = "local_projects"
767
- fingerprint = fingerprint or CacheHelper.dir_hash(sdist, hasher=hashlib.sha256)
768
773
  file_name = None
769
774
 
770
775
  # For the purposes of building a wheel from source, the product should be uniqued by the