-
-
Notifications
You must be signed in to change notification settings - Fork 632
fix: correctly handle absolute URLs in parse_simpleapi_html.bzl #2112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
6dc34e1
to
ce43173
Compare
Could you please add a test in https://github.com/bazelbuild/rules_python/blob/3b183bfedd3dd6a5bb42c77531079e347165441d/tests/pypi/parse_simpleapi_html/parse_simpleapi_html_tests.bzl so that this does not regress? And please add a note in the Changelog.md file. |
Yeah. Sure. I will do it. Thanks! |
ce43173
to
c625eac
Compare
- Add _get_root_directory(url) function to extract the root directory from a given URL. - Update _absolute_url function to handle absolute URLs by concatenating them with the root directory. - Fix a typo in simpleapi_download.bzl to ensure real_url is passed correctly to _read_index_result in non-blocking download scenarios. These changes improve the reliability of URL processing and download handling in PyPI-related scripts.
c625eac
to
a8a8db1
Compare
Hi @aignas, I have added tests and changed the Changelog.md. Please take a look when you get a chance. Let me know if you have other concerns. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you.
The current structure is alright, we can optimize the code if we see any problems later. At the end of the day, when using the MODULE.bazel.lock
file, this code will be executed only when the PyPI dependencies change and the time spent querying the PyPI server itself is greater than the time spent parsing it.
Thank you very much for the contribution!
This PR addresses a typo and improves the handling of absolute URLs in the
parse_simpleapi_html.bzl
file and corrects a minor issue in thesimpleapi_download.bzl
file.Summary:
parse_simpleapi_html.bzl:
_get_root_directory(url)
to extractthe root directory from a given URL.
_absolute_url
function to correctly handle absolute URLs byutilizing the
_get_root_directory
function. This ensures that URLsstarting with a "/" are correctly resolved to their full path, avoiding
potential incorrect concatenation.
simpleapi_download.bzl: Corrected the handling of the
real_url
variable inthe
_read_simpleapi
function, ensuring that the correct URL is passed to_read_index_result
when using non-blocking downloads.