Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ _piptool_install()
git_repository(
name = "subpar",
remote = "https://github.com/google/subpar",
tag = "1.0.0",
tag = "1.1.0",
)

# Test data for WHL tool testing.
Expand Down
13 changes: 10 additions & 3 deletions rules_python/piptool.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ def extract_packages(package_names):
# Add extracted directories to import path ahead of their zip file
# counterparts.
sys.path[0:0] = dirs_to_add
existing_pythonpath = os.environ['PYTHONPATH'].split(':')
os.environ['PYTHONPATH'] = ':'.join(dirs_to_add + existing_pythonpath)
existing_pythonpath = os.environ.get('PYTHONPATH')
if existing_pythonpath:
dirs_to_add.extend(existing_pythonpath.split(':'))
os.environ['PYTHONPATH'] = ':'.join(dirs_to_add)


# Wheel, pip, and setuptools are much happier running from actual
Expand All @@ -68,7 +70,12 @@ def extract_packages(package_names):


def pip_main(argv):
argv = ["--disable-pip-version-check"] + argv
# Extract the certificates from the PAR following the example of get-pip.py
# https://github.com/pypa/get-pip/blob/430ba37776ae2ad89/template.py#L164-L168
cert_path = os.path.join(tempfile.mkdtemp(), "cacert.pem")
with open(cert_path, "wb") as cert:
cert.write(pkgutil.get_data("pip._vendor.requests", "cacert.pem"))
argv = ["--disable-pip-version-check", "--cert", cert_path] + argv
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this shouldn't be necessary, but ok to add them back in while I investigate more.

return pip.main(argv)


Expand Down
Binary file modified tools/piptool.par
Binary file not shown.