8000 Fix requirement parser by tgeng · Pull Request #1009 · bazel-contrib/rules_python · GitHub
[go: up one dir, main page]

Skip to content

Fix requirement parser #1009

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

Merged
merged 1 commit into from
Jan 25, 2023
Merged

Conversation

tgeng
Copy link
Contributor
@tgeng tgeng commented Jan 24, 2023

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature (please, look at the "Scope of the project" section in the README.md file)
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Bazel build fails when requirements.txt contains --extra-index-url https://foo.bar/ with the following error

Usage:   
  /home/tgeng/.pyenv/versions/3.10.7/bin/python3 -m pip wheel [options] <requirement specifier> ...
  /home/tgeng/.pyenv/versions/3.10.7/bin/python3 -m pip wheel [options] -r <requirements file> ...
  /home/tgeng/.pyenv/versions/3.10.7/bin/python3 -m pip wheel [options] [-e] <vcs project url> ...
  /home/tgeng/.pyenv/versions/3.10.7/bin/python3 -m pip wheel [options] [-e] <local project path> ...
  /home/tgeng/.pyenv/versions/3.10.7/bin/python3 -m pip wheel [options] <archive url/path> ...

no such option: --extra-index-url https://foo.bar/
Traceback (most recent call last):
  File "/home/tgeng/.pyenv/versions/3.10.7/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/tgeng/.pyenv/versions/3.10.7/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/tgeng/.cache/bazel/_bazel_tgeng/11c8d744707d72bad124e809aecc8f07/external/rules_python~override/python/pip_install/tools/wheel_installer/wheel_installer.py", line 449, in <module>
    main()
  File "/home/tgeng/.cache/bazel/_bazel_tgeng/11c8d744707d72bad124e809aecc8f07/external/rules_python~override/python/pip_install/tools/wheel_installer/wheel_installer.py", line 426, in main
    subprocess.run(pip_args, check=True, env=env)
  File "/home/tgeng/.pyenv/versions/3.10.7/lib/python3.10/subprocess.py", line 524, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/home/tgeng/.pyenv/versions/3.10.7/bin/python3', '-m', 'pip', '--isolated', 'wheel', '--no-deps', '--extra-index-url https://foo.bar/', '-r', '/tmp/tmp4t4gnn79']' returned non-zero exit status 2.

Issue Number: N/A

What is the new behavior?

Build works as expected

Does this PR introduce a breaking change?

  • Yes
  • No

Other i 8000 nformation

@tgeng
Copy link
Contributor Author
tgeng commented Jan 24, 2023

cc @kormide

Space in requirement.txt should delimit options into distinct arguments.
Otherwise, `pip` would be invoked with incorrect argument containing
space.
@tgeng tgeng force-pushed the fix-requirement-parser branch from 5228a3c to 85810f4 Compare January 24, 2023 00:51
@f0rmiga f0rmiga merged commit 43e18f0 into bazel-contrib:main Jan 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0