Skip to content

Commit 3a74adc

Browse files
committed
Updated pip and packaging versions to work with free-threading packages
1 parent 66a8b5b commit 3a74adc

File tree

3 files changed

+32
-9
lines changed

3 files changed

+32
-9
lines changed

python/private/pypi/dependency_resolver/dependency_resolver.py

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
import atexit
1818
import os
19+
import re
1920
import shutil
2021
import sys
2122
from pathlib import Path
@@ -168,6 +169,17 @@ def main(
168169
)
169170
argv.extend(extra_args)
170171

172+
# Replace in the output lock file
173+
# the lines like: # via -r /absolute/path/to/requirements_extra.in
174+
# with: # via -r requirements_extra.in
175+
pattern = re.compile(r"(# via -r )(.+requirements.*\.in)")
176+
177+
def replace_abspath_with_name(match):
178+
assert match is not None
179+
# match[1] is "# via -r "
180+
# match[2] is "/absolute/path/to/requirements*.in"
181+
return match[1] + Path(match[2]).name
182+
171183
if UPDATE:
172184
print("Updating " + requirements_file_relative)
173185

@@ -185,14 +197,13 @@ def main(
185197
# and we should copy the updated requirements back to the source tree.
186198
if not absolute_output_file.samefile(requirements_file_tree):
187199
atexit.register(
188-
lambda: shutil.copy(
189-
absolute_output_file, requirements_file_tree
190-
)
200+
lambda: shutil.copy(absolute_output_file, requirements_file_tree)
191201
)
192-
cli(argv, standalone_mode = False)
202+
cli(argv, standalone_mode=False)
193203
requirements_file_relative_path = Path(requirements_file_relative)
194204
content = requirements_file_relative_path.read_text()
195205
content = content.replace(absolute_path_prefix, "")
206+
content = pattern.sub(replace_abspath_with_name, content)
196207
requirements_file_relative_path.write_text(content)
197208
else:
198209
# cli will exit(0) on success
@@ -214,6 +225,18 @@ def main(
214225
golden = open(_locate(bazel_runfiles, requirements_file)).readlines()
215226
out = open(requirements_out).readlines()
216227
out = [line.replace(absolute_path_prefix, "") for line in out]
228+
229+
def replace_via_minus_r(line):
230+
if "# via -r " in line:
231+
return pattern.sub(replace_abspath_with_name, line)
232+
return line
233+
234+
out = [replace_via_minus_r(line) for line in out]
235+
236+
237+
print("OUT:", out)
238+
print("GOLDEN:", golden)
239+
assert False
217240
if golden != out:
218241
import difflib
219242

python/private/pypi/deps.bzl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ _RULE_DEPS = [
5151
),
5252
(
5353
"pypi__packaging",
54-
"https://files.pythonhosted.org/packages/49/df/1fceb2f8900f8639e278b056416d49134fb8d84c5942ffaa01ad34782422/packaging-24.0-py3-none-any.whl",
55-
"2ddfb553fdf02fb784c234c7ba6ccc288296ceabec964ad2eae3777778130bc5",
54+
"https://files.pythonhosted.org/packages/88/ef/eb23f262cca3c0c4eb7ab1933c3b1f03d021f2c48f54763065b6f0e321be/packaging-24.2-py3-none-any.whl",
55+
"09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759",
5656
),
5757
(
5858
"pypi__pep517",
@@ -61,8 +61,8 @@ _RULE_DEPS = [
6161
),
6262
(
6363
"pypi__pip",
64-
"https://files.pythonhosted.org/packages/8a/6a/19e9fe04fca059ccf770861c7d5721ab4c2aebc539889e97c7977528a53b/pip-24.0-py3-none-any.whl",
65-
"ba0d021a166865d2265246961bec0152ff124de910c5cc39f1156ce3fa7c69dc",
64+
"https://files.pythonhosted.org/packages/ef/7d/500c9ad20238fcfcb4cb9243eede163594d7020ce87bd9610c9e02771876/pip-24.3.1-py3-none-any.whl",
65+
"3790624780082365f47549d032f3770eeb2b1e8bd1f7b2e02dace1afa361b4ed",
6666
),
6767
(
6868
"pypi__pip_tools",

python/private/pypi/evaluate_markers.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ load(":pypi_repo_utils.bzl", "pypi_repo_utils")
2020
SRCS = [
2121
# When the version, or any of the files in `packaging` package changes,
2222
# this file will change as well.
23-
Label("@pypi__packaging//:packaging-24.0.dist-info/RECORD"),
23+
Label("@pypi__packaging//:packaging-24.2.dist-info/RECORD"),
2424
Label("//python/private/pypi/requirements_parser:resolve_target_platforms.py"),
2525
Label("//python/private/pypi/whl_installer:platform.py"),
2626
]

0 commit comments

Comments
 (0)