Skip to content

Commit

Permalink
Updated pip and packaging versions to work with free-threading packages
Browse files Browse the repository at this point in the history
  • Loading branch information
vfdev-5 committed Dec 23, 2024
1 parent 66a8b5b commit 6701c97
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 13 deletions.
18 changes: 14 additions & 4 deletions python/private/pypi/dependency_resolver/dependency_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import atexit
import os
import re
import shutil
import sys
from pathlib import Path
Expand Down Expand Up @@ -185,14 +186,23 @@ def main(
# and we should copy the updated requirements back to the source tree.
if not absolute_output_file.samefile(requirements_file_tree):
atexit.register(
lambda: shutil.copy(
absolute_output_file, requirements_file_tree
)
lambda: shutil.copy(absolute_output_file, requirements_file_tree)
)
cli(argv, standalone_mode = False)
cli(argv, standalone_mode=False)
requirements_file_relative_path = Path(requirements_file_relative)
content = requirements_file_relative_path.read_text()
content = content.replace(absolute_path_prefix, "")
# Replace the lines like: # via -r /absolute/path/to/requirements_extra.in
# with: # via -r requirements_extra.in
pattern = re.compile(r"(# via -r )(/.+/requirements.*\.in)")

def replace_abspath_with_name(match):
assert match is not None
# match[1] is "# via -r "
# match[2] is "/absolute/path/to/requirements*.in"
return match[1] + Path(match[2]).name

content = pattern.sub(replace_abspath_with_name, content)
requirements_file_relative_path.write_text(content)
else:
# cli will exit(0) on success
Expand Down
8 changes: 4 additions & 4 deletions python/private/pypi/deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ _RULE_DEPS = [
),
(
"pypi__packaging",
"https://files.pythonhosted.org/packages/49/df/1fceb2f8900f8639e278b056416d49134fb8d84c5942ffaa01ad34782422/packaging-24.0-py3-none-any.whl",
"2ddfb553fdf02fb784c234c7ba6ccc288296ceabec964ad2eae3777778130bc5",
"https://files.pythonhosted.org/packages/88/ef/eb23f262cca3c0c4eb7ab1933c3b1f03d021f2c48f54763065b6f0e321be/packaging-24.2-py3-none-any.whl",
"09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759",
),
(
"pypi__pep517",
Expand All @@ -61,8 +61,8 @@ _RULE_DEPS = [
),
(
"pypi__pip",
"https://files.pythonhosted.org/packages/8a/6a/19e9fe04fca059ccf770861c7d5721ab4c2aebc539889e97c7977528a53b/pip-24.0-py3-none-any.whl",
"ba0d021a166865d2265246961bec0152ff124de910c5cc39f1156ce3fa7c69dc",
"https://files.pythonhosted.org/packages/ef/7d/500c9ad20238fcfcb4cb9243eede163594d7020ce87bd9610c9e02771876/pip-24.3.1-py3-none-any.whl",
"3790624780082365f47549d032f3770eeb2b1e8bd1f7b2e02dace1afa361b4ed",
),
(
"pypi__pip_tools",
Expand Down
2 changes: 1 addition & 1 deletion python/private/pypi/evaluate_markers.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ load(":pypi_repo_utils.bzl", "pypi_repo_utils")
SRCS = [
# When the version, or any of the files in `packaging` package changes,
# this file will change as well.
Label("@pypi__packaging//:packaging-24.0.dist-info/RECORD"),
Label("@pypi__packaging//:packaging-24.2.dist-info/RECORD"),
Label("//python/private/pypi/requirements_parser:resolve_target_platforms.py"),
Label("//python/private/pypi/whl_installer:platform.py"),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@
pip==22.3 ; sys_platform == "linux" \
--hash=sha256:1daab4b8d3b97d1d763caeb01a4640a2250a0ea899e257b1e44b9eded91e15ab \
--hash=sha256:8182aec21dad6c0a49a2a3d121a87cd524b950e0b6092b181625f07ebdde7530
# via -r requirements_os_specific.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@
pip==22.2.1 ; sys_platform == "win32" \
--hash=sha256:0bbbc87dfbe6eed217beff0021f8b7dea04c8f4a0baa9d31dc4cff281ffc5b2b \
--hash=sha256:50516e47a2b79e77446f0d05649f0d53772c192571486236b1905492bfc24bac
# via -r requirements_os_specific.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,4 @@

# The following packages are considered to be unsafe in a requirements file:
pip==22.3.1
# via -r requirements.in
setuptools==65.6.3
# via -r requirements_extra.in

0 comments on commit 6701c97

Please sign in to comment.