OpenSecurity/bin/cygwin.py
changeset 18 d7d7b8dee78e
parent 16 e16d64b5e008
child 50 1f4ba6a6ecf5
     1.1 --- a/OpenSecurity/bin/cygwin.py	Fri Dec 06 12:24:24 2013 +0100
     1.2 +++ b/OpenSecurity/bin/cygwin.py	Fri Dec 06 12:47:53 2013 +0100
     1.3 @@ -56,7 +56,15 @@
     1.4      @staticmethod
     1.5      def root():
     1.6          """get the path to our local cygwin installment"""
     1.7 -        return os.path.join(Environment('OpenSecurity').prefix_path, '..', 'cygwin')
     1.8 +        home_drive = os.path.expandvars("%HOMEDRIVE%") + os.sep
     1.9 +        path_hint = [ 
    1.10 +            os.path.abspath(os.path.join(Environment('OpenSecurity').prefix_path, '..', 'cygwin')), 
    1.11 +            os.path.abspath(os.path.join(Environment('OpenSecurity').prefix_path, '..', 'cygwin64')), 
    1.12 +            os.path.abspath(os.path.join(home_drive, 'cygwin')),
    1.13 +            os.path.abspath(os.path.join(home_drive, 'cygwin64'))
    1.14 +        ]
    1.15 +        path_valid = [ p for p in path_hint if os.path.exists(p) ]
    1.16 +        return path_valid[0]
    1.17  
    1.18  
    1.19      def execute(self, command, stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.PIPE):
    1.20 @@ -94,6 +102,9 @@
    1.21  # start
    1.22  if __name__ == "__main__":
    1.23  
    1.24 +    print(Cygwin.root())
    1.25 +    sys.exit(1)
    1.26 +
    1.27      # execute what is given on the command line
    1.28      c = Cygwin()
    1.29      p = c(sys.argv[1:])