(moduleName, mapFileName, prefix)
| 80 | return ret |
| 81 | |
| 82 | def get_extension_defn(moduleName, mapFileName, prefix): |
| 83 | if win32api is None: return None |
| 84 | os.environ['PYTHONPREFIX'] = prefix |
| 85 | dsp = win32api.GetProfileVal(moduleName, "dsp", "", mapFileName) |
| 86 | if dsp=="": |
| 87 | return None |
| 88 | |
| 89 | # We allow environment variables in the file name |
| 90 | dsp = win32api.ExpandEnvironmentStrings(dsp) |
| 91 | # If the path to the .DSP file is not absolute, assume it is relative |
| 92 | # to the description file. |
| 93 | if not os.path.isabs(dsp): |
| 94 | dsp = os.path.join( os.path.split(mapFileName)[0], dsp) |
| 95 | # Parse it to extract the source files. |
| 96 | sourceFiles = parse_dsp(dsp) |
| 97 | if sourceFiles is None: |
| 98 | return None |
| 99 | |
| 100 | module = CExtension(moduleName, sourceFiles) |
| 101 | # Put the path to the DSP into the environment so entries can reference it. |
| 102 | os.environ['dsp_path'] = os.path.split(dsp)[0] |
| 103 | os.environ['ini_path'] = os.path.split(mapFileName)[0] |
| 104 | |
| 105 | cl_options = win32api.GetProfileVal(moduleName, "cl", "", mapFileName) |
| 106 | if cl_options: |
| 107 | module.AddCompilerOption(win32api.ExpandEnvironmentStrings(cl_options)) |
| 108 | |
| 109 | exclude = win32api.GetProfileVal(moduleName, "exclude", "", mapFileName) |
| 110 | exclude = exclude.split() |
| 111 | |
| 112 | if win32api.GetProfileVal(moduleName, "Unicode", 0, mapFileName): |
| 113 | module.AddCompilerOption('/D UNICODE /D _UNICODE') |
| 114 | |
| 115 | libs = win32api.GetProfileVal(moduleName, "libs", "", mapFileName).split() |
| 116 | for lib in libs: |
| 117 | module.AddLinkerLib(win32api.ExpandEnvironmentStrings(lib)) |
| 118 | |
| 119 | for exc in exclude: |
| 120 | if exc in module.sourceFiles: |
| 121 | module.sourceFiles.remove(exc) |
| 122 | |
| 123 | return module |
| 124 | |
| 125 | # Given an MSVC DSP file, locate C source files it uses |
| 126 | # returns a list of source files. |
no test coverage detected
searching dependent graphs…