19
19
20
20
21
21
@click .command ()
22
-
23
- @click .option ('-r' , '--requirements-file' ,
22
+ @click .option (
23
+ "-r" ,
24
+ "--requirements-file" ,
24
25
type = click .Path (exists = True , readable = True , path_type = str , dir_okay = False ),
25
- metavar = ' FILE' ,
26
+ metavar = " FILE" ,
26
27
multiple = True ,
27
- default = [' requirements.txt' ],
28
+ default = [" requirements.txt" ],
28
29
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." ,
30
31
)
31
- @click .option ('-d' , '--thirdparty-dir' ,
32
+ @click .option (
33
+ "-d" ,
34
+ "--thirdparty-dir" ,
32
35
type = click .Path (exists = True , readable = True , path_type = str , file_okay = False ),
33
- metavar = ' DIR' ,
36
+ metavar = " DIR" ,
34
37
default = utils_thirdparty .THIRDPARTY_DIR ,
35
38
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." ,
38
41
)
39
- @click .option ('-p' , '--python-version' ,
42
+ @click .option (
43
+ "-p" ,
44
+ "--python-version" ,
40
45
type = click .Choice (utils_thirdparty .PYTHON_VERSIONS ),
41
- metavar = ' PYVER' ,
46
+ metavar = " PYVER" ,
42
47
default = utils_thirdparty .PYTHON_VERSIONS ,
43
48
show_default = True ,
44
49
multiple = True ,
45
- help = ' Python version(s) to use for this build.' ,
50
+ help = " Python version(s) to use for this build." ,
46
51
)
47
- @click .option ('-o' , '--operating-system' ,
52
+ @click .option (
53
+ "-o" ,
54
+ "--operating-system" ,
48
55
type = click .Choice (utils_thirdparty .PLATFORMS_BY_OS ),
49
- metavar = 'OS' ,
56
+ metavar = "OS" ,
50
57
default = tuple (utils_thirdparty .PLATFORMS_BY_OS ),
51
58
multiple = True ,
52
59
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." ,
54
61
)
55
- @click .option ('-l' , '--latest-version' ,
62
+ @click .option (
63
+ "-l" ,
64
+ "--latest-version" ,
56
65
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." ,
58
67
)
59
- @click .option ('--sync-dejacode' ,
68
+ @click .option (
69
+ "--sync-dejacode" ,
60
70
is_flag = True ,
61
- help = ' Synchronize packages with DejaCode.' ,
71
+ help = " Synchronize packages with DejaCode." ,
62
72
)
63
- @click .option ('--with-deps' ,
73
+ @click .option (
74
+ "--with-deps" ,
64
75
is_flag = True ,
65
- help = ' Also include all dependent wheels.' ,
76
+ help = " Also include all dependent wheels." ,
66
77
)
67
- @click .help_option ('-h' , ' --help' )
78
+ @click .help_option ("-h" , " --help" )
68
79
def bootstrap (
69
80
requirements_file ,
70
81
thirdparty_dir ,
@@ -105,18 +116,19 @@ def bootstrap(
105
116
required_name_versions = set ()
106
117
107
118
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 )
110
120
required_name_versions .update (nvs )
111
121
if latest_version :
112
122
required_name_versions = set ((name , None ) for name , _ver in required_name_versions )
113
123
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
+ )
115
127
116
128
# fetch all available wheels, keep track of missing
117
129
# start with local, then remote, then PyPI
118
130
119
- print (' ==> COLLECTING ALREADY LOCALLY AVAILABLE REQUIRED WHEELS' )
131
+ print (" ==> COLLECTING ALREADY LOCALLY AVAILABLE REQUIRED WHEELS" )
120
132
# list of all the wheel filenames either pre-existing, fetched or built
121
133
# updated as we progress
122
134
available_wheel_filenames = []
@@ -131,19 +143,32 @@ def bootstrap(
131
143
132
144
# start with a local check
133
145
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
+ )
135
152
if local_pack :
136
153
supported_wheels = list (local_pack .get_supported_wheels (environment = envt ))
137
154
if supported_wheels :
138
155
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
+ )
142
161
continue
143
162
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
+ )
145
170
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" )
147
172
148
173
# list of (name, version, environment) not fetch and to build
149
174
name_version_envt_to_build = []
@@ -161,52 +186,59 @@ def bootstrap(
161
186
if fetched_fwn :
162
187
available_wheel_filenames .append (fetched_fwn )
163
188
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
+ )
165
196
166
197
# At this stage we have all the wheels we could obtain without building
167
198
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
+ )
170
203
171
204
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
174
206
]
175
207
176
- print (f' ==> BUILDING #{ len (packages_and_envts_to_build )} MISSING WHEELS' )
208
+ print (f" ==> BUILDING #{ len (packages_and_envts_to_build )} MISSING WHEELS" )
177
209
178
210
package_envts_not_built , wheel_filenames_built = utils_thirdparty .build_missing_wheels (
179
211
packages_and_envts = packages_and_envts_to_build ,
180
212
build_remotely = build_remotely ,
181
213
with_deps = with_deps ,
182
214
dest_dir = thirdparty_dir ,
183
- )
215
+ )
184
216
if wheel_filenames_built :
185
217
available_wheel_filenames .extend (available_wheel_filenames )
186
218
187
219
for pack , envt in package_envts_not_built :
188
220
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 } "
191
223
)
192
224
193
- print (f' ==> FETCHING SOURCE DISTRIBUTIONS' )
225
+ print (f" ==> FETCHING SOURCE DISTRIBUTIONS" )
194
226
# fetch all sources, keep track of missing
195
227
# This is a list of (name, version)
196
228
utils_thirdparty .fetch_missing_sources (dest_dir = thirdparty_dir )
197
229
198
- print (f' ==> FETCHING ABOUT AND LICENSE FILES' )
230
+ print (f" ==> FETCHING ABOUT AND LICENSE FILES" )
199
231
utils_thirdparty .add_fetch_or_update_about_and_license_files (dest_dir = thirdparty_dir )
200
232
201
233
############################################################################
202
234
if sync_dejacode :
203
- print (f' ==> SYNC WITH DEJACODE' )
235
+ print (f" ==> SYNC WITH DEJACODE" )
204
236
# try to fetch from DejaCode any missing ABOUT
205
237
# create all missing DejaCode packages
206
238
pass
207
239
208
240
utils_thirdparty .find_problems (dest_dir = thirdparty_dir )
209
241
210
242
211
- if __name__ == ' __main__' :
243
+ if __name__ == " __main__" :
212
244
bootstrap ()
0 commit comments