Also preserve sip.exe

This commit is contained in:
Kovid Goyal 2015-12-07 13:25:38 +05:30
parent 906dd4305f
commit 62e942d7b8

View File

@ -10,6 +10,7 @@ import shutil
import os import os
import glob import glob
import stat import stat
import errno
known_extensions = { known_extensions = {
'bz2.pyd', 'bz2.pyd',
@ -56,7 +57,7 @@ def main():
sp_temp = os.path.join(install_dir, 'site-packages') sp_temp = os.path.join(install_dir, 'site-packages')
os.rename(sp_dir, sp_temp) os.rename(sp_dir, sp_temp)
for x in os.listdir(install_dir): for x in os.listdir(install_dir):
if x != 'site-packages': if x not in ('Scripts', 'site-packages', 'sip.exe'):
path = os.path.join(install_dir, x) path = os.path.join(install_dir, x)
(shutil.rmtree if os.path.isdir(path) else os.remove)(path) (shutil.rmtree if os.path.isdir(path) else os.remove)(path)
else: else:
@ -99,7 +100,11 @@ def main():
shutil.copy2(x, include_dir) shutil.copy2(x, include_dir)
# Make the Scripts dir # Make the Scripts dir
os.mkdir(os.path.join(install_dir, 'Scripts')) try:
os.mkdir(os.path.join(install_dir, 'Scripts'))
except EnvironmentError as err:
if err.errno != errno.EEXIST:
raise
# Copy the python modules in Lib # Copy the python modules in Lib
ignored_dirs = frozenset('pydoc_data test tests lib2to3 ensurepip'.split()) ignored_dirs = frozenset('pydoc_data test tests lib2to3 ensurepip'.split())