aboutsummaryrefslogtreecommitdiffstats
path: root/python/servo/bootstrapper/windows_msvc.py
diff options
context:
space:
mode:
authorAneesh Agrawal <aneeshusa@gmail.com>2017-01-13 23:11:34 -0500
committerAneesh Agrawal <aneeshusa@gmail.com>2017-01-15 15:41:37 -0500
commit60a1503b2997b05e3f36f4ce92d688df44fdeae7 (patch)
treea2196ba44e6d3af41e28d322ff4dda7ffb59748b /python/servo/bootstrapper/windows_msvc.py
parentef900cbdcb0e544639ae10b390a68da2afd8bcce (diff)
downloadservo-60a1503b2997b05e3f36f4ce92d688df44fdeae7.tar.gz
servo-60a1503b2997b05e3f36f4ce92d688df44fdeae7.zip
Clean up and simplify existing `mach bootstrap`
- Default to interactive mode and remove the `--interactive` flag - Use `--force` to skip interactivity - Change MSVC dependency storage organization on disk: put each version into its own folder and directly refer to the versioned folders, providing immutability and making the installation list redundant - Reuse `host_triple()` function to fix broken bootstrapper dispatching - Simplify code: - Remove or inline many unused and redudant functions and variables - Prefer plain functions to classes - Consolidate into fewer files, remove unnecessary bootstrapper/ dir - Improve Python style - Sort dependency list
Diffstat (limited to 'python/servo/bootstrapper/windows_msvc.py')
-rw-r--r--python/servo/bootstrapper/windows_msvc.py82
1 files changed, 0 insertions, 82 deletions
diff --git a/python/servo/bootstrapper/windows_msvc.py b/python/servo/bootstrapper/windows_msvc.py
deleted file mode 100644
index 0545928f453..00000000000
--- a/python/servo/bootstrapper/windows_msvc.py
+++ /dev/null
@@ -1,82 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-import os
-import shutil
-from distutils import spawn
-
-from servo.util import extract, download_file
-from base import BaseBootstrapper
-from packages import WINDOWS_MSVC as deps
-
-
-class WindowsMsvcBootstrapper(BaseBootstrapper):
- '''Bootstrapper for MSVC building on Windows.'''
-
- def __init__(self, **kwargs):
- BaseBootstrapper.__init__(self, **kwargs)
-
- def ensure_system_packages(self):
- self.install_system_packages()
-
- def install_system_packages(self, packages=deps):
-
- deps_dir = os.path.join(self.context.sharedir, "msvc-dependencies")
- deps_url = "https://servo-rust.s3.amazonaws.com/msvc-deps/"
- first_run = True
-
- if self.force:
- if os.path.isdir(deps_dir):
- shutil.rmtree(deps_dir)
-
- if not os.path.isdir(deps_dir):
- os.makedirs(deps_dir)
-
- # Read file with installed dependencies, if exist
- installed_deps_file = os.path.join(deps_dir, "installed-dependencies.txt")
- if os.path.exists(installed_deps_file):
- installed_deps = [l.strip() for l in open(installed_deps_file)]
- else:
- installed_deps = []
-
- # list of dependencies that need to be updated
- update_deps = list(set(packages) - set(installed_deps))
-
- for dep in packages:
- dep_name = dep.split("-")[0]
-
- # Don't download CMake if already exists in PATH
- if dep_name == "cmake":
- if spawn.find_executable(dep_name):
- continue
-
- dep_dir = os.path.join(deps_dir, dep_name)
- # if not installed or need to be updated
- if not os.path.exists(dep_dir) or dep in update_deps:
- if first_run:
- print "Installing missing MSVC dependencies..."
- first_run = False
-
- dep_version_dir = os.path.join(deps_dir, dep)
-
- if os.path.exists(dep_version_dir):
- shutil.rmtree(dep_version_dir)
-
- dep_zip = dep_version_dir + ".zip"
- if not os.path.isfile(dep_zip):
- download_file(dep, "%s%s.zip" % (deps_url, dep), dep_zip)
-
- print "Extracting %s..." % dep,
- extract(dep_zip, deps_dir)
- print "done"
-
- # Delete directory if exist
- if os.path.exists(dep_dir):
- shutil.rmtree(dep_dir)
- os.rename(dep_version_dir, dep_dir)
-
- # Write in installed-dependencies.txt file
- with open(installed_deps_file, 'w') as installed_file:
- for line in packages:
- installed_file.write(line + "\n")