@@ -92,23 +92,23 @@ def include_in_tools(p):
9292 return p .suffix .lower () in {'.py' , '.pyw' , '.txt' }
9393
9494FULL_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 ),
101101 ('include/' , 'include' , '*.h' , None ),
102102 ('include/' , 'PC' , 'pyconfig.h' , None ),
103103 ('Lib/' , 'Lib' , '**/*' , include_in_lib ),
104- ('libs/' , '$build ' , '*.lib' , include_in_libs ),
104+ ('libs/' , 'PCBuild/$arch ' , '*.lib' , include_in_libs ),
105105 ('Tools/' , 'Tools' , '**/*' , include_in_tools ),
106106]
107107
108108EMBED_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 ),
112112 ('python{0.major}{0.minor}.zip' .format (sys .version_info ), 'Lib' , '**/*' , include_in_lib ),
113113]
114114
@@ -170,18 +170,18 @@ def rglob(root, pattern, condition):
170170def main ():
171171 parser = argparse .ArgumentParser ()
172172 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 )
174174 parser .add_argument ('-t' , '--temp' , metavar = 'dir' , help = 'A directory to temporarily extract files into' , type = Path , default = None )
175175 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" )
177177 ns = parser .parse_args ()
178178
179179 source = ns .source or (Path (__file__ ).resolve ().parent .parent .parent )
180180 out = ns .out
181- build = ns .build
181+ arch = ns .arch
182182 assert isinstance (source , Path )
183183 assert not out or isinstance (out , Path )
184- assert isinstance (build , Path )
184+ assert isinstance (arch , str )
185185
186186 if ns .temp :
187187 temp = ns .temp
@@ -204,16 +204,14 @@ def main():
204204
205205 try :
206206 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 )
211208 copied = copy_to_layout (temp / t .rstrip ('/' ), rglob (s , p , c ))
212209 print ('Copied {} files' .format (copied ))
213210
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 )
217215
218216 if out :
219217 total = copy_to_layout (out , rglob (temp , '**/*' , None ))
0 commit comments