aboutsummaryrefslogtreecommitdiffstats
path: root/python/servo/build_commands.py
diff options
context:
space:
mode:
authorMeFisto94 <MeFisto94@users.noreply.github.com>2019-12-22 20:56:29 +0100
committerMeFisto94 <MeFisto94@users.noreply.github.com>2019-12-23 00:31:07 +0100
commit215177d791ab2f4ca5fbd633e904475d16d91386 (patch)
treedf44d7175fdb8e1e04230c2ee6dde19713ff3e57 /python/servo/build_commands.py
parent43a5f65940f85a30ba3f7fb9cbb96b194cde81b6 (diff)
downloadservo-215177d791ab2f4ca5fbd633e904475d16d91386.tar.gz
servo-215177d791ab2f4ca5fbd633e904475d16d91386.zip
Launch vcvarsall.bat for the recognized VS Installation Directory from python instead of making mach.bat try that on hardcoded paths.
Diffstat (limited to 'python/servo/build_commands.py')
-rw-r--r--python/servo/build_commands.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/python/servo/build_commands.py b/python/servo/build_commands.py
index 4630c9a9dbf..60684e02c27 100644
--- a/python/servo/build_commands.py
+++ b/python/servo/build_commands.py
@@ -10,6 +10,7 @@
from __future__ import print_function, unicode_literals
import datetime
+import locale
import os
import os.path as path
import platform
@@ -318,6 +319,16 @@ class MachCommands(CommandBase):
"lib", "pkgconfig"
)
+ if 'windows' in host:
+ process = subprocess.Popen('("%s" %s > nul) && "python" -c "import os; print(repr(os.environ))"' %
+ (os.path.join(vs_dirs['vcdir'], "Auxiliary", "Build", "vcvarsall.bat"), "x64"),
+ stdout=subprocess.PIPE, shell=True)
+ stdout, _ = process.communicate()
+ exitcode = process.wait()
+ encoding = locale.getpreferredencoding() # See https://stackoverflow.com/a/9228117
+ if exitcode == 0:
+ os.environ.update(eval(stdout.decode(encoding)))
+
# Ensure that GStreamer libraries are accessible when linking.
if 'windows' in target_triple:
gst_root = gstreamer_root(target_triple, env)