@@ -75,10 +75,12 @@ def include_in_tools(p):
7575 return p .suffix .lower () in {'.py' , '.pyw' , '.txt' }
7676
7777FULL_LAYOUT = [
78- ('/' , 'PCBuild/$arch' , 'python*.exe' , is_not_debug ),
79- ('/' , 'PCBuild/$arch' , 'python*.dll' , is_not_debug ),
78+ ('/' , 'PCBuild/$arch' , 'python.exe' , is_not_debug ),
79+ ('/' , 'PCBuild/$arch' , 'pythonw.exe' , is_not_debug ),
80+ ('/' , 'PCBuild/$arch' , 'python{0.major}.dll' .format (sys .version_info ), is_not_debug ),
81+ ('/' , 'PCBuild/$arch' , 'python{0.major}{0.minor}.dll' .format (sys .version_info ), is_not_debug ),
8082 ('DLLs/' , 'PCBuild/$arch' , '*.pyd' , is_not_debug ),
81- ('DLLs/' , 'PCBuild/$arch' , '*.dll' , is_not_debug ),
83+ ('DLLs/' , 'PCBuild/$arch' , '*.dll' , is_not_debug_or_python ),
8284 ('include/' , 'include' , '*.h' , None ),
8385 ('include/' , 'PC' , 'pyconfig.h' , None ),
8486 ('Lib/' , 'Lib' , '**/*' , include_in_lib ),
@@ -150,17 +152,17 @@ def rglob(root, pattern, condition):
150152def main ():
151153 parser = argparse .ArgumentParser ()
152154 parser .add_argument ('-s' , '--source' , metavar = 'dir' , help = 'The directory containing the repository root' , type = Path )
153- parser .add_argument ('-o' , '--out' , metavar = 'file' , help = 'The name of the output self-extracting archive' , type = Path , required = True )
155+ parser .add_argument ('-o' , '--out' , metavar = 'file' , help = 'The name of the output self-extracting archive' , type = Path , default = None )
154156 parser .add_argument ('-t' , '--temp' , metavar = 'dir' , help = 'A directory to temporarily extract files into' , type = Path , default = None )
155157 parser .add_argument ('-e' , '--embed' , help = 'Create an embedding layout' , action = 'store_true' , default = False )
156158 parser .add_argument ('-a' , '--arch' , help = 'Specify the architecture to use (win32/amd64)' , type = str , default = "win32" )
157159 ns = parser .parse_args ()
158160
159- source = ns .source or (Path (__file__ ).parent .parent .parent )
161+ source = ns .source or (Path (__file__ ).resolve (). parent .parent .parent )
160162 out = ns .out
161163 arch = ns .arch
162164 assert isinstance (source , Path )
163- assert isinstance (out , Path )
165+ assert not out or isinstance (out , Path )
164166 assert isinstance (arch , str )
165167
166168 if ns .temp :
@@ -170,10 +172,11 @@ def main():
170172 temp = Path (tempfile .mkdtemp ())
171173 delete_temp = True
172174
173- try :
174- out .parent .mkdir (parents = True )
175- except FileExistsError :
176- pass
175+ if out :
176+ try :
177+ out .parent .mkdir (parents = True )
178+ except FileExistsError :
179+ pass
177180 try :
178181 temp .mkdir (parents = True )
179182 except FileExistsError :
@@ -190,8 +193,9 @@ def main():
190193 with open (str (temp / 'pyvenv.cfg' ), 'w' ) as f :
191194 print ('applocal = true' , file = f )
192195
193- total = copy_to_layout (out , rglob (temp , '*' , None ))
194- print ('Wrote {} files to {}' .format (total , out ))
196+ if out :
197+ total = copy_to_layout (out , rglob (temp , '**/*' , None ))
198+ print ('Wrote {} files to {}' .format (total , out ))
195199 finally :
196200 if delete_temp :
197201 shutil .rmtree (temp , True )
0 commit comments