@@ -92,23 +92,23 @@ def include_in_tools(p):
92
92
return p .suffix .lower () in {'.py' , '.pyw' , '.txt' }
93
93
94
94
FULL_LAYOUT = [
95
- ('/' , '$build ' , 'python.exe' , is_not_debug ),
96
- ('/' , '$build ' , 'pythonw.exe' , is_not_debug ),
97
- ('/' , '$build ' , 'python{0.major}.dll' .format (sys .version_info ), is_not_debug ),
98
- ('/' , '$build ' , 'python{0.major}{0.minor}.dll' .format (sys .version_info ), is_not_debug ),
99
- ('DLLs/' , '$build ' , '*.pyd' , is_not_debug ),
100
- ('DLLs/' , '$build ' , '*.dll' , is_not_debug_or_python ),
95
+ ('/' , 'PCBuild/$arch ' , 'python.exe' , is_not_debug ),
96
+ ('/' , 'PCBuild/$arch ' , 'pythonw.exe' , is_not_debug ),
97
+ ('/' , 'PCBuild/$arch ' , 'python{0.major}.dll' .format (sys .version_info ), is_not_debug ),
98
+ ('/' , 'PCBuild/$arch ' , 'python{0.major}{0.minor}.dll' .format (sys .version_info ), is_not_debug ),
99
+ ('DLLs/' , 'PCBuild/$arch ' , '*.pyd' , is_not_debug ),
100
+ ('DLLs/' , 'PCBuild/$arch ' , '*.dll' , is_not_debug_or_python ),
101
101
('include/' , 'include' , '*.h' , None ),
102
102
('include/' , 'PC' , 'pyconfig.h' , None ),
103
103
('Lib/' , 'Lib' , '**/*' , include_in_lib ),
104
- ('libs/' , '$build ' , '*.lib' , include_in_libs ),
104
+ ('libs/' , 'PCBuild/$arch ' , '*.lib' , include_in_libs ),
105
105
('Tools/' , 'Tools' , '**/*' , include_in_tools ),
106
106
]
107
107
108
108
EMBED_LAYOUT = [
109
- ('/' , '$build ' , 'python*.exe' , is_not_debug ),
110
- ('/' , '$build ' , '*.pyd' , is_not_debug ),
111
- ('/' , '$build ' , '*.dll' , is_not_debug ),
109
+ ('/' , 'PCBuild/$arch ' , 'python*.exe' , is_not_debug ),
110
+ ('/' , 'PCBuild/$arch ' , '*.pyd' , is_not_debug ),
111
+ ('/' , 'PCBuild/$arch ' , '*.dll' , is_not_debug ),
112
112
('python{0.major}{0.minor}.zip' .format (sys .version_info ), 'Lib' , '**/*' , include_in_lib ),
113
113
]
114
114
@@ -170,18 +170,18 @@ def rglob(root, pattern, condition):
170
170
def main ():
171
171
parser = argparse .ArgumentParser ()
172
172
parser .add_argument ('-s' , '--source' , metavar = 'dir' , help = 'The directory containing the repository root' , type = Path )
173
- parser .add_argument ('-o' , '--out' , metavar = 'file' , help = 'The name of the output archive' , type = Path , default = None )
173
+ parser .add_argument ('-o' , '--out' , metavar = 'file' , help = 'The name of the output self-extracting archive' , type = Path , default = None )
174
174
parser .add_argument ('-t' , '--temp' , metavar = 'dir' , help = 'A directory to temporarily extract files into' , type = Path , default = None )
175
175
parser .add_argument ('-e' , '--embed' , help = 'Create an embedding layout' , action = 'store_true' , default = False )
176
- parser .add_argument ('-b ' , '--build ' , help = 'Specify the build directory ' , type = Path )
176
+ parser .add_argument ('-a ' , '--arch ' , help = 'Specify the architecture to use (win32/amd64) ' , type = str , default = "win32" )
177
177
ns = parser .parse_args ()
178
178
179
179
source = ns .source or (Path (__file__ ).resolve ().parent .parent .parent )
180
180
out = ns .out
181
- build = ns .build
181
+ arch = ns .arch
182
182
assert isinstance (source , Path )
183
183
assert not out or isinstance (out , Path )
184
- assert isinstance (build , Path )
184
+ assert isinstance (arch , str )
185
185
186
186
if ns .temp :
187
187
temp = ns .temp
@@ -204,16 +204,14 @@ def main():
204
204
205
205
try :
206
206
for t , s , p , c in layout :
207
- if s == '$build' :
208
- s = build
209
- else :
210
- s = source / s
207
+ s = source / s .replace ("$arch" , arch )
211
208
copied = copy_to_layout (temp / t .rstrip ('/' ), rglob (s , p , c ))
212
209
print ('Copied {} files' .format (copied ))
213
210
214
- with open (str (temp / 'sys.path' ), 'w' ) as f :
215
- print ('python{0.major}{0.minor}.zip' .format (sys .version_info ), file = f )
216
- print ('.' , file = f )
211
+ if ns .embed :
212
+ with open (str (temp / 'sys.path' ), 'w' ) as f :
213
+ print ('python{0.major}{0.minor}.zip' .format (sys .version_info ), file = f )
214
+ print ('.' , file = f )
217
215
218
216
if out :
219
217
total = copy_to_layout (out , rglob (temp , '**/*' , None ))
0 commit comments