summaryrefslogtreecommitdiff
path: root/src/script/scons-post-install.py
diff options
context:
space:
mode:
authorLuca Falavigna <dktrkranz@debian.org>2010-06-15 14:28:22 +0000
committerLuca Falavigna <dktrkranz@debian.org>2010-06-15 14:28:22 +0000
commit738149c9bfb9965d013d01ef99f9bb1c2819e7e8 (patch)
tree0397d9bf3b12c903dc73419585df231397ff343c /src/script/scons-post-install.py
parente7885e3af440eaef38a9301fd92a105afc8ddebb (diff)
Imported Upstream version 2.0.0upstream/2.0.0
Diffstat (limited to 'src/script/scons-post-install.py')
-rw-r--r--src/script/scons-post-install.py25
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: