mirror of
https://github.com/pmeier/light-the-torch.git
synced 2024-09-08 23:29:28 +03:00
always use --index-url (#141)
This commit is contained in:
@@ -5,7 +5,6 @@ import functools
|
||||
import itertools
|
||||
import optparse
|
||||
import os
|
||||
import platform
|
||||
import re
|
||||
import sys
|
||||
import unittest.mock
|
||||
@@ -253,7 +252,7 @@ def patch_cli_options():
|
||||
yield
|
||||
|
||||
|
||||
def get_extra_index_urls(computation_backends, channel):
|
||||
def get_index_urls(computation_backends, channel):
|
||||
if channel == Channel.STABLE:
|
||||
channel_paths = [""]
|
||||
else:
|
||||
@@ -284,9 +283,7 @@ def patch_link_collection_with_supply_chain_attack_mitigation(
|
||||
{
|
||||
requirement.name
|
||||
for requirement in input.root_reqs
|
||||
if requirement.user_supplied
|
||||
and not is_pinned(requirement)
|
||||
and requirement.name in THIRD_PARTY_PACKAGES
|
||||
if requirement.user_supplied and is_pinned(requirement)
|
||||
},
|
||||
):
|
||||
yield
|
||||
@@ -305,12 +302,10 @@ def patch_link_collection_with_supply_chain_attack_mitigation(
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
def patch_link_collection(
|
||||
computation_backends, channel, user_supplied_third_party_packages
|
||||
):
|
||||
def patch_link_collection(computation_backends, channel, user_supplied_pinned_packages):
|
||||
search_scope = SearchScope(
|
||||
find_links=[],
|
||||
index_urls=get_extra_index_urls(computation_backends, channel),
|
||||
index_urls=get_index_urls(computation_backends, channel),
|
||||
no_index=False,
|
||||
)
|
||||
|
||||
@@ -319,9 +314,8 @@ def patch_link_collection(
|
||||
if not (
|
||||
input.project_name in PYTORCH_DISTRIBUTIONS
|
||||
or (
|
||||
channel == Channel.NIGHTLY
|
||||
and platform.system() == "Linux"
|
||||
and input.project_name not in user_supplied_third_party_packages
|
||||
input.project_name in THIRD_PARTY_PACKAGES
|
||||
and input.project_name not in user_supplied_pinned_packages
|
||||
)
|
||||
):
|
||||
yield
|
||||
|
||||
@@ -8,7 +8,7 @@ from bs4 import BeautifulSoup
|
||||
from light_the_torch._cb import _MINIMUM_DRIVER_VERSIONS, CPUBackend, CUDABackend
|
||||
from light_the_torch._patch import (
|
||||
Channel,
|
||||
get_extra_index_urls,
|
||||
get_index_urls,
|
||||
PYTORCH_DISTRIBUTIONS,
|
||||
THIRD_PARTY_PACKAGES,
|
||||
)
|
||||
@@ -40,11 +40,10 @@ COMPUTATION_BACKENDS = {
|
||||
}
|
||||
COMPUTATION_BACKENDS.add(CPUBackend())
|
||||
|
||||
EXTRA_INDEX_URLS = sorted(
|
||||
INDEX_URLS = sorted(
|
||||
set(
|
||||
itertools.chain.from_iterable(
|
||||
get_extra_index_urls(COMPUTATION_BACKENDS, channel)
|
||||
for channel in iter(Channel)
|
||||
get_index_urls(COMPUTATION_BACKENDS, channel) for channel in iter(Channel)
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -52,7 +51,7 @@ EXTRA_INDEX_URLS = sorted(
|
||||
|
||||
def main():
|
||||
available = set()
|
||||
for url in tqdm.tqdm(EXTRA_INDEX_URLS):
|
||||
for url in tqdm.tqdm(INDEX_URLS):
|
||||
response = requests.get(url)
|
||||
if not response.ok:
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user