# letter representation. Otherwise it thinks we're adding two env # variables E and /Foo when we add E:/Foo. path = re.sub('([a-zA-Z]):', '/\\1', path) if config.cygwin: # On cygwin we can't put "c:\foo" in $PATH, as : is a # field separator. So convert to /cygdrive/c/foo instead. # Other pythons use ; as the separator, so no problem. path = re.sub('([a-zA-Z]):', '/cygdrive/\\1', path) path = re.sub('\\\\', '/', path) return path # On Windows we need to set $PATH to include the paths to all the DLLs # in order for the dynamic library tests to work. if windows: pkginfo = getStdout([config.ghc_pkg, 'dump']) topdir = config.libdir if windows: mingw = os.path.abspath(os.path.join(topdir, '../mingw/bin')) mingw = format_path(mingw) ghc_env['PATH'] = os.pathsep.join([ghc_env.get("PATH", ""), mingw]) for line in pkginfo.split('\n'): if line.startswith('library-dirs:'): path = line.rstrip() path = re.sub('^library-dirs: ', '', path) # Use string.replace instead of re.sub, because re.sub # interprets backslashes in the replacement string as # escape sequences. path = path.replace('$topdir', topdir) if path.startswith('"'): path = re.sub('^"(.*)"$', '\\1', path)
# If using msys2 python instead of mingw we have to change the drive # letter representation. Otherwise it thinks we're adding two env # variables E and /Foo when we add E:/Foo. path = re.sub('([a-zA-Z]):', '/\\1', path) if config.cygwin: # On cygwin we can't put "c:\foo" in $PATH, as : is a # field separator. So convert to /cygdrive/c/foo instead. # Other pythons use ; as the separator, so no problem. path = re.sub('([a-zA-Z]):', '/cygdrive/\\1', path) path = re.sub('\\\\', '/', path) return path # On Windows we need to set $PATH to include the paths to all the DLLs # in order for the dynamic library tests to work. if windows or darwin: pkginfo = getStdout([config.ghc_pkg, 'dump']) topdir = config.libdir if windows: mingw = os.path.abspath(os.path.join(topdir, '../mingw/bin')) mingw = format_path(mingw) ghc_env['PATH'] = os.pathsep.join([ghc_env.get("PATH", ""), mingw]) for line in pkginfo.split('\n'): if line.startswith('library-dirs:'): path = line.rstrip() path = re.sub('^library-dirs: ', '', path) # Use string.replace instead of re.sub, because re.sub # interprets backslashes in the replacement string as # escape sequences. path = path.replace('$topdir', topdir) if path.startswith('"'): path = re.sub('^"(.*)"$', '\\1', path)