Beispiel #1
0
def build():
    if '--no-remove-binaries' not in sys.argv:
        remove_binaries(['.pyd', '.so'])

    os.chdir(root_dir)

    env=None
    if sys.platform == 'win32':
        # "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars64.bat"
        # set MSSdk=1
        # set DISTUTILS_USE_SDK=1
        # set VS100COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\Tools


        env = os.environ.copy()
        if sys.version_info[:2] in ((2, 7), (3, 5), (3, 6), (3, 7), (3, 8), (3, 9)):
            import setuptools # We have to import it first for the compiler to be found
            from distutils import msvc9compiler

            if sys.version_info[:2] == (2, 7):
                vcvarsall = msvc9compiler.find_vcvarsall(9.0)
            elif sys.version_info[:2] in ((3, 5), (3, 6), (3, 7), (3, 8), (3, 9)):
                vcvarsall = msvc9compiler.find_vcvarsall(14.0)
            if vcvarsall is None or not os.path.exists(vcvarsall):
                raise RuntimeError('Error finding vcvarsall.')

            if is_python_64bit():
                env.update(get_environment_from_batch_command(
                    [vcvarsall, 'amd64'],
                    initial=os.environ.copy()))
            else:
                env.update(get_environment_from_batch_command(
                    [vcvarsall, 'x86'],
                    initial=os.environ.copy()))
        else:
            raise AssertionError('Unable to setup environment for Python: %s' % (sys.version,))

        env['MSSdk'] = '1'
        env['DISTUTILS_USE_SDK'] = '1'

    additional_args = []
    for arg in sys.argv:
        if arg.startswith('--target-pyd-name='):
            additional_args.append(arg)
        if arg.startswith('--target-pyd-frame-eval='):
            additional_args.append(arg)
            break
    else:
        additional_args.append('--force-cython')  # Build always forces cython!

    args = [
        sys.executable, os.path.join(os.path.dirname(__file__), '..', 'setup_cython.py'), 'build_ext', '--inplace',
    ]+additional_args
    print('Calling args: %s' % (args,))
    subprocess.check_call(args, env=env,)
Beispiel #2
0
def select_msvc(version=None):
    set_compiler("msvc")
    if version is None:
        for ver in range(20, 9, -1):
            vc_dir = find_vcvarsall(ver)
            if vc_dir is not None:
                break
        else:
            print("No Visual C++ compiler")
            return
    else:
        vc_dir = find_vcvarsall(version)
    vc_dir = path.dirname(vc_dir)
    add_vc9_reg(vc_dir)
Beispiel #3
0
def add_vc9_reg(vc_dir):
    key = _winreg.CreateKeyEx(HCU, r"Software\Microsoft\VisualStudio\9.0\Setup\VC")
    _winreg.SetValueEx(key, "ProductDir", None, _winreg.REG_SZ, vc_dir)
    bat_path = find_vcvarsall(9.0)
    if bat_path is not None and path.exists(bat_path):
        print "Succeeded"
    else:
        print "Failed"
Beispiel #4
0
    def compile_source(self, directory, compiler, debug, clean, native):
        with in_directory(directory):
            if compiler == 'msvc':
                from distutils import msvc9compiler
                # TODO: handle debug
                if debug:
                    logger.warn('Debug flag currently ignored for MSVC')
                vcvars_loc = prefs['codegen.cpp.msvc_vars_location']
                if vcvars_loc == '':
                    for version in xrange(16, 8, -1):
                        fname = msvc9compiler.find_vcvarsall(version)
                        if fname:
                            vcvars_loc = fname
                            break
                if vcvars_loc == '':
                    raise IOError("Cannot find vcvarsall.bat on standard "
                                  "search path. Set the "
                                  "codegen.cpp.msvc_vars_location preference "
                                  "explicitly.")
                # TODO: copy vcvars and make replacements for 64 bit automatically
                arch_name = prefs['codegen.cpp.msvc_architecture']
                if arch_name == '':
                    mach = platform.machine()
                    if mach == 'AMD64':
                        arch_name = 'x86_amd64'
                    else:
                        arch_name = 'x86'

                vcvars_cmd = '"{vcvars_loc}" {arch_name}'.format(
                    vcvars_loc=vcvars_loc, arch_name=arch_name)
                make_cmd = 'nmake /f win_makefile'
                if os.path.exists('winmake.log'):
                    os.remove('winmake.log')
                with std_silent(debug):
                    if clean:
                        os.system(
                            '%s >>winmake.log 2>&1 && %s clean >>winmake.log 2>&1'
                            % (vcvars_cmd, make_cmd))
                    x = os.system(
                        '%s >>winmake.log 2>&1 && %s >>winmake.log 2>&1' %
                        (vcvars_cmd, make_cmd))
                    if x != 0:
                        raise RuntimeError("Project compilation failed")
            else:
                with std_silent(debug):
                    if clean:
                        os.system('make clean')
                    if debug:
                        x = os.system('make debug')
                    elif native:
                        x = os.system('make native')
                    else:
                        x = os.system('make')
                    if x != 0:
                        raise RuntimeError("Project compilation failed")
