34
34
version = '3.9.2'
35
35
major_minor_version = '.' .join (version .split ('.' )[:2 ]) # e.g. '3.9.2' -> '3.9'
36
36
download_url = 'https://www.nuget.org/api/v2/package/python/%s' % version
37
+ # This is not part of official Python version, but a repackaging number appended by emsdk
38
+ # when a version of Python needs to be redownloaded.
37
39
revision = '4'
38
40
39
41
pywin32_version = '227'
@@ -70,11 +72,12 @@ def make_python_patch():
70
72
urllib .request .urlretrieve (url , pywin32_filename )
71
73
72
74
if not os .path .exists (filename ):
73
- print ('Downloading python: ' + download_url )
75
+ print (f 'Downloading python: { download_url } to { filename } ' )
74
76
urllib .request .urlretrieve (download_url , filename )
75
77
76
78
os .mkdir ('python-nuget' )
77
79
check_call (unzip_cmd () + [os .path .abspath (filename )], cwd = 'python-nuget' )
80
+ os .remove (filename )
78
81
79
82
os .mkdir ('pywin32' )
80
83
rtn = subprocess .call (unzip_cmd () + [os .path .abspath (pywin32_filename )], cwd = 'pywin32' )
@@ -84,12 +87,12 @@ def make_python_patch():
84
87
shutil .move (os .path .join ('pywin32' , 'PLATLIB' ), os .path .join ('python-nuget' , 'toolss' , 'Lib' , 'site-packages' ))
85
88
86
89
check_call (zip_cmd () + [os .path .join ('..' , '..' , out_filename ), '.' ], cwd = 'python-nuget/tools' )
90
+ print ('Created: %s' % out_filename )
87
91
88
92
# cleanup if everything went fine
89
93
shutil .rmtree ('python-nuget' )
90
94
shutil .rmtree ('pywin32' )
91
95
92
- print ('Created: %s' % out_filename )
93
96
if '--upload' in sys .argv :
94
97
upload_url = upload_base + out_filename
95
98
print ('Uploading: ' + upload_url )
@@ -153,6 +156,10 @@ def build_python():
153
156
pybin = os .path .join (src_dir , 'install' , 'usr' , 'local' , 'bin' , 'python3' )
154
157
pip = os .path .join (src_dir , 'install' , 'usr' , 'local' , 'bin' , 'pip3' )
155
158
check_call ([pybin , '-m' , 'ensurepip' , '--upgrade' ])
159
+ # TODO: Potential bug: the following cmdline does not pin down a version
160
+ # of requests module, resulting in possibly different version of the module
161
+ # being installed on future runs. Switch to pip install requests==<version> to
162
+ # to download a pinned version.
156
163
check_call ([pybin , pip , 'install' , 'requests' ])
157
164
158
165
# Install psutil module. This is needed by emrun to track when browser
0 commit comments