]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
[devscripts/buildserver] Check Wow6432Node first when searching for python
authorSergey M․ <dstftw@gmail.com>
Sun, 29 May 2016 04:02:00 +0000 (10:02 +0600)
committerSergey M․ <dstftw@gmail.com>
Sun, 29 May 2016 04:02:00 +0000 (10:02 +0600)
This allows building releases from 64bit OS

devscripts/buildserver.py

index dada6bfc7149afb7ad22ace2340ac52a324c8a8b..2bd12da5018cbd5ab164a51c94b394de5d8e452c 100644 (file)
@@ -273,16 +273,25 @@ class HTTPError(BuildError):
 class PythonBuilder(object):
     def __init__(self, **kwargs):
         python_version = kwargs.pop('python', '3.4')
-        try:
-            key = compat_winreg.OpenKey(
-                compat_winreg.HKEY_LOCAL_MACHINE, r'SOFTWARE\Python\PythonCore\%s\InstallPath' % python_version)
+        python_path = None
+        for node in ('Wow6432Node\\', ''):
             try:
-                self.pythonPath, _ = compat_winreg.QueryValueEx(key, '')
-            finally:
-                compat_winreg.CloseKey(key)
-        except Exception:
+                key = compat_winreg.OpenKey(
+                    compat_winreg.HKEY_LOCAL_MACHINE,
+                    r'SOFTWARE\%sPython\PythonCore\%s\InstallPath' % (node, python_version))
+                try:
+                    python_path, _ = compat_winreg.QueryValueEx(key, '')
+                finally:
+                    compat_winreg.CloseKey(key)
+                break
+            except Exception:
+                pass
+
+        if not python_path:
             raise BuildError('No such Python version: %s' % python_version)
 
+        self.pythonPath = python_path
+
         super(PythonBuilder, self).__init__(**kwargs)