[kupfer] wscript: Install into DATADIR unless --pythondir-install



commit 5d5857336a95edefb2c90a979246f71354d46016
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Mon Nov 2 02:29:30 2009 +0100

    wscript: Install into DATADIR unless --pythondir-install
    
    Change kupfer to default to being installed with all its Python
    package into DATADIR.
    
    The Python package is installed as arch-independent files into
    DATADIR, which has support in the FHS, and is widely practiced for
    Python packages in Debian. Since Kupfer does not include optimized
    .pyo by default, we avoid the issues with these (not
    arch-independent).
    
    The configure option --pythondir-install is added to allow installing
    into the old location, as a system-wide Python module.

 NEWS    |    2 ++
 wscript |   13 ++++++++-----
 2 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/NEWS b/NEWS
index c73fa30..35b452d 100644
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,8 @@ Not released yet
 
 * *Gajim* plugin matches contacts by jid as well as name
 * Action *Rescan* on sources is now debug only (should not be needed)
+* Kupfer installs its Python package into ``$PREFIX/share`` by default,
+  instead of installing as a system-wide Python module.
 
 * Changes for plugin authors:
 
diff --git a/wscript b/wscript
index 80e471f..52356c7 100644
--- a/wscript
+++ b/wscript
@@ -78,6 +78,9 @@ def set_options(opt):
 	opt.add_option('--pyo',action='store_true',default=False,help='Install optimised compiled .pyo files [Default:not install]',dest='pyo')
 	opt.add_option('--no-runtime-deps',action='store_false',default=True,
 			help='Do not check for any runtime dependencies',dest='check_deps')
+	opt.add_option('--pythondir-install',action='store_true',default=False,
+			help="Install Kupfer's modules as standard python modules [Default: Install into DATADIR]",
+			dest='pythondir_install')
 	opt.sub_options("extras")
 
 def configure(conf):
@@ -92,6 +95,11 @@ def configure(conf):
 	conf.env["VERSION"] = VERSION
 	conf.sub_config("extras")
 
+	if not Options.options.pythondir_install:
+		conf.env["PYTHONDIR"] = Utils.subst_vars("${DATADIR}/kupfer", conf.env)
+	Utils.pprint("NORMAL",
+			"Installing python modules into: %(PYTHONDIR)s" % conf.env)
+
 	if not Options.options.check_deps:
 		return
 
@@ -134,11 +142,6 @@ def configure(conf):
 			Utils.pprint("YELLOW", "module %s is recommended, allows %s" % (
 				mod, opt_pymodules[mod]))
 
-	# Check sys.path
-	Utils.pprint("NORMAL", "Installing python modules into: %(PYTHONDIR)s" % conf.env)
-	pipe = os.popen("""%(PYTHON)s -c "import sys; print '%(PYTHONDIR)s' in sys.path" """ % conf.env)
-	if "False" in pipe.read():
-		Utils.pprint("YELLOW", "Please add %(PYTHONDIR)s to your sys.path!" % conf.env)
 
 def _new_package(bld, name):
 	"""Add module @name to sources to be installed,



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