Beispiel #5
0
def prepare_build_cmd(build_cmd, **kwargs):
    global VCVARSALL
    if VCVARSALL == None:
        candidate = msvc.find_vcvarsall(10.0 if VS2010 else 9.0)
        if candidate == None:
            raise RuntimeError('Microsoft VS {} required'.format(
                '2010' if VS2010 else '2008'))
        else:
            VCVARSALL = candidate

    return build_cmd.format(vcvarsall=VCVARSALL, xXX=xXX, **kwargs)
Beispiel #6
0
def _get_extra_path_for_msvc():
    import distutils.spawn
    cl_exe = distutils.spawn.find_executable('cl.exe')
    if cl_exe:
        # The compiler is already on PATH, no extra path needed.
        return None

    from distutils import msvc9compiler
    vcvarsall_bat = msvc9compiler.find_vcvarsall(
        msvc9compiler.get_build_version())
    if not vcvarsall_bat:
        # Failed to find VC.
        return None

    path = os.path.join(os.path.dirname(vcvarsall_bat), 'bin')
    if not distutils.spawn.find_executable('cl.exe', path):
        # The compiler could not be found.
        return None
    return path
Beispiel #7
0
def compile(filename, outputfilename, arch='x86', vcver=None):
    if vcver == None:
        if os.getenv('MSVCVER'):
            vcver = float(os.getenv('MSVCVER'))
        else:
            vcver = msvc9compiler.get_build_version()
    vcvars = msvc9compiler.find_vcvarsall(vcver)
    if not vcvars:  # My VS 2008 Standard Edition doesn't have vcvarsall.bat
        vsbase = msvc9compiler.VS_BASE % vcver
        productdir = msvc9compiler.Reg.get_value(r"%s\Setup\VC" % vsbase,
                                                 "productdir")
        bat = 'vcvars%d.bat' % (arch == 'x86' and 32 or 64)
        vcvars = os.path.join(productdir, 'bin', bat)

    path = os.path.splitext(outputfilename)
    objfilename = path[0] + '.obj'
    p = subprocess.Popen('"%s" %s & cl %s /Fe%s /Fo%s' %
                         (vcvars, arch, filename, outputfilename, objfilename),
                         stdout=subprocess.PIPE,
                         stderr=subprocess.PIPE)
    try:
        stdout, stderr = p.communicate()
        if p.wait() != 0:
            raise Exception(stderr.decode("mbcs"))
        os.remove(objfilename)
    finally:
        p.stdout.close()
        p.stderr.close()


