From 2334410b5bd6a576169b56ce8596bce4a55b4541 Mon Sep 17 00:00:00 2001 From: "Bryan W. Weber" Date: Sun, 2 Aug 2015 14:32:52 -0400 Subject: [PATCH] Uninstall all files properly --- SConstruct | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/SConstruct b/SConstruct index 441e0eda9..b6221d586 100644 --- a/SConstruct +++ b/SConstruct @@ -1561,13 +1561,25 @@ def getParentDirs(path, top=True): allfiles = FindInstalledFiles() # Files installed by the Python installer(s) -pyFiles = ['build/python-installed-files.txt', - 'build/python2-installed-files.txt', +pyFiles = ['build/python2-installed-files.txt', 'build/python3-installed-files.txt'] for filename in pyFiles: if os.path.exists(filename): - allfiles.extend([File(f.strip()) for f in open(filename).readlines()]) + with open(filename, 'r') as f: + file_list = f.readlines() + + install_base = os.path.dirname(file_list[0].strip()) + if os.path.exists(install_base): + not_listed_files = [s for s in os.listdir(install_base) if not any(s in j for j in file_list)] + for f in not_listed_files: + f = pjoin(install_base, f) + if not os.path.isdir(f) and os.path.exists(f): + allfiles.append(File(f)) + for f in file_list: + f = f.strip() + if not os.path.isdir(f) and os.path.exists(f): + allfiles.append(File(f)) # After removing files (which SCons keeps track of), # remove any empty directories (which SCons doesn't track)