Skip to content

Commit

Permalink
Write python installation directories into registry to fix PyQt insta…
Browse files Browse the repository at this point in the history
…llation

Inspired by qutebrowser's ci_install.py
  • Loading branch information
nicoddemus committed Sep 3, 2015
1 parent 073d4f8 commit bf19ba4
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions scripts/install-qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,30 @@


if 'APPVEYOR' in os.environ:
def fix_registry(python_ver):
"""Update install path on windows registry so PyQt installation installs at the correct
location.
python_ver must be "34", "27", etc.
"""
import _winreg as winreg
python_dir = r'C:\Python%s' % python_ver
print("Fixing registry %s..." % python_ver)
assert os.path.isdir(python_dir)
registry_key = r'Software\Python\PythonCore\%s.%s' % (python_ver[0], python_ver[1])
with winreg.OpenKey(winreg.HKEY_CURRENT_USER,
registry_key, 0,
winreg.KEY_WRITE) as key:
winreg.SetValue(key, 'InstallPath', winreg.REG_SZ, python_dir)

base_url = 'http://downloads.sourceforge.net/project/pyqt/'
downloads = {
'py34-pyqt5': 'PyQt5/PyQt-5.5/PyQt5-5.5-gpl-Py3.4-Qt5.5.0-x32.exe',
'py34-pyqt4': 'PyQt4/PyQt-4.11.4/PyQt4-4.11.4-gpl-Py3.4-Qt4.8.7-x32.exe',
'py27-pyqt4': 'PyQt4/PyQt-4.11.4/PyQt4-4.11.4-gpl-Py2.7-Qt4.8.7-x32.exe',
}
if 'INSTALL_QT' in os.environ:
fix_registry('34')
fix_registry('27')
caption = os.environ['INSTALL_QT']
url = downloads[caption]
print("Downloading %s..." % caption)
Expand Down

0 comments on commit bf19ba4

Please sign in to comment.