gpsd-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gpsd-dev] [PATCH 1/4] Fixes uninstall to remove Python package director


From: Fred Wright
Subject: [gpsd-dev] [PATCH 1/4] Fixes uninstall to remove Python package directory.
Date: Sat, 16 Apr 2016 00:01:10 -0700

Uninstall was removing the contents of the Python package directory,
but not the directory itself.  There's an asymmetry where an
unmentioned directory is created automatically when needed, but not
removed when it's rendered empty.

In Python 2, this is a fairly harmless error, albeit slightly unclean,
since directories lacking an __init__.py file are ignored by the
import logic.  But in Python 3, which allows the init file to be
omitted, leaving the empty directory around causes "import gps" to
apparently succeed and create an empty "namespace" module.  Not only
does this confuse programs attempting to detect import failures, but
it also prevents a future import from working even after adjusting
sys.path, since reimporting an already imported module is a NOP.

The fix is simply to include the directory explicitly in the list for
python_install.  This has no actual effect on the install, but
includes the directory in the uninstall.

TESTED:
Ran install/uninstall and verified that the directory is now removed
by the uninstall.
---
 SConstruct | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/SConstruct b/SConstruct
index 2740e11..3bfb95a 100644
--- a/SConstruct
+++ b/SConstruct
@@ -1535,7 +1535,10 @@ else:
     python_install = [python_extensions_install,
                         python_modules_install,
                         python_progs_install,
-                        python_egg_info_install]
+                        python_egg_info_install,
+                        # We don't need the directory explicitly for the
+                        # install, but we do need it for the uninstall
+                        Dir(DESTDIR + python_module_dir)]
 
 pc_install = [env.Install(installdir('pkgconfig'), 'libgps.pc')]
 if qt_env:
-- 
2.8.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]