aboutsummaryrefslogtreecommitdiffstats
path: root/setup.py
diff options
context:
space:
mode:
authorRoman Lacko <backup.rlacko@gmail.com>2013-04-25 12:49:09 +0200
committerRoman Lacko <backup.rlacko@gmail.com>2013-04-25 12:49:09 +0200
commit5601a57afc1742e007bfa6150ef04903163d4f64 (patch)
tree693cdc9566b5823b0442acc198412b29debd813b /setup.py
parentf9933ac4fb362e68acafeb725db499567e3d3747 (diff)
Introduce option --msvc-version to specify version of MSVC compiler. Use that optition to get MSVC environment variables.
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/setup.py b/setup.py
index f84d47fdd..438dd9fae 100644
--- a/setup.py
+++ b/setup.py
@@ -82,6 +82,8 @@ from utils import copydir
from utils import run_process
from utils import has_option
from utils import option_value
+from utils import find_vcvarsall
+from utils import get_environment_from_batch_command
# Declare options
OPTION_DEBUG = has_option("debug")
@@ -94,6 +96,7 @@ 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")
if OPTION_QMAKE is None:
OPTION_QMAKE = find_executable("qmake")
@@ -106,6 +109,13 @@ 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 OPTION_MSVCVERSION:
+ 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", "11.0"]:
+ print("Invalid option --msvc-version. Available values are %s" % (["9.0", "10.0", "11.0"]))
+ sys.exit(1)
else:
if OPTION_MAKESPEC is None:
OPTION_MAKESPEC = "make"
@@ -235,8 +245,21 @@ class pyside_build(_build):
self.py_version = None
self.build_type = "Release"
self.qtinfo = None
+ self.msvc_env = None
def run(self):
+ # Try to get MSVC env
+ if sys.platform == "win32" and OPTION_MSVCVERSION:
+ log.info("Searching vcvarsall.bat for MSVC version %s" % OPTION_MSVCVERSION)
+ msvc_version = float(OPTION_MSVCVERSION)
+ vcvarsall_path = find_vcvarsall(msvc_version)
+ if not vcvarsall_path:
+ raise DistutilsSetupError(
+ "Failed to find the vcvarsall.bat for MSVC version %s." % OPTION_MSVCVERSION)
+ log.info("Found %s" % vcvarsall_path)
+ vcvarsall_cmd = ["call", vcvarsall_path]
+ self.msvc_env = get_environment_from_batch_command(vcvarsall_path)
+
# Check env
make_path = None
make_generator = None