88# See https://github.com/nexB/scancode-toolkit for support or download.
99# See https://aboutcode.org for more information about nexB OSS projects.
1010#
11+ import itertools
12+
1113import click
1214
1315import utils_thirdparty
14- import itertools
1516
1617
1718@click .command ()
6364 is_flag = True ,
6465 help = 'Fetch only the corresponding source distributions.' ,
6566)
67+ @click .option ('-u' , '--remote-links-url' ,
68+ type = str ,
69+ metavar = 'URL' ,
70+ default = utils_thirdparty .REMOTE_LINKS_URL ,
71+ show_default = True ,
72+ help = 'URL to a PyPI-like links web site. '
73+ 'Or local path to a directory with wheels.' ,
74+ )
75+
6676@click .help_option ('-h' , '--help' )
6777def fetch_requirements (
6878 requirements_file ,
@@ -73,6 +83,7 @@ def fetch_requirements(
7383 with_about ,
7484 allow_unpinned ,
7585 only_sources ,
86+ remote_links_url = utils_thirdparty .REMOTE_LINKS_URL ,
7687):
7788 """
7889 Fetch and save to THIRDPARTY_DIR all the required wheels for pinned
@@ -82,7 +93,9 @@ def fetch_requirements(
8293 Also fetch the corresponding .ABOUT, .LICENSE and .NOTICE files together
8394 with a virtualenv.pyz app.
8495
85- Use exclusively our remote repository (and not PyPI).
96+ Use exclusively wheel not from PyPI but rather found in the PyPI-like link
97+ repo ``remote_links_url`` if this is a URL. Treat this ``remote_links_url``
98+ as a local directory path to a wheels directory if this is not a a URL.
8699 """
87100
88101 # fetch wheels
@@ -93,23 +106,28 @@ def fetch_requirements(
93106 if not only_sources :
94107 envs = itertools .product (python_versions , operating_systems )
95108 envs = (utils_thirdparty .Environment .from_pyver_and_os (pyv , os ) for pyv , os in envs )
109+
96110 for env , reqf in itertools .product (envs , requirements_files ):
111+
97112 for package , error in utils_thirdparty .fetch_wheels (
98113 environment = env ,
99114 requirements_file = reqf ,
100115 allow_unpinned = allow_unpinned ,
101116 dest_dir = thirdparty_dir ,
117+ remote_links_url = remote_links_url ,
102118 ):
103119 if error :
104120 print ('Failed to fetch wheel:' , package , ':' , error )
105121
106122 # optionally fetch sources
107123 if with_sources or only_sources :
124+
108125 for reqf in requirements_files :
109126 for package , error in utils_thirdparty .fetch_sources (
110127 requirements_file = reqf ,
111128 allow_unpinned = allow_unpinned ,
112129 dest_dir = thirdparty_dir ,
130+ remote_links_url = remote_links_url ,
113131 ):
114132 if error :
115133 print ('Failed to fetch source:' , package , ':' , error )
0 commit comments