#try:
#    compile('inject_python.cpp', 'inject_python_32.exe', 'x86', 10.0)
#except:
#    pass
#try:
#    compile('inject_python.cpp', 'inject_python_64.exe', 'amd64', 10.0)
#except:
#    pass
Beispiel #8
0
    def do_custom_build(self):
        # We're using a system freetype
        if not options.get('local_freetype'):
            return

        src_path = os.path.join('build',
                                'freetype-{0}'.format(LOCAL_FREETYPE_VERSION))

        # We've already built freetype
        if sys.platform == 'win32':
            libfreetype = 'libfreetype.lib'
        else:
            libfreetype = 'libfreetype.a'

        if os.path.isfile(os.path.join(src_path, 'objs', '.libs',
                                       libfreetype)):
            return

        tarball = 'freetype-{0}.tar.gz'.format(LOCAL_FREETYPE_VERSION)
        tarball_path = os.path.join('build', tarball)
        try:
            tarball_cache_dir = _get_xdg_cache_dir()
            tarball_cache_path = os.path.join(tarball_cache_dir, tarball)
        except Exception:
            # again, do not really care if this fails
            tarball_cache_dir = None
            tarball_cache_path = None
        if not os.path.isfile(tarball_path):
            if (tarball_cache_path is not None
                    and os.path.isfile(tarball_cache_path)):
                if get_file_hash(tarball_cache_path) == LOCAL_FREETYPE_HASH:
                    os.makedirs('build', exist_ok=True)
                    try:
                        shutil.copy(tarball_cache_path, tarball_path)
                        print('Using cached tarball: {}'.format(
                            tarball_cache_path))
                    except OSError:
                        # If this fails, oh well just re-download
                        pass

            if not os.path.isfile(tarball_path):
                if not os.path.exists('build'):
                    os.makedirs('build')

                url_fmts = [
                    'https://downloads.sourceforge.net/project/freetype'
                    '/freetype2/{version}/{tarball}',
                    'https://download.savannah.gnu.org/releases/freetype'
                    '/{tarball}'
                ]
                for url_fmt in url_fmts:
                    tarball_url = url_fmt.format(
                        version=LOCAL_FREETYPE_VERSION, tarball=tarball)

                    print("Downloading {}".format(tarball_url))
                    try:
                        urllib.request.urlretrieve(tarball_url, tarball_path)
                    except IOError:  # URLError (a subclass) on Py3.
                        print("Failed to download {}".format(tarball_url))
                    else:
                        if get_file_hash(tarball_path) != LOCAL_FREETYPE_HASH:
                            print("Invalid hash.")
                        else:
                            break
                else:
                    raise IOError("Failed to download FreeType. You can "
                                  "download the file by alternative means and "
                                  "copy it to {}".format(tarball_path))
                os.makedirs(tarball_cache_dir, exist_ok=True)
                try:
                    shutil.copy(tarball_path, tarball_cache_path)
                    print('Cached tarball at {}'.format(tarball_cache_path))
                except OSError:
                    # If this fails, we can always re-download.
                    pass

            if get_file_hash(tarball_path) != LOCAL_FREETYPE_HASH:
                raise IOError(
                    "{} does not match expected hash.".format(tarball))

        print("Building {}".format(tarball))
        with tarfile.open(tarball_path, "r:gz") as tgz:
            tgz.extractall("build")

        if sys.platform != 'win32':
            # compilation on all other platforms than windows
            env = {
                **os.environ, "CFLAGS":
                "{} -fPIC".format(os.environ.get("CFLAGS", ""))
            }
            subprocess.check_call([
                "./configure", "--with-zlib=no", "--with-bzip2=no",
                "--with-png=no", "--with-harfbuzz=no"
            ],
                                  env=env,
                                  cwd=src_path)
            subprocess.check_call(["make"], env=env, cwd=src_path)
        else:
            # compilation on windows
            shutil.rmtree(str(pathlib.Path(src_path, "objs")),
                          ignore_errors=True)
            FREETYPE_BUILD_CMD = r"""
call "%ProgramFiles%\Microsoft SDKs\Windows\v7.0\Bin\SetEnv.Cmd" ^
    /Release /{xXX} /xp
call "{vcvarsall}" {xXX}
set MSBUILD=C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
%MSBUILD% "builds\windows\{vc20xx}\freetype.sln" ^
    /t:Clean;Build /p:Configuration="Release";Platform={WinXX}
"""
            import distutils.msvc9compiler as msvc
            # Note: freetype has no build profile for 2014, so we don't bother...
            vc = 'vc2010'
            WinXX = 'x64' if platform.architecture()[0] == '64bit' else 'Win32'
            xXX = 'x64' if platform.architecture()[0] == '64bit' else 'x86'
            vcvarsall = msvc.find_vcvarsall(10.0)
            if vcvarsall is None:
                raise RuntimeError('Microsoft VS 2010 required')
            cmdfile = pathlib.Path("build/build_freetype.cmd")
            cmdfile.write_text(
                FREETYPE_BUILD_CMD.format(vc20xx=vc,
                                          WinXX=WinXX,
                                          xXX=xXX,
                                          vcvarsall=vcvarsall))
            subprocess.check_call([str(cmdfile.resolve())],
                                  shell=True,
                                  cwd=src_path)
            # Move to the corresponding Unix build path.
            pathlib.Path(src_path, "objs/.libs").mkdir()
            # Be robust against change of FreeType version.
            lib_path, = (pathlib.Path(src_path, "objs", vc,
                                      xXX).glob("freetype*.lib"))
            shutil.copy2(
                str(lib_path),
                str(pathlib.Path(src_path, "objs/.libs/libfreetype.lib")))
