def initialize(self, plat_name=None): MSVCCompiler.initialize(self) self.cc = _find_exe("icl.exe") self.lib = _find_exe("xilib.exe") self.linker = _find_exe("xilink.exe") self.compile_options = ['/nologo', '/O3', '/MD', '/W3', '/Qstd=c99'] self.compile_options_debug = [ '/nologo', '/Od', '/MDd', '/W3', '/Qstd=c99', '/Z7', '/D_DEBUG' ]
def test_remove_entire_manifest(self): from distutils._msvccompiler import MSVCCompiler tempdir = self.mkdtemp() manifest = os.path.join(tempdir, 'manifest') f = open(manifest, 'w') try: f.write(_MANIFEST_WITH_ONLY_MSVC_REFERENCE) finally: f.close() compiler = MSVCCompiler() got = compiler._remove_visual_c_ref(manifest) self.assertIsNone(got)
def find_tools(): """Find and return the location of the 'lib' and 'dumpbin' tools. Also returns the environment in which they should be run. """ compiler = MSVCCompiler() compiler.initialize() paths = compiler._paths.split(os.pathsep) lib = compiler.lib dumpbin = _find_exe('dumpbin.exe', paths) env = copy(os.environ) env['path'] = os.pathsep.join(paths) return lib, dumpbin, env
def test_remove_visual_c_ref(self): from distutils._msvccompiler import MSVCCompiler tempdir = self.mkdtemp() manifest = os.path.join(tempdir, 'manifest') f = open(manifest, 'w') try: f.write(_MANIFEST_WITH_MULTIPLE_REFERENCES) finally: f.close() compiler = MSVCCompiler() compiler._remove_visual_c_ref(manifest) # see what we got f = open(manifest) try: # removing trailing spaces content = '\n'.join([line.rstrip() for line in f.readlines()]) finally: f.close() # makes sure the manifest was properly cleaned self.assertEqual(content, _CLEANED_MANIFEST)
def compile_with_msvcc(): msvcc = MSVCCompiler() msvcc.initialize() msvcc.add_include_dir(cvars['INCLUDEPY']) msvcc.add_library_dir(os.path.join(cvars['exec_prefix'], 'libs')) args = [msvcc.cc] args += ['/nologo', '/Ox', '/W3', '/GL', '/DNDEBUG', '/MD'] args += ['-I' + inc for inc in msvcc.include_dirs] args += ['optimuspy.cpp'] args += ['/link'] args += ['/LIBPATH:' + inc for inc in msvcc.library_dirs] args += ['User32.lib', 'Shell32.lib'] args += ['/OUT:optimuspy.exe'] subprocess.Popen(args).wait() for temp in ['optimuspy.obj', 'optimuspy.lib', 'optimuspy.exp']: if os.path.isfile(temp): os.unlink(temp)
def __init__(self, verbose=0, dry_run=0, force=0): MSVCCompiler.__init__(self, verbose, dry_run, force)