~ubuntu-branches/ubuntu/natty/pygame/natty

« back to all changes in this revision

Viewing changes to msys.py

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2010-01-14 17:02:11 UTC
  • mfrom: (1.3.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20100114170211-21eop2ja7mr9vdcr
Tags: 1.9.1release-0ubuntu1
* New upstream version (lp: #433304)
* debian/control:
  - build-depends on libportmidi-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
import subprocess
14
14
import re
15
15
import glob
16
 
import _winreg
 
16
try:
 
17
    import _winreg
 
18
except ImportError:
 
19
    import winreg as _winreg
 
20
 
 
21
# For Python 2.x/3.x compatibility
 
22
def geterror():
 
23
    return sys.exc_info()[1]
17
24
 
18
25
FSTAB_REGEX = (r'^[ \t]*(?P<path>'
19
26
               r'([a-zA-Z]:){0,1}([\\/][^\s*^?:%\\/]+)+)'
74
81
        dir_path = os.path.abspath(dir_path)
75
82
        try:
76
83
            return find_msys_version_subdir(dir_path)
77
 
        except MsysException, e:
78
 
            msys_print(e)
 
84
        except MsysException:
 
85
            msys_print(geterror())
79
86
            
80
87
def find_msys_registry():
81
88
    """Return the MSYS 1.0 directory path stored in the Windows registry
86
93
    
87
94
    subkey = (
88
95
        'Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MSYS-1.0_is1')
89
 
    key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, subkey)
90
96
    try:
 
97
        key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, subkey)
91
98
        try:
92
99
            return _winreg.QueryValueEx(key, 'Inno Setup: App Path')[0].encode()
93
 
        except WindowsError:
94
 
            raise LookupError("MSYS not found in the registry")
95
 
    finally:
96
 
        key.Close()
 
100
        finally:
 
101
            key.Close()
 
102
    except WindowsError:
 
103
        raise LookupError("MSYS not found in the registry")
97
104
 
98
105
def as_shell(msys_root):
99
106
    """Append MSYS shell program to MSYS root directory path"""