Beispiel #9
0
    def do_custom_build(self):
        # We're using a system freetype
        if not options.get('local_freetype'):
            return

        src_path = os.path.join('build',
                                'freetype-{0}'.format(LOCAL_FREETYPE_VERSION))

        # We've already built freetype
        if sys.platform == 'win32':
            libfreetype = 'libfreetype.lib'
        else:
            libfreetype = 'libfreetype.a'

        # bailing because it is already built
        if os.path.isfile(os.path.join(src_path, 'objs', '.libs',
                                       libfreetype)):
            return

        # do we need to download / load the source from cache?
        if not os.path.exists(src_path):
            if not os.path.exists('build'):
                os.makedirs('build')

            url_fmts = [('https://downloads.sourceforge.net/project/freetype'
                         '/freetype2/{version}/{tarball}'),
                        ('https://download.savannah.gnu.org/releases/freetype'
                         '/{tarball}')]
            tarball = 'freetype-{0}.tar.gz'.format(LOCAL_FREETYPE_VERSION)

            target_urls = [
                url_fmt.format(version=LOCAL_FREETYPE_VERSION, tarball=tarball)
                for url_fmt in url_fmts
            ]

            for tarball_url in target_urls:
                try:
                    tar_contents = download_or_cache(tarball_url,
                                                     LOCAL_FREETYPE_HASH)
                    break
                except Exception:
                    pass
            else:
                raise IOError("Failed to download FreeType.  Please download "
                              "one of {target_urls} and extract it into "
                              "{src_path} at the top-level of the source "
                              "repository".format(target_urls=target_urls,
                                                  src_path=src_path))

            print("Extracting {}".format(tarball))
            # just to be sure
            tar_contents.seek(0)
            with tarfile.open(tarball, mode="r:gz",
                              fileobj=tar_contents) as tgz:
                tgz.extractall("build")

        print("Building freetype in {}".format(src_path))
        if sys.platform != 'win32':
            # compilation on all other platforms than windows
            env = {
                **os.environ, "CFLAGS":
                "{} -fPIC".format(os.environ.get("CFLAGS", ""))
            }
            subprocess.check_call([
                "./configure", "--with-zlib=no", "--with-bzip2=no",
                "--with-png=no", "--with-harfbuzz=no"
            ],
                                  env=env,
                                  cwd=src_path)
            subprocess.check_call(["make"], env=env, cwd=src_path)
        else:
            # compilation on windows
            shutil.rmtree(str(pathlib.Path(src_path, "objs")),
                          ignore_errors=True)
            FREETYPE_BUILD_CMD = r"""
call "%ProgramFiles%\Microsoft SDKs\Windows\v7.0\Bin\SetEnv.Cmd" ^
    /Release /{xXX} /xp
call "{vcvarsall}" {xXX}
set MSBUILD=C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
%MSBUILD% "builds\windows\{vc20xx}\freetype.sln" ^
    /t:Clean;Build /p:Configuration="Release";Platform={WinXX}
"""
            import distutils.msvc9compiler as msvc
            # Note: freetype has no build profile for 2014, so we don't bother...
            vc = 'vc2010'
            WinXX = 'x64' if platform.architecture()[0] == '64bit' else 'Win32'
            xXX = 'x64' if platform.architecture()[0] == '64bit' else 'x86'
            vcvarsall = msvc.find_vcvarsall(10.0)
            if vcvarsall is None:
                raise RuntimeError('Microsoft VS 2010 required')
            cmdfile = pathlib.Path("build/build_freetype.cmd")
            cmdfile.write_text(
                FREETYPE_BUILD_CMD.format(vc20xx=vc,
                                          WinXX=WinXX,
                                          xXX=xXX,
                                          vcvarsall=vcvarsall))
            subprocess.check_call([str(cmdfile.resolve())],
                                  shell=True,
                                  cwd=src_path)
            # Move to the corresponding Unix build path.
            pathlib.Path(src_path, "objs/.libs").mkdir()
            # Be robust against change of FreeType version.
            lib_path, = (pathlib.Path(src_path, "objs", vc,
                                      xXX).glob("freetype*.lib"))
            shutil.copy2(
                str(lib_path),
                str(pathlib.Path(src_path, "objs/.libs/libfreetype.lib")))
Beispiel #10
0
def query_vcvarsall():
    vcvarsall = find_vcvarsall(get_build_version())
    return query_process('"%s" %s & set' % (vcvarsall, plat))
