Ejemplo n.º 1
0
 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'
     ]
Ejemplo n.º 2
0
    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)
Ejemplo n.º 3
0
    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)
Ejemplo n.º 4
0
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
Ejemplo n.º 5
0
    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)
Ejemplo n.º 6
0
    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)
Ejemplo n.º 7
0
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)
Ejemplo n.º 8
0
 def __init__(self, verbose=0, dry_run=0, force=0):
     MSVCCompiler.__init__(self, verbose, dry_run, force)