79
79
'faulthandler' ,
80
80
}
81
81
82
+ # Used to annotate licenses.
83
+ EXTENSION_TO_LIBRARY_DOWNLOADS_ENTRY = {
84
+ '_bz2' : 'bzip2' ,
85
+ '_ctypes' : 'libffi' ,
86
+ '_hashlib' : 'openssl' ,
87
+ '_lzma' : 'xz' ,
88
+ '_sqlite3' : 'sqlite' ,
89
+ '_ssl' : 'openssl' ,
90
+ '_uuid' : 'uuid' ,
91
+ 'zlib' : 'zlib' ,
92
+ }
93
+
82
94
83
95
def log (msg ):
84
96
if isinstance (msg , bytes ):
@@ -1204,6 +1216,16 @@ def find_additional_dependencies(project: pathlib.Path):
1204
1216
'path_static' : 'build/lib/%s.lib' % lib
1205
1217
})
1206
1218
1219
+ if ext in EXTENSION_TO_LIBRARY_DOWNLOADS_ENTRY :
1220
+ download_entry = DOWNLOADS [EXTENSION_TO_LIBRARY_DOWNLOADS_ENTRY [ext ]]
1221
+
1222
+ # This will raise if no license metadata defined. This is
1223
+ # intentional because EXTENSION_TO_LIBRARY_DOWNLOADS_ENTRY is
1224
+ # manually curated and we want to fail fast.
1225
+ entry ['licenses' ] = download_entry ['licenses' ]
1226
+ entry ['license_paths' ] = ['licenses/%s' % download_entry ['license_file' ]]
1227
+ entry ['license_public_domain' ] = download_entry .get ('license_public_domain' )
1228
+
1207
1229
res ['extensions' ][ext ] = [entry ]
1208
1230
1209
1231
# Copy the extension static library.
@@ -1363,9 +1385,15 @@ def build_cpython(pgo=False):
1363
1385
log ('copying %s to %s' % (source , dest ))
1364
1386
shutil .copyfile (source , dest )
1365
1387
1388
+ licenses_dir = out_dir / 'python' / 'licenses'
1389
+ licenses_dir .mkdir ()
1390
+ for f in sorted (os .listdir (ROOT )):
1391
+ if f .startswith ('LICENSE.' ) and f .endswith ('.txt' ):
1392
+ shutil .copyfile (ROOT / f , licenses_dir / f )
1393
+
1366
1394
# Create PYTHON.json file describing this distribution.
1367
1395
python_info = {
1368
- 'version' : '1 ' ,
1396
+ 'version' : '2 ' ,
1369
1397
'os' : 'windows' ,
1370
1398
'arch' : 'x86_64' ,
1371
1399
'python_flavor' : 'cpython' ,
@@ -1374,14 +1402,13 @@ def build_cpython(pgo=False):
1374
1402
'python_include' : 'install/include' ,
1375
1403
'python_stdlib' : 'install/Lib' ,
1376
1404
'build_info' : build_info ,
1405
+ 'licenses' : DOWNLOADS ['cpython-3.7' ]['licenses' ],
1406
+ 'license_path' : 'licenses/LICENSE.cpython.txt' ,
1377
1407
}
1378
1408
1379
1409
with (out_dir / 'python' / 'PYTHON.json' ).open ('w' , encoding = 'utf8' ) as fh :
1380
1410
json .dump (python_info , fh , sort_keys = True , indent = 4 )
1381
1411
1382
- # Copy software licenses file.
1383
- shutil .copyfile (ROOT / 'python-licenses.rst' , out_dir / 'python' / 'LICENSE.rst' )
1384
-
1385
1412
dest_path = BUILD / 'cpython-windows.tar'
1386
1413
1387
1414
with dest_path .open ('wb' ) as fh :
0 commit comments