Beispiel #11
0
def main():
  parser = get_parser()
  args = parser.parse_args()

  vxlDir = path_join(env['VIP_VXL_BUILD_DIR'], env['VIP_VXL_BUILD_TYPE'])
  mkpath(vxlDir);
  os.chdir(vxlDir);


  if os.name == 'nt':
    if not os.path.exists(env['VIP_GLEW_INCLUDE_DIR']):
      print "You are missing Glew"
      from voxel_globe.tools.wget import download
      print "Downloading..."
      zipFile = os.path.join(env['VIP_GLEW_INCLUDE_DIR'], '../../glew.zip')
      dater = download('http://downloads.sourceforge.net/project/glew/glew/' 
                       '1.12.0/glew-1.12.0-win32.zip', 
                       zipFile)
      print "Unpacking..."
      subprocess.Popen(['7z.exe', 'x', zipFile], 
          cwd=os.path.join(env['VIP_GLEW_INCLUDE_DIR'], '../..')).wait();
    from distutils.msvc9compiler import find_vcvarsall
    platform = env.get('VIP_CMAKE_PLATFORM', None)
    if 'VCVARSALL' not in env:
      if platform and platform.lower().startswith('visual'):
        msvcVersion = int(platform.split(' ')[2])
        vcvarall = find_vcvarsall(msvcVersion)
      else:
        for v in range(14, 8, -1): 
        #Start with version 2015(14), and got back to (8),
        #before that its 32 bit only, and we don't care about that
          vcvarall = find_vcvarsall(v)
          if not vcvarall is None:
            if platform.lower() != 'ninja':
              platform = 'Visual Studio %d Win64' % v
            break
      env['VCVARSALL'] = vcvarall
  else:
    platform = env['VIP_CMAKE_PLATFORM']

  if not args.rebuild:
    cmake_options = [];
    
    cmake_options += ['-G', platform]

    #HIGHLY recommended for ninja
    if 'VIP_CMAKE_MAKE_PROGRAM' in env:
      cmake_options += ['-D', 'CMAKE_MAKE_PROGRAM='+\
                              env['VIP_CMAKE_MAKE_PROGRAM']]
    #More or less required for ninja in windows
    if 'VIP_CMAKE_COMPILER' in env:
      cmake_options += ['-D', 'CMAKE_C_COMPILER='+env['VIP_CMAKE_COMPILER']]
      cmake_options += ['-D', 'CMAKE_CXX_COMPILER='+ env['VIP_CMAKE_COMPILER']]


    cmake_options += ['-D', 'CMAKE_BUILD_TYPE='+env['VIP_VXL_BUILD_TYPE']];
    
    if 'VIP_OPENCL_INCLUDE_PATH' in env:
      cmake_options += ['-D', 'OPENCL_INCLUDE_PATH='+
                        env['VIP_OPENCL_INCLUDE_PATH']]
    if 'VIP_OPENCL_LIBRARY_PATH' in env:
      cmake_options += ['-D', 'OPENCL_LIBRARY_PATH='+
                        env['VIP_OPENCL_LIBRARY_PATH']]
    if 'VIP_OPENCL_NVIDIA_LIBRARY_PATH' in env:
      cmake_options += ['-D', 'OPENCL_NVIDIA_LIBRARY_PATH='+
                        env['VIP_OPENCL_NVIDIA_LIBRARY_PATH']]
    if 'VIP_GLEW_INCLUDE_DIR' in env:
      cmake_options += ['-D', 'GLEW_INCLUDE_DIR='+env['VIP_GLEW_INCLUDE_DIR']]
    if 'VIP_GLEW_LIBRARY' in env:
      cmake_options += ['-D', 'GLEW_LIBRARY='+env['VIP_GLEW_LIBRARY']]

    if platform=="Eclipse CDT4 - Unix Makefiles":
      cmake_options += ['-D', 'CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT=True']

    cmake_options += ['-D', 'CMAKE_INSTALL_PREFIX='+
                   path_join(vxlDir, 'install')];

    cmake_options += ['-D', 'EXECUTABLE_OUTPUT_PATH='+
                   path_join(vxlDir, 'bin')];

    cmake_options += ['-D', 'PYTHON_INCLUDE_DIR='+
                      env['VIP_PYTHON_INCLUDE_DIR'],
                      '-D', 'PYTHON_LIBRARY='+
                      env['VIP_PYTHON_LIBRARY'],
                      '-D', 'PYTHON_INCLUDE_DIR2='+
                      env['VIP_PYTHON_INCLUDE_DIR'],
                      '-D', 'PYTHON_EXECUTABLE='+
                      env['VIP_PYTHON_EXECUTABLE']];
                      
    tmp = env.pop('VIP_CMAKE_ECLIPSE', None);
    if tmp:
      cmake_options += ['-D', 'CMAKE_ECLIPSE_EXECUTABLE='+tmp];

    # Pretty open options section. User can in theory, override anything here  

    tmp = env.pop('VIP_VXL_CMAKE_OPTIONS', None);
    if tmp:
      cmake_options += literal_eval('[' + tmp + ']');
      #Sure, this may be generally unsafe, but only the user administrating the 
      #computer should be able to set and run this, so I choose to trust them
      #Update. literal_eval should be "safe"...er

    tmp = env.pop('VIP_VXL_CMAKE_ENTRIES', None);
    if tmp:
      tmp = literal_eval('[' + tmp + ']');
      for entry in tmp:
        cmake_options += ['-D', entry];

    #Run CMake
    if os.name=='nt':
      if platform.lower()=='ninja':
        args = [ntpath.normpath(os.path.join(env['VIP_INSTALL_DIR'], 
                                             'run_vcvarsall.bat'))]
        pid = subprocess.Popen(args+[env['VIP_CMAKE']] + cmake_options + 
                               [env['VIP_VXL_SRC_DIR']])
      else:
        pid = subprocess.Popen([env['VIP_CMAKE']] + cmake_options + 
                               [env['VIP_VXL_SRC_DIR']])

    else:
      pid = subprocess.Popen([env['VIP_CMAKE']] + cmake_options + 
                               [env['VIP_VXL_SRC_DIR']])
    pid.wait()

  if args.cmake:
    return

  #Make it
  if os.name=='nt':
    if platform.lower()=='ninja':
      cmd = [ntpath.normpath(os.path.join(env['VIP_INSTALL_DIR'], 
                                           'run_vcvarsall.bat')), 
              env['VIP_CMAKE_NINJA']]
    else:
      cmd = [ntpath.normpath(os.path.join(env['VIP_INSTALL_DIR'], 
                                           'run_vcvarsall.bat')), 
              'devenv', 'vxl.sln', '/Build', 
              env['VIP_VXL_BUILD_TYPE']+'^^^|x64']
      #The ^^^ is for Stupid batch escape limitation with | Thank you windows! :(
    
    if platform.lower() != 'ninja':
      if args.verbose:
        pass #No idea right now
      print "Loading vxl solution... This may take a few minutes."
  else:
    cmd = [env['VIP_CMAKE_MAKE_PROGRAM'], '-j', '10']
    if args.verbose:
      if platform.lower() != 'ninja':
        cmd += ['VERBOSE=1']

  if args.verbose:
    if platform.lower() == 'ninja':
      cmd += ['-v']
  pid = subprocess.Popen(cmd, cwd=vxlDir);
  pid.wait();
Beispiel #12
0
def distutils_vcvars():
    from distutils.msvc9compiler import find_vcvarsall, get_build_version
    return find_vcvarsall(get_build_version())
Beispiel #13
0
# ...from standard library:
from __future__ import division, print_function
import os
import sys
import shutil
from distutils.core import setup
from distutils.extension import Extension
# ...from site-packages:
import Cython.Build
import numpy

testpath = (r'C:\Program Files (x86)\Common Files\Microsoft\Visual '
            r'C++ for Python\9.0\vcvarsall.bat')
if sys.platform.startswith('win'):
    from distutils import msvc9compiler
    if msvc9compiler.find_vcvarsall(9.0) is None:
        msvc9compiler.find_vcvarsall = lambda dummy: testpath
        print("NotImplementedError('ToDo')")

install = 'install' in sys.argv
coverage_report = 'coverage_report' in sys.argv
if coverage_report:
    sys.argv.remove('coverage_report')

packages = ['hydpy', 'hydpy.cythons', 'hydpy.core', 'hydpy.tests',
            'hydpy.docs', 'hydpy.auxs', 'hydpy.models']
for name in os.listdir(os.path.join('hydpy', 'models')):
    if not (name.startswith('_') or
            os.path.isfile(os.path.join('hydpy', 'models', name))):
        packages.append('.'.join(('hydpy', 'models', name)))
Beispiel #14
0
def find_vcvarsall(version):
    from distutils import msvc9compiler
    vcvarsall_path = msvc9compiler.find_vcvarsall(version)
    return vcvarsall_path