1919
2020
2121@click .command ()
22-
23- @click .option ('-r' , '--requirements-file' ,
22+ @click .option (
23+ "-r" ,
24+ "--requirements-file" ,
2425 type = click .Path (exists = True , readable = True , path_type = str , dir_okay = False ),
25- metavar = ' FILE' ,
26+ metavar = " FILE" ,
2627 multiple = True ,
27- default = [' requirements.txt' ],
28+ default = [" requirements.txt" ],
2829 show_default = True ,
29- help = ' Path to the requirements file(s) to use for thirdparty packages.' ,
30+ help = " Path to the requirements file(s) to use for thirdparty packages." ,
3031)
31- @click .option ('-d' , '--thirdparty-dir' ,
32+ @click .option (
33+ "-d" ,
34+ "--thirdparty-dir" ,
3235 type = click .Path (exists = True , readable = True , path_type = str , file_okay = False ),
33- metavar = ' DIR' ,
36+ metavar = " DIR" ,
3437 default = utils_thirdparty .THIRDPARTY_DIR ,
3538 show_default = True ,
36- help = ' Path to the thirdparty directory where wheels are built and '
37- ' sources, ABOUT and LICENSE files fetched.' ,
39+ help = " Path to the thirdparty directory where wheels are built and "
40+ " sources, ABOUT and LICENSE files fetched." ,
3841)
39- @click .option ('-p' , '--python-version' ,
42+ @click .option (
43+ "-p" ,
44+ "--python-version" ,
4045 type = click .Choice (utils_thirdparty .PYTHON_VERSIONS ),
41- metavar = ' PYVER' ,
46+ metavar = " PYVER" ,
4247 default = utils_thirdparty .PYTHON_VERSIONS ,
4348 show_default = True ,
4449 multiple = True ,
45- help = ' Python version(s) to use for this build.' ,
50+ help = " Python version(s) to use for this build." ,
4651)
47- @click .option ('-o' , '--operating-system' ,
52+ @click .option (
53+ "-o" ,
54+ "--operating-system" ,
4855 type = click .Choice (utils_thirdparty .PLATFORMS_BY_OS ),
49- metavar = 'OS' ,
56+ metavar = "OS" ,
5057 default = tuple (utils_thirdparty .PLATFORMS_BY_OS ),
5158 multiple = True ,
5259 show_default = True ,
53- help = ' OS(ses) to use for this build: one of linux, mac or windows.' ,
60+ help = " OS(ses) to use for this build: one of linux, mac or windows." ,
5461)
55- @click .option ('-l' , '--latest-version' ,
62+ @click .option (
63+ "-l" ,
64+ "--latest-version" ,
5665 is_flag = True ,
57- help = ' Get the latest version of all packages, ignoring version specifiers.' ,
66+ help = " Get the latest version of all packages, ignoring version specifiers." ,
5867)
59- @click .option ('--sync-dejacode' ,
68+ @click .option (
69+ "--sync-dejacode" ,
6070 is_flag = True ,
61- help = ' Synchronize packages with DejaCode.' ,
71+ help = " Synchronize packages with DejaCode." ,
6272)
63- @click .option ('--with-deps' ,
73+ @click .option (
74+ "--with-deps" ,
6475 is_flag = True ,
65- help = ' Also include all dependent wheels.' ,
76+ help = " Also include all dependent wheels." ,
6677)
67- @click .help_option ('-h' , ' --help' )
78+ @click .help_option ("-h" , " --help" )
6879def bootstrap (
6980 requirements_file ,
7081 thirdparty_dir ,
@@ -105,18 +116,19 @@ def bootstrap(
105116 required_name_versions = set ()
106117
107118 for req_file in requirements_files :
108- nvs = utils_thirdparty .load_requirements (
109- requirements_file = req_file , force_pinned = False )
119+ nvs = utils_thirdparty .load_requirements (requirements_file = req_file , force_pinned = False )
110120 required_name_versions .update (nvs )
111121 if latest_version :
112122 required_name_versions = set ((name , None ) for name , _ver in required_name_versions )
113123
114- print (f'PROCESSING { len (required_name_versions )} REQUIREMENTS in { len (requirements_files )} FILES' )
124+ print (
125+ f"PROCESSING { len (required_name_versions )} REQUIREMENTS in { len (requirements_files )} FILES"
126+ )
115127
116128 # fetch all available wheels, keep track of missing
117129 # start with local, then remote, then PyPI
118130
119- print (' ==> COLLECTING ALREADY LOCALLY AVAILABLE REQUIRED WHEELS' )
131+ print (" ==> COLLECTING ALREADY LOCALLY AVAILABLE REQUIRED WHEELS" )
120132 # list of all the wheel filenames either pre-existing, fetched or built
121133 # updated as we progress
122134 available_wheel_filenames = []
@@ -131,19 +143,32 @@ def bootstrap(
131143
132144 # start with a local check
133145 for (name , version ), envt in itertools .product (required_name_versions , environments ):
134- local_pack = local_packages_by_namever .get ((name , version ,))
146+ local_pack = local_packages_by_namever .get (
147+ (
148+ name ,
149+ version ,
150+ )
151+ )
135152 if local_pack :
136153 supported_wheels = list (local_pack .get_supported_wheels (environment = envt ))
137154 if supported_wheels :
138155 available_wheel_filenames .extend (w .filename for w in supported_wheels )
139- print (f'====> No fetch or build needed. '
140- f'Local wheel already available for { name } =={ version } '
141- f'on os: { envt .operating_system } for Python: { envt .python_version } ' )
156+ print (
157+ f"====> No fetch or build needed. "
158+ f"Local wheel already available for { name } =={ version } "
159+ f"on os: { envt .operating_system } for Python: { envt .python_version } "
160+ )
142161 continue
143162
144- name_version_envt_to_fetch .append ((name , version , envt ,))
163+ name_version_envt_to_fetch .append (
164+ (
165+ name ,
166+ version ,
167+ envt ,
168+ )
169+ )
145170
146- print (f' ==> TRYING TO FETCH #{ len (name_version_envt_to_fetch )} REQUIRED WHEELS' )
171+ print (f" ==> TRYING TO FETCH #{ len (name_version_envt_to_fetch )} REQUIRED WHEELS" )
147172
148173 # list of (name, version, environment) not fetch and to build
149174 name_version_envt_to_build = []
@@ -161,52 +186,59 @@ def bootstrap(
161186 if fetched_fwn :
162187 available_wheel_filenames .append (fetched_fwn )
163188 else :
164- name_version_envt_to_build .append ((name , version , envt ,))
189+ name_version_envt_to_build .append (
190+ (
191+ name ,
192+ version ,
193+ envt ,
194+ )
195+ )
165196
166197 # At this stage we have all the wheels we could obtain without building
167198 for name , version , envt in name_version_envt_to_build :
168- print (f'====> Need to build wheels for { name } =={ version } on os: '
169- f'{ envt .operating_system } for Python: { envt .python_version } ' )
199+ print (
200+ f"====> Need to build wheels for { name } =={ version } on os: "
201+ f"{ envt .operating_system } for Python: { envt .python_version } "
202+ )
170203
171204 packages_and_envts_to_build = [
172- (PypiPackage (name , version ), envt )
173- for name , version , envt in name_version_envt_to_build
205+ (PypiPackage (name , version ), envt ) for name , version , envt in name_version_envt_to_build
174206 ]
175207
176- print (f' ==> BUILDING #{ len (packages_and_envts_to_build )} MISSING WHEELS' )
208+ print (f" ==> BUILDING #{ len (packages_and_envts_to_build )} MISSING WHEELS" )
177209
178210 package_envts_not_built , wheel_filenames_built = utils_thirdparty .build_missing_wheels (
179211 packages_and_envts = packages_and_envts_to_build ,
180212 build_remotely = build_remotely ,
181213 with_deps = with_deps ,
182214 dest_dir = thirdparty_dir ,
183- )
215+ )
184216 if wheel_filenames_built :
185217 available_wheel_filenames .extend (available_wheel_filenames )
186218
187219 for pack , envt in package_envts_not_built :
188220 print (
189- f' ====> FAILED to build any wheel for { pack .name } =={ pack .version } '
190- f' on os: { envt .operating_system } for Python: { envt .python_version } '
221+ f" ====> FAILED to build any wheel for { pack .name } =={ pack .version } "
222+ f" on os: { envt .operating_system } for Python: { envt .python_version } "
191223 )
192224
193- print (f' ==> FETCHING SOURCE DISTRIBUTIONS' )
225+ print (f" ==> FETCHING SOURCE DISTRIBUTIONS" )
194226 # fetch all sources, keep track of missing
195227 # This is a list of (name, version)
196228 utils_thirdparty .fetch_missing_sources (dest_dir = thirdparty_dir )
197229
198- print (f' ==> FETCHING ABOUT AND LICENSE FILES' )
230+ print (f" ==> FETCHING ABOUT AND LICENSE FILES" )
199231 utils_thirdparty .add_fetch_or_update_about_and_license_files (dest_dir = thirdparty_dir )
200232
201233 ############################################################################
202234 if sync_dejacode :
203- print (f' ==> SYNC WITH DEJACODE' )
235+ print (f" ==> SYNC WITH DEJACODE" )
204236 # try to fetch from DejaCode any missing ABOUT
205237 # create all missing DejaCode packages
206238 pass
207239
208240 utils_thirdparty .find_problems (dest_dir = thirdparty_dir )
209241
210242
211- if __name__ == ' __main__' :
243+ if __name__ == " __main__" :
212244 bootstrap ()
0 commit comments