diff options
-rw-r--r-- | README.rst | 6 | ||||
-rw-r--r-- | setup.py | 15 | ||||
-rw-r--r-- | utils.py | 63 |
3 files changed, 24 insertions, 60 deletions
diff --git a/README.rst b/README.rst index 718971e77..b50397474 100644 --- a/README.rst +++ b/README.rst @@ -278,10 +278,6 @@ Options Specify the path to cmake. Useful when the cmake is not in path. -``--msvc-version`` - Specify the Visual C++ compiler version. - Supported values are ``9.0`` (for VS 2008), ``10.0`` (for VS 2010). - ``--standalone`` When enabled, all required Qt libs will be included in PySide distribution. This option is allways enabled on Windows System. @@ -339,6 +335,7 @@ PySide-setup ************ - Support for building windows binaries with only Windows SDK installed (Visual Studio is no more required) +- Removed --msvc-version option. Required msvc compiler version is now resolved from python interpreter version 1.2.0 (2013-07-02) ------------------ @@ -436,7 +433,6 @@ PySide-setup - Add --jom and --jobs options - Add --no-examples option to exclude the examples - Add --relwithdebinfo option to enable a release-with-debug-info build mode -- Add --msvc-version option to specify version of MSVC compiler - Add --ignore-git option - Add --make-spec option to specify make generator @@ -101,7 +101,6 @@ OPTION_VERSION = option_value("version") OPTION_LISTVERSIONS = has_option("list-versions") OPTION_MAKESPEC = option_value("make-spec") OPTION_IGNOREGIT = has_option("ignore-git") -OPTION_MSVCVERSION = option_value("msvc-version") OPTION_NOEXAMPLES = has_option("no-examples") # don't include pyside-examples OPTION_JOBS = option_value('jobs') # number of parallel build jobs OPTION_JOM = has_option('jom') # use jom instead of nmake with msvc @@ -119,18 +118,6 @@ if sys.platform == "win32": if not OPTION_MAKESPEC in ["msvc", "mingw"]: print("Invalid option --make-spec. Available values are %s" % (["msvc", "mingw"])) sys.exit(1) - if not OPTION_MSVCVERSION: - if sys.version_info[:2] < (3,3): - OPTION_MSVCVERSION = "9.0" - else: - OPTION_MSVCVERSION = "10.0" - else: - if OPTION_MAKESPEC != "msvc": - print("Option --msvc-version can be used only with option --make-spec=msvc") - sys.exit(1) - if not OPTION_MSVCVERSION in ["9.0", "10.0"]: - print("Invalid option --msvc-version. Available values are %s" % (["9.0", "10.0"])) - sys.exit(1) else: if OPTION_MAKESPEC is None: OPTION_MAKESPEC = "make" @@ -312,7 +299,7 @@ class pyside_build(_build): nmake_path = find_executable("nmake") if nmake_path is None or not os.path.exists(nmake_path): log.info("nmake not found. Trying to initialize the MSVC env...") - init_msvc_env(OPTION_MSVCVERSION, platform_arch, log) + init_msvc_env(platform_arch, log) else: log.info("nmake was found in %s" % nmake_path) if OPTION_JOM: @@ -111,58 +111,39 @@ def find_vcdir(version): return productdir -def find_vcdirs(versions): - paths = [] - for version in versions: - vcdir_path = find_vcdir(version) - if vcdir_path: - paths.append([version, vcdir_path]) - return paths +def init_msvc_env(platform_arch, logger): + from distutils.msvc9compiler import VERSION as MSVC_VERSION - -def init_msvc_env(default_msvc_version, platform_arch, logger): - logger.info("Searching vcvars.bat") - - all_vcdirs = find_vcdirs([9.0, 10.0, 11.0]) - if len(all_vcdirs) == 0: + logger.info("Searching MSVC compiler version %s" % MSVC_VERSION) + vcdir_path = find_vcdir(MSVC_VERSION) + if not vcdir_path: raise DistutilsSetupError( - "Failed to find the MSVC compiler on your system.") + "Failed to find the MSVC compiler version %s on your system." % MSVC_VERSION) + else: + logger.info("Found %s" % vcdir_path) - all_vcvars = [] - for v in all_vcdirs: - if platform_arch.startswith("32"): - vcvars_path = os.path.join(v[1], "bin", "vcvars32.bat") - else: - vcvars_path = os.path.join(v[1], "bin", "vcvars64.bat") + logger.info("Searching MSVC compiler %s environment init script" % MSVC_VERSION) + if platform_arch.startswith("32"): + vcvars_path = os.path.join(vcdir_path, "bin", "vcvars32.bat") + else: + vcvars_path = os.path.join(vcdir_path, "bin", "vcvars64.bat") + if not os.path.exists(vcvars_path): + vcvars_path = os.path.join(vcdir_path, "bin", "amd64", "vcvars64.bat") if not os.path.exists(vcvars_path): - vcvars_path = os.path.join(v[1], "bin", "amd64", "vcvars64.bat") - if os.path.exists(vcvars_path): - all_vcvars.append([v[0], vcvars_path]) + vcvars_path = os.path.join(vcdir_path, "bin", "amd64", "vcvarsamd64.bat") - if len(all_vcvars) == 0: + if not os.path.exists(vcvars_path): raise DistutilsSetupError( - "Failed to find the MSVC compiler on your system.") - for v in all_vcvars: - logger.info("Found %s" % v[1]) - - if default_msvc_version: - msvc_version = float(default_msvc_version) - vcvarsall_path_tmp = [p for p in all_vcvars if p[0] == msvc_version] - vcvarsall_path = vcvarsall_path_tmp[0][1] if len(vcvarsall_path_tmp) > 0 else None - if not vcvarsall_path: - raise DistutilsSetupError( - "Failed to find the vcvars.bat for MSVC version %s." % msvc_version) + "Failed to find the MSVC compiler environment init script (vcvars.bat) on your system.") else: - # By default use first MSVC compiler found in system - msvc_version = all_vcvars[0][0] - vcvarsall_path = all_vcvars[0][1] + logger.info("Found %s" % vcvars_path) # Get MSVC env - logger.info("Using MSVC %s in %s" % (msvc_version, vcvarsall_path)) + logger.info("Using MSVC %s in %s" % (MSVC_VERSION, vcvars_path)) msvc_arch = "x86" if platform_arch.startswith("32") else "amd64" logger.info("Getting MSVC env for %s architecture" % msvc_arch) - vcvarsall_cmd = [vcvarsall_path, msvc_arch] - msvc_env = get_environment_from_batch_command(vcvarsall_cmd) + vcvars_cmd = [vcvars_path, msvc_arch] + msvc_env = get_environment_from_batch_command(vcvars_cmd) msvc_env_paths = os.pathsep.join([msvc_env[k] for k in msvc_env if k.upper() == 'PATH']).split(os.pathsep) msvc_env_without_paths = dict([(k, msvc_env[k]) for k in msvc_env if k.upper() != 'PATH']) |