示例#1
0
    def __init__(self, cc=None):
        Platform.__init__(self, "cl.exe")
        if msvc_compiler_environ:
            self.c_environ = os.environ.copy()
            self.c_environ.update(msvc_compiler_environ)
            # XXX passing an environment to subprocess is not enough. Why?
            os.environ.update(msvc_compiler_environ)

        # detect version of current compiler
        returncode, stdout, stderr = _run_subprocess(self.cc, "", env=self.c_environ)
        r = re.match(r"Microsoft.+C/C\+\+.+\s([0-9]+)\.([0-9]+).*", stderr)
        if r is not None:
            self.version = int("".join(r.groups())) / 10 - 60
        else:
            # Probably not a msvc compiler...
            self.version = 0

        # Try to find a masm assembler
        returncode, stdout, stderr = _run_subprocess("ml.exe", "", env=self.c_environ)
        r = re.search("Macro Assembler", stderr)
        if r is None and os.path.exists("c:/masm32/bin/ml.exe"):
            self.masm = "c:/masm32/bin/ml.exe"
        else:
            self.masm = "ml.exe"

        # Install debug options only when interpreter is in debug mode
        if sys.executable.lower().endswith("_d.exe"):
            self.cflags = ["/MDd", "/Z7", "/Od"]
            self.link_flags = ["/debug"]

            # Increase stack size, for the linker and the stack check code.
            stack_size = 8 << 20  # 8 Mb
            self.link_flags.append("/STACK:%d" % stack_size)
            # The following symbol is used in c/src/stack.h
            self.cflags.append("/DMAX_STACK_SIZE=%d" % (stack_size - 1024))
示例#2
0
    def __init__(self, cc=None, x64=False):
        self.x64 = x64
        if x64:
            msvc_compiler_environ = msvc_compiler_environ64
        else:
            msvc_compiler_environ = msvc_compiler_environ32
        Platform.__init__(self, 'cl.exe')
        if msvc_compiler_environ:
            self.c_environ = os.environ.copy()
            self.c_environ.update(msvc_compiler_environ)
            # XXX passing an environment to subprocess is not enough. Why?
            os.environ.update(msvc_compiler_environ)

        # detect version of current compiler
        returncode, stdout, stderr = _run_subprocess(self.cc, '',
                                                     env=self.c_environ)
        r = re.match(r'Microsoft.+C/C\+\+.+\s([0-9]+)\.([0-9]+).*', stderr)
        if r is not None:
            self.version = int(''.join(r.groups())) / 10 - 60
        else:
            # Probably not a msvc compiler...
            self.version = 0

        # Try to find a masm assembler
        returncode, stdout, stderr = _run_subprocess('ml.exe', '',
                                                     env=self.c_environ)
        r = re.search('Macro Assembler', stderr)
        if r is None and os.path.exists('c:/masm32/bin/ml.exe'):
            masm32 = 'c:/masm32/bin/ml.exe'
            masm64 = 'c:/masm64/bin/ml64.exe'
        else:
            masm32 = 'ml.exe'
            masm64 = 'ml64.exe'
        
        if x64:
            self.masm = masm64
        else:
            self.masm = masm32

        # Install debug options only when interpreter is in debug mode
        if sys.executable.lower().endswith('_d.exe'):
            self.cflags = ['/MDd', '/Z7', '/Od']
            self.link_flags = ['/debug']

            # Increase stack size, for the linker and the stack check code.
            stack_size = 8 << 20  # 8 Mb
            self.link_flags.append('/STACK:%d' % stack_size)
            # The following symbol is used in c/src/stack.h
            self.cflags.append('/DMAX_STACK_SIZE=%d' % (stack_size - 1024))
示例#3
0
    def __init__(self, cc=None, x64=False):
        self.x64 = x64
        msvc_compiler_environ = find_msvc_env(x64)
        Platform.__init__(self, 'cl.exe')
        if msvc_compiler_environ:
            self.c_environ = os.environ.copy()
            self.c_environ.update(msvc_compiler_environ)
            # XXX passing an environment to subprocess is not enough. Why?
            os.environ.update(msvc_compiler_environ)

        # detect version of current compiler
        returncode, stdout, stderr = _run_subprocess(self.cc,
                                                     '',
                                                     env=self.c_environ)
        r = re.match(r'Microsoft.+C/C\+\+.+\s([0-9]+)\.([0-9]+).*', stderr)
        if r is not None:
            self.version = int(''.join(r.groups())) / 10 - 60
        else:
            # Probably not a msvc compiler...
            self.version = 0

        # Try to find a masm assembler
        returncode, stdout, stderr = _run_subprocess('ml.exe',
                                                     '',
                                                     env=self.c_environ)
        r = re.search('Macro Assembler', stderr)
        if r is None and os.path.exists('c:/masm32/bin/ml.exe'):
            masm32 = 'c:/masm32/bin/ml.exe'
            masm64 = 'c:/masm64/bin/ml64.exe'
        else:
            masm32 = 'ml.exe'
            masm64 = 'ml64.exe'

        if x64:
            self.masm = masm64
        else:
            self.masm = masm32

        # Install debug options only when interpreter is in debug mode
        if sys.executable.lower().endswith('_d.exe'):
            self.cflags = ['/MDd', '/Z7', '/Od']
            self.link_flags = ['/debug']

            # Increase stack size, for the linker and the stack check code.
            stack_size = 8 << 20  # 8 Mb
            self.link_flags.append('/STACK:%d' % stack_size)
            # The following symbol is used in c/src/stack.h
            self.cflags.append('/DMAX_STACK_SIZE=%d' % (stack_size - 1024))
示例#4
0
    def __init__(self, cc=None):
        Platform.__init__(self, 'cl.exe')
        if msvc_compiler_environ:
            self.c_environ = os.environ.copy()
            self.c_environ.update(msvc_compiler_environ)
            # XXX passing an environment to subprocess is not enough. Why?
            os.environ.update(msvc_compiler_environ)

        # detect version of current compiler
        returncode, stdout, stderr = _run_subprocess(self.cc,
                                                     '',
                                                     env=self.c_environ)
        r = re.search('[Vv]ersion\W([0-9]+)\.([0-9]+)', stderr)
        if r is not None:
            self.version = int(''.join(r.groups())) / 10 - 60
        else:
            # Probably not a msvc compiler...
            self.version = 0

        # Install debug options only when interpreter is in debug mode
        if sys.executable.lower().endswith('_d.exe'):
            self.cflags = ['/MDd', '/Z7', '/Od']
            self.link_flags = ['/debug']

            # Increase stack size, for the linker and the stack check code.
            stack_size = 8 << 20  # 8 Mb
            self.link_flags.append('/STACK:%d' % stack_size)
            # The following symbol is used in c/src/stack.h
            self.cflags.append('/DMAX_STACK_SIZE=%d' % (stack_size - 1024))

        if hasattr(sys, 'exec_prefix'):
            self.add_cpython_dirs = True
        else:
            # We are certainly running pypy-c
            self.add_cpython_dirs = False
示例#5
0
文件: windows.py 项目: enyst/plexnet
    def __init__(self, cc=None):
        Platform.__init__(self, 'cl.exe')
        if msvc_compiler_environ:
            self.c_environ = os.environ.copy()
            self.c_environ.update(msvc_compiler_environ)
            # XXX passing an environment to subprocess is not enough. Why?
            os.environ.update(msvc_compiler_environ)

        # detect version of current compiler
        returncode, stdout, stderr = _run_subprocess(self.cc, '',
                                                     env=self.c_environ)
        r = re.search('[Vv]ersion\W([0-9]+)\.([0-9]+)', stderr)
        if r is not None:
            self.version = int(''.join(r.groups())) / 10 - 60
        else:
            # Probably not a msvc compiler...
            self.version = 0

        # Install debug options only when interpreter is in debug mode
        if sys.executable.lower().endswith('_d.exe'):
            self.cflags = ['/MDd', '/Z7', '/Od']
            self.link_flags = ['/debug']

            # Increase stack size, for the linker and the stack check code.
            stack_size = 8 << 20  # 8 Mb
            self.link_flags.append('/STACK:%d' % stack_size)
            # The following symbol is used in c/src/stack.h
            self.cflags.append('/DMAX_STACK_SIZE=%d' % (stack_size - 1024))

        if hasattr(sys, 'exec_prefix'):
            self.add_cpython_dirs = True
        else:
            # We are certainly running pypy-c
            self.add_cpython_dirs = False
示例#6
0
 def execute_makefile(self, path_to_makefile):
     if isinstance(path_to_makefile, GnuMakefile):
         path = path_to_makefile.makefile_dir
     else:
         path = path_to_makefile
     log.execute("make in %s" % (path,))
     returncode, stdout, stderr = _run_subprocess(self.make_cmd, ["-C", str(path)])
     self._handle_error(returncode, stdout, stderr, path.join("make"))
示例#7
0
 def execute_makefile(self, path_to_makefile):
     if isinstance(path_to_makefile, GnuMakefile):
         path = path_to_makefile.makefile_dir
     else:
         path = path_to_makefile
     log.execute('make in %s' % (path,))
     returncode, stdout, stderr = _run_subprocess('make', ['-C', str(path)])
     self._handle_error(returncode, stdout, stderr, path.join('make'))
示例#8
0
文件: posix.py 项目: purepython/pypy
 def _pkg_config(self, lib, opt, default):
     try:
         ret, out, err = _run_subprocess("pkg-config", [lib, opt])
     except OSError:
         ret = 1
     if ret:
         return default
     # strip compiler flags
     return [entry[2:] for entry in out.split()]
示例#9
0
文件: posix.py 项目: purepython/pypy
 def execute_makefile(self, path_to_makefile, extra_opts=[]):
     if isinstance(path_to_makefile, GnuMakefile):
         path = path_to_makefile.makefile_dir
     else:
         path = path_to_makefile
     log.execute('make %s in %s' % (" ".join(extra_opts), path))
     returncode, stdout, stderr = _run_subprocess(
         self.make_cmd, ['-C', str(path)] + extra_opts)
     self._handle_error(returncode, stdout, stderr, path.join('make'))
示例#10
0
 def _pkg_config(self, lib, opt, default):
     try:
         ret, out, err = _run_subprocess("pkg-config", [lib, opt])
     except OSError:
         ret = 1
     if ret:
         return default
     # strip compiler flags
     return [entry[2:] for entry in out.split()]
示例#11
0
 def execute_makefile(self, path_to_makefile, extra_opts=[]):
     if isinstance(path_to_makefile, GnuMakefile):
         path = path_to_makefile.makefile_dir
     else:
         path = path_to_makefile
     log.execute('make %s in %s' % (" ".join(extra_opts), path))
     returncode, stdout, stderr = _run_subprocess(
         self.make_cmd, ['-C', str(path)] + extra_opts)
     self._handle_error(returncode, stdout, stderr, path.join('make'))
示例#12
0
    def execute_makefile(self, path_to_makefile):
        if isinstance(path_to_makefile, NMakefile):
            path = path_to_makefile.makefile_dir
        else:
            path = path_to_makefile
        log.execute('make in %s' % (path, ))
        oldcwd = path.chdir()
        try:
            returncode, stdout, stderr = _run_subprocess(
                'nmake', ['/f', str(path.join('Makefile'))])
        finally:
            oldcwd.chdir()

        self._handle_error(returncode, stdout, stderr, path.join('make'))
示例#13
0
    def execute_makefile(self, path_to_makefile, extra_opts=[]):
        if isinstance(path_to_makefile, NMakefile):
            path = path_to_makefile.makefile_dir
        else:
            path = path_to_makefile
        log.execute('make %s in %s' % (" ".join(extra_opts), path))
        oldcwd = path.chdir()
        try:
            returncode, stdout, stderr = _run_subprocess(
                'nmake',
                ['/nologo', '/f', str(path.join('Makefile'))] + extra_opts)
        finally:
            oldcwd.chdir()

        self._handle_error(returncode, stdout, stderr, path.join('make'))
示例#14
0
    def execute_makefile(self, path_to_makefile, extra_opts=[]):
        if isinstance(path_to_makefile, NMakefile):
            path = path_to_makefile.makefile_dir
        else:
            path = path_to_makefile
        log.execute("make %s in %s" % (" ".join(extra_opts), path))
        oldcwd = path.chdir()
        try:
            returncode, stdout, stderr = _run_subprocess(
                "nmake", ["/nologo", "/f", str(path.join("Makefile"))] + extra_opts
            )
        finally:
            oldcwd.chdir()

        self._handle_error(returncode, stdout, stderr, path.join("make"))