Skip to content

Commit

Permalink
Guard against racing sdist builds. (#2080)
Browse files Browse the repository at this point in the history
Narrow the search for a result build artifact to "*.whl" files to avoid
any racing work directories that may be present when collecting the
wheel build artifact.

Fixes #2078
  • Loading branch information
jsirois authored Mar 4, 2023
1 parent a66005f commit 69cf3af
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pex/resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from __future__ import absolute_import

import functools
import glob
import hashlib
import itertools
import os
Expand Down Expand Up @@ -311,7 +312,7 @@ def dist_dir(self):
def finalize_build(self):
# type: () -> InstallRequest
self._atomic_dir.finalize()
wheels = os.listdir(self.dist_dir)
wheels = glob.glob(os.path.join(self.dist_dir, "*.whl"))
if len(wheels) != 1:
raise AssertionError(
"Build of {request} produced {count} artifacts; expected 1:\n{actual}".format(
Expand All @@ -323,8 +324,7 @@ def finalize_build(self):
),
)
)
wheel = wheels[0]
wheel_path = os.path.join(self.dist_dir, wheel)
wheel_path = wheels[0]
if self.request.target.is_foreign:
wheel_tags = CompatibilityTags.from_wheel(wheel_path)
if not self.request.target.supported_tags.compatible_tags(wheel_tags):
Expand All @@ -339,7 +339,7 @@ def finalize_build(self):
project_name=project_name_and_version.project_name,
version=project_name_and_version.version,
eol=os.linesep,
wheel=wheel,
wheel=os.path.basename(wheel_path),
sdist=os.path.basename(self.request.source_path),
target=self.request.target.render_description(),
)
Expand Down

0 comments on commit 69cf3af

Please sign in to comment.