summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbitraid <bitraid@protonmail.ch>2018-06-11 20:43:11 +0300
committerFlorian Bruhin <git@the-compiler.org>2018-06-21 23:51:33 +0200
commitfd4ff3c9ce05a75117e80562c9a52a11d5c6d208 (patch)
tree20fd760715ef615790961ac83c7f7f9d60318659
parentad9b50601c82f66646088e9ebdd66613eb2e93e2 (diff)
downloadqutebrowser-fd4ff3c9ce05a75117e80562c9a52a11d5c6d208.tar.gz
qutebrowser-fd4ff3c9ce05a75117e80562c9a52a11d5c6d208.zip
build_release.py: Get python path from registry on Windows
(cherry picked from commit ddfbe255e78032c3ec03a2c675142548eae3e888)
-rwxr-xr-xscripts/dev/build_release.py22
1 files changed, 20 insertions, 2 deletions
diff --git a/scripts/dev/build_release.py b/scripts/dev/build_release.py
index 84e897eee..f20f44818 100755
--- a/scripts/dev/build_release.py
+++ b/scripts/dev/build_release.py
@@ -34,6 +34,9 @@ import tarfile
import tempfile
import collections
+if os.name == 'nt':
+ import winreg
+
sys.path.insert(0, os.path.join(os.path.dirname(__file__), os.pardir,
os.pardir))
@@ -222,8 +225,23 @@ def build_windows():
utils.print_title("Building Windows binaries")
parts = str(sys.version_info.major), str(sys.version_info.minor)
ver = ''.join(parts)
- python_x86 = r'C:\Python{}-32\python.exe'.format(ver)
- python_x64 = r'C:\Python{}\python.exe'.format(ver)
+ dot_ver = '.'.join(parts)
+
+ # Get python path from registry if possible
+ try:
+ reg64_key = winreg.OpenKeyEx(winreg.HKEY_LOCAL_MACHINE,
+ r'SOFTWARE\Python\PythonCore\{}\InstallPath'.format(dot_ver))
+ python_x64 = winreg.QueryValueEx(reg64_key, 'ExecutablePath')[0]
+ except FileNotFoundError:
+ python_x64 = r'C:\Python{}\python.exe'.format(ver)
+
+ try:
+ reg32_key = winreg.OpenKeyEx(winreg.HKEY_LOCAL_MACHINE,
+ r'SOFTWARE\WOW6432Node\Python\PythonCore\{}-32\InstallPath'.format(dot_ver))
+ python_x86 = winreg.QueryValueEx(reg32_key, 'ExecutablePath')[0]
+ except FileNotFoundError:
+ python_x86 = r'C:\Python{}-32\python.exe'.format(ver)
+
out_pyinstaller = os.path.join('dist', 'qutebrowser')
out_32 = os.path.join('dist',
'qutebrowser-{}-x86'.format(qutebrowser.__version__))