Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
args = [
sys.executable,
"-m",
"pip",
"wheel",
"-vvv", # --verbose x3
"--no-deps",
"--no-cache-dir",
"--disable-pip-version-check",
]
if index_url is not None:
args += ["--index-url", index_url]
if index_url != DEFAULT_INDEX:
args += ["--trusted-host", urlparse(index_url).hostname]
if extra_index_url is not None:
args += ["--extra-index-url", extra_index_url, "--trusted-host", urlparse(extra_index_url).hostname]
if env is None:
pip_version = pip.__version__
else:
pip_version = dict(env)["pip_version"]
args[0] = dict(env)["python_executable"]
if int(pip_version.split(".")[0]) >= 10:
args.append("--progress-bar=off")
return args
def _get_wheel_args(index_url, env, extra_index_url):
args = [
sys.executable,
"-m",
"pip",
"wheel",
"-vvv", # --verbose x3
"--no-deps",
"--no-cache-dir",
"--disable-pip-version-check",
]
if index_url is not None:
args += ["--index-url", index_url]
if index_url != DEFAULT_INDEX:
args += ["--trusted-host", urlparse(index_url).hostname]
if extra_index_url is not None:
args += ["--extra-index-url", extra_index_url, "--trusted-host", urlparse(extra_index_url).hostname]
if env is None:
pip_version = pip.__version__
else:
pip_version = dict(env)["pip_version"]
args[0] = dict(env)["python_executable"]
if int(pip_version.split(".")[0]) >= 10:
args.append("--progress-bar=off")
return args
def _download_dist(url, scratch_file, index_url, extra_index_url):
auth = None
if index_url:
parsed = urlparse(index_url)
if parsed.username and parsed.password and parsed.hostname == urlparse(url).hostname:
# handling private PyPI credentials in index_url
auth = (parsed.username, parsed.password)
if extra_index_url:
parsed = urlparse(extra_index_url)
if parsed.username and parsed.password and parsed.hostname == urlparse(url).hostname:
# handling private PyPI credentials in extra_index_url
auth = (parsed.username, parsed.password)
target, _headers = urlretrieve(url, scratch_file, auth=auth)
return target, _headers
def _download_dist(url, scratch_file, index_url, extra_index_url):
auth = None
if index_url:
parsed = urlparse(index_url)
if parsed.username and parsed.password and parsed.hostname == urlparse(url).hostname:
# handling private PyPI credentials in index_url
auth = (parsed.username, parsed.password)
if extra_index_url:
parsed = urlparse(extra_index_url)
if parsed.username and parsed.password and parsed.hostname == urlparse(url).hostname:
# handling private PyPI credentials in extra_index_url
auth = (parsed.username, parsed.password)
target, _headers = urlretrieve(url, scratch_file, auth=auth)
return target, _headers