Python module files are also uninstalled with 'scons uninstall'
This commit is contained in:
parent
35f694a681
commit
ae572058e0
2 changed files with 11 additions and 4 deletions
11
SConstruct
11
SConstruct
|
|
@ -1234,6 +1234,14 @@ def getParentDirs(path, top=True):
|
|||
else:
|
||||
return getParentDirs(head, False) + [path]
|
||||
|
||||
# Files installed by SCons
|
||||
allfiles = FindInstalledFiles()
|
||||
|
||||
# Files installed by the Python installer
|
||||
pyFiles = 'build/python-installed-files.txt'
|
||||
if os.path.exists(pyFiles):
|
||||
allfiles.extend([File(f.strip()) for f in open(pyFiles).readlines()])
|
||||
|
||||
# After removing files (which SCons keeps track of),
|
||||
# remove any empty directories (which SCons doesn't track)
|
||||
def removeDirectories(target, source, env):
|
||||
|
|
@ -1250,14 +1258,13 @@ def removeDirectories(target, source, env):
|
|||
# Don't remove directories that probably existed before installation,
|
||||
# even if they are empty
|
||||
keepDirs = ['local/share', 'local/lib', 'local/include', 'local/bin',
|
||||
'man/man1']
|
||||
'man/man1', 'dist-packages', 'site-packages']
|
||||
for d in alldirs:
|
||||
if any(d.endswith(k) for k in keepDirs):
|
||||
continue
|
||||
if os.path.isdir(d) and not os.listdir(d):
|
||||
os.rmdir(d)
|
||||
|
||||
allfiles = FindInstalledFiles()
|
||||
uninstall = env.Command("uninstall", None, Delete(allfiles))
|
||||
env.AddPostAction(uninstall, Action(removeDirectories))
|
||||
|
||||
|
|
|
|||
|
|
@ -89,10 +89,10 @@ else:
|
|||
|
||||
if localenv['PYTHON_INSTALLER'] == 'direct':
|
||||
install(localenv.Command, 'dummy', pymodule,
|
||||
'cd %s && $python_cmd setup.py install %s' % (moddir,extra))
|
||||
'cd %s && $python_cmd setup.py install --record ../../build/python-installed-files.txt %s' % (moddir,extra))
|
||||
elif localenv['PYTHON_INSTALLER'] == 'debian':
|
||||
install(localenv.Command, 'dummy', pymodule,
|
||||
'cd %s && $python_cmd setup.py install %s --install-layout=deb --no-compile' % (moddir,extra))
|
||||
'cd %s && $python_cmd setup.py install %s --install-layout=deb --no-compile' % (moddir,extra))
|
||||
elif localenv['PYTHON_INSTALLER'] == 'binary':
|
||||
install(localenv.Command, 'dummy', pymodule,
|
||||
'cd %s && $python_cmd setup.py bdist_msi --dist-dir=../..' % moddir +
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue