[jhbuild] Fixed setting of PYTHONPATH with PYTHON set to python3.



commit 0460e83cf1898d2864f84c287783273b970e866a
Author: Simon Feltman <s feltman gmail com>
Date:   Tue Jun 12 15:33:56 2012 -0700

    Fixed setting of PYTHONPATH with PYTHON set to python3.
    
    Added parentheses to the code used for deterimining python version
    and site-packages to support PYTHON set to python3. Also added warning
    when PYTHON is explicitly set and an error occurs when running
    the code for making these determinations.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=677979

 jhbuild/config.py |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/jhbuild/config.py b/jhbuild/config.py
index 9dbcc62..b977523 100644
--- a/jhbuild/config.py
+++ b/jhbuild/config.py
@@ -472,10 +472,14 @@ class Config:
         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]])'],
+                'import sys; print(".".join([str(x) for x in sys.version_info[:2]]))'],
                 get_stderr = False).strip()
         except CommandError:
             pythonversion = 'python' + str(sys.version_info[0]) + '.' + str(sys.version_info[1])
+            if 'PYTHON' in os.environ:
+                logging.warn(_('Unable to determine python version using the '
+                               'PYTHON environment variable (%s). Using default "%s"')
+                             % (os.environ['PYTHON'], pythonversion))
 
         # In Python 2.6, site-packages got replaced by dist-packages, get the
         # actual value by asking distutils
@@ -483,10 +487,14 @@ class Config:
         try:
             python_packages_dir = get_output([python_bin, '-c',
                 'import os, distutils.sysconfig; '\
-                'print distutils.sysconfig.get_python_lib(prefix="%s").split(os.path.sep)[-1]' % self.prefix],
+                'print(distutils.sysconfig.get_python_lib(prefix="%s").split(os.path.sep)[-1])' % self.prefix],
                 get_stderr=False).strip()
         except CommandError:
             python_packages_dir = 'site-packages'
+            if 'PYTHON' in os.environ:
+                logging.warn(_('Unable to determine python site-packages directory using the '
+                               'PYTHON environment variable (%s). Using default "%s"')
+                             % (os.environ['PYTHON'], python_packages_dir))
             
         if self.use_lib64:
             pythonpath = os.path.join(self.prefix, 'lib64', pythonversion, python_packages_dir)



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