aboutsummaryrefslogtreecommitdiffstats
path: root/python/servo/command_base.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/servo/command_base.py')
-rw-r--r--python/servo/command_base.py64
1 files changed, 12 insertions, 52 deletions
diff --git a/python/servo/command_base.py b/python/servo/command_base.py
index 80fe675da1c..e80c9cb018b 100644
--- a/python/servo/command_base.py
+++ b/python/servo/command_base.py
@@ -18,11 +18,12 @@ import subprocess
from subprocess import PIPE
import sys
import tarfile
-import platform
+from mach.registrar import Registrar
import toml
-from mach.registrar import Registrar
+from servo.packages import WINDOWS_MSVC as msvc_deps
+from servo.util import host_triple
BIN_SUFFIX = ".exe" if sys.platform == "win32" else ""
@@ -107,51 +108,6 @@ def archive_deterministically(dir_to_archive, dest_archive, prepend_path=None):
os.rename(temp_file, dest_archive)
-def host_triple():
- os_type = platform.system().lower()
- if os_type == "linux":
- os_type = "unknown-linux-gnu"
- elif os_type == "darwin":
- os_type = "apple-darwin"
- elif os_type == "android":
- os_type = "linux-androideabi"
- elif os_type == "windows":
- # If we are in a Visual Studio environment, use msvc
- if os.getenv("PLATFORM") is not None:
- os_type = "pc-windows-msvc"
- elif os.getenv("MSYSTEM") is not None:
- os_type = "pc-windows-gnu"
- else:
- os_type = "unknown"
- elif os_type.startswith("mingw64_nt-") or os_type.startswith("cygwin_nt-"):
- os_type = "pc-windows-gnu"
- elif os_type == "freebsd":
- os_type = "unknown-freebsd"
- else:
- os_type = "unknown"
-
- cpu_type = platform.machine().lower()
- if os_type.endswith("-msvc"):
- # vcvars*.bat should set it properly
- platform_env = os.environ.get("PLATFORM")
- if platform_env == "X86":
- cpu_type = "i686"
- elif platform_env == "X64":
- cpu_type = "x86_64"
- else:
- cpu_type = "unknown"
- elif cpu_type in ["i386", "i486", "i686", "i768", "x86"]:
- cpu_type = "i686"
- elif cpu_type in ["x86_64", "x86-64", "x64", "amd64"]:
- cpu_type = "x86_64"
- elif cpu_type == "arm":
- cpu_type = "arm"
- else:
- cpu_type = "unknown"
-
- return "%s-%s" % (cpu_type, os_type)
-
-
def normalize_env(env):
# There is a bug in subprocess where it doesn't like unicode types in
# environment variables. Here, ensure all unicode are converted to
@@ -428,14 +384,18 @@ class CommandBase(object):
if "msvc" in (target or host_triple()):
msvc_x64 = "64" if "x86_64" in (target or host_triple()) else ""
msvc_deps_dir = path.join(self.context.sharedir, "msvc-dependencies")
- extra_path += [path.join(msvc_deps_dir, "cmake", "bin")]
- extra_path += [path.join(msvc_deps_dir, "ninja", "bin")]
+
+ def package_dir(package):
+ return path.join(msvc_deps_dir, package, msvc_deps[package])
+
+ extra_path += [path.join(package_dir("cmake"), "bin")]
+ extra_path += [path.join(package_dir("ninja"), "bin")]
# Link openssl
- env["OPENSSL_INCLUDE_DIR"] = path.join(msvc_deps_dir, "openssl", "include")
- env["OPENSSL_LIB_DIR"] = path.join(msvc_deps_dir, "openssl", "lib" + msvc_x64)
+ env["OPENSSL_INCLUDE_DIR"] = path.join(package_dir("openssl"), "include")
+ env["OPENSSL_LIB_DIR"] = path.join(package_dir("openssl"), "lib" + msvc_x64)
env["OPENSSL_LIBS"] = "ssleay32MD:libeay32MD"
# Link moztools
- env["MOZTOOLS_PATH"] = path.join(msvc_deps_dir, "moztools", "bin")
+ env["MOZTOOLS_PATH"] = path.join(package_dir("moztools"), "bin")
if is_windows():
if not os.environ.get("NATIVE_WIN32_PYTHON"):