jhbuild r2060 - in trunk: . jhbuild



Author: fpeters
Date: Thu May  1 11:26:50 2008
New Revision: 2060
URL: http://svn.gnome.org/viewvc/jhbuild?rev=2060&view=rev

Log:
* jhbuild/config.py: use JHBuild executed Python to get version number
and set PYTHONPATH appropriately.  (closes: #136983)



Modified:
   trunk/ChangeLog
   trunk/jhbuild/config.py

Modified: trunk/jhbuild/config.py
==============================================================================
--- trunk/jhbuild/config.py	(original)
+++ trunk/jhbuild/config.py	Thu May  1 11:26:50 2008
@@ -22,7 +22,8 @@
 import traceback
 import sys
 
-from jhbuild.errors import UsageError, FatalError
+from jhbuild.errors import UsageError, FatalError, CommandError
+from jhbuild.utils.cmds import get_output
 
 __all__ = [ 'Config' ]
 
@@ -191,7 +192,16 @@
         os.environ['CERTIFIED_GNOMIE'] = 'yes'
 
         # PYTHONPATH
-        pythonversion = 'python' + str(sys.version_info[0]) + '.' + str(sys.version_info[1])
+        # Python inside jhbuild may be different than Python executing jhbuild,
+        # so it is executed to get its version number (fallback to local
+        # version number should never happen)
+        python_bin = os.environ.get('PYTHON', 'python')
+        try:
+            pythonversion = 'python' + get_output([python_bin, '-c',
+                'import sys; print ".".join([str(x) for x in sys.version_info[:2]])']).strip()
+        except CommandError:
+            pythonversion = 'python' + str(sys.version_info[0]) + '.' + str(sys.version_info[1])
+        
         if self.use_lib64:
             pythonpath = os.path.join(self.prefix, 'lib64', pythonversion, 'site-packages')
             addpath('PYTHONPATH', pythonpath)



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