[jhbuild] distutils: Add python3 attribute



commit ffd00eea72bfdfac02846a46559904bd8fa09d57
Author: Patrick Griffis <tingping tingping se>
Date:   Tue Mar 21 01:04:22 2017 -0400

    distutils: Add python3 attribute
    
    https://bugzilla.gnome.org/show_bug.cgi?id=780339

 jhbuild/modtypes/distutils.py |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/jhbuild/modtypes/distutils.py b/jhbuild/modtypes/distutils.py
index 4c58210..bb7ce8f 100644
--- a/jhbuild/modtypes/distutils.py
+++ b/jhbuild/modtypes/distutils.py
@@ -41,6 +41,7 @@ class DistutilsModule(Package, DownloadableModule):
         Package.__init__(self, name, branch=branch)
         self.supports_non_srcdir_builds = supports_non_srcdir_builds
         self.supports_install_destdir = True
+        self.python = os.environ.get('PYTHON', 'python')
 
     def get_srcdir(self, buildscript):
         return self.branch.srcdir
@@ -57,8 +58,7 @@ class DistutilsModule(Package, DownloadableModule):
         buildscript.set_action(_('Building'), self)
         srcdir = self.get_srcdir(buildscript)
         builddir = self.get_builddir(buildscript)
-        python = os.environ.get('PYTHON', 'python')
-        cmd = [python, 'setup.py', 'build']
+        cmd = [self.python, 'setup.py', 'build']
         if srcdir != builddir:
             cmd.extend(['--build-base', builddir])
         buildscript.execute(cmd, cwd = srcdir, extra_env = self.extra_env)
@@ -70,8 +70,7 @@ class DistutilsModule(Package, DownloadableModule):
         srcdir = self.get_srcdir(buildscript)
         builddir = self.get_builddir(buildscript)
         destdir = self.prepare_installroot(buildscript)
-        python = os.environ.get('PYTHON', 'python')
-        cmd = [python, 'setup.py']
+        cmd = [self.python, 'setup.py']
         if srcdir != builddir:
             cmd.extend(['build', '--build-base', builddir])
         cmd.extend(['install', 
@@ -94,6 +93,9 @@ def parse_distutils(node, config, uri, repositories, default_repo):
         instance.supports_non_srcdir_builds = \
             (node.getAttribute('supports-non-srcdir-builds') != 'no')
 
+    if node.hasAttribute('python3'):
+        instance.python = os.environ.get('PYTHON3', 'python3')
+
     return instance
 
 register_module_type('distutils', parse_distutils)


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