diff options
| author | Luca Falavigna <dktrkranz@debian.org> | 2010-06-15 14:28:28 +0000 |
|---|---|---|
| committer | Luca Falavigna <dktrkranz@debian.org> | 2010-06-15 14:28:28 +0000 |
| commit | 0ed55e71a9f4b9cda836c6a4a5408cece60db0c6 (patch) | |
| tree | b1e82f6e428ac15ed9b4de93e48d8079420d537d /src/script/scons-post-install.py | |
| parent | fe00e4f75ba00298c30d6854b245c2a42c6542b8 (diff) | |
| parent | 738149c9bfb9965d013d01ef99f9bb1c2819e7e8 (diff) | |
Merge commit 'upstream/2.0.0'
Diffstat (limited to 'src/script/scons-post-install.py')
| -rw-r--r-- | src/script/scons-post-install.py | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/script/scons-post-install.py b/src/script/scons-post-install.py index 40cbac1..4b04fec 100644 --- a/src/script/scons-post-install.py +++ b/src/script/scons-post-install.py @@ -31,10 +31,19 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/script/scons-post-install.py 4720 2010/03/24 03:14:11 jars" +__revision__ = "src/script/scons-post-install.py 5023 2010/06/14 22:05:46 scons" -import os.path +import os import sys +import imp + +try: + # Before Python 3.0, the 'winreg' module was named '_winreg' + sys.modules['winreg'] = \ + imp.load_module('winreg', *imp.find_module('_winreg')) +except ImportError: + # No '_winreg' module: either 3.x or not Windows + pass scons_bat_path = os.path.join(sys.prefix, 'Scripts', 'scons.bat') @@ -43,15 +52,15 @@ app_paths_key = r'SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\SCons.bat' def install(): if sys.platform == 'win32': try: - import _winreg + import winreg except ImportError: pass else: print 'Writing "App Paths" registry entry for %s' % scons_bat_path - _winreg.SetValue( - _winreg.HKEY_LOCAL_MACHINE, + winreg.SetValue( + winreg.HKEY_LOCAL_MACHINE, app_paths_key, - _winreg.REG_SZ, + winreg.REG_SZ, scons_bat_path) print 'Done.' @@ -59,12 +68,12 @@ def install(): def remove(): if sys.platform == 'win32': try: - import _winreg + import winreg except ImportError: pass else: # print 'Remove "App Paths" registry entry' - _winreg.DeleteKey(_winreg.HKEY_LOCAL_MACHINE, app_paths_key) + winreg.DeleteKey(winreg.HKEY_LOCAL_MACHINE, app_paths_key) if len(sys.argv) > 1: |
