adding check for windows then using Scripts instead of bin

This commit is contained in:
Jason Williams 2016-01-05 00:22:28 +00:00 committed by Lars Bergstrom
parent 095658e098
commit 13d98f153a
6 changed files with 61 additions and 41 deletions

View file

@ -63,7 +63,22 @@ git = "https://github.com/servo/ipc-channel"
[dependencies.offscreen_gl_context] [dependencies.offscreen_gl_context]
git = "https://github.com/ecoal95/rust-offscreen-rendering-context" git = "https://github.com/ecoal95/rust-offscreen-rendering-context"
[dependencies.gaol] [target.arm-linux-androideabi.dependencies.gaol]
git = "https://github.com/pcwalton/gaol"
[target.x86_64-apple-darwin.dependencies.gaol]
git = "https://github.com/pcwalton/gaol"
[target.x86_64-unknown-linux-gnu.dependencies.gaol]
git = "https://github.com/pcwalton/gaol"
[target.i686-unknown-linux-gnu.dependencies.gaol]
git = "https://github.com/pcwalton/gaol"
[target.arm-unknown-linux-gnueabihf.dependencies.gaol]
git = "https://github.com/pcwalton/gaol"
[target.aarch64-unknown-linux-gnueabihf.dependencies.gaol]
git = "https://github.com/pcwalton/gaol" git = "https://github.com/pcwalton/gaol"
[dependencies] [dependencies]

View file

@ -406,6 +406,18 @@ impl<LTF: LayoutThreadFactory, STF: ScriptThreadFactory> Constellation<LTF, STF>
// //
// Yes, that's all there is to it! // Yes, that's all there is to it!
if opts::multiprocess() { if opts::multiprocess() {
self.spawn_multiprocess(unprivileged_pipeline_content);
} else {
unprivileged_pipeline_content.start_all::<LTF, STF>(false);
}
}
assert!(!self.pipelines.contains_key(&pipeline_id));
self.pipelines.insert(pipeline_id, pipeline);
}
#[cfg(not(target_os = "windows"))]
fn spawn_multiprocess(&mut self, unprivileged_pipeline_content: UnprivilegedPipelineContent) {
let (server, token) = let (server, token) =
IpcOneShotServer::<IpcSender<UnprivilegedPipelineContent>>::new().unwrap(); IpcOneShotServer::<IpcSender<UnprivilegedPipelineContent>>::new().unwrap();
@ -423,17 +435,15 @@ impl<LTF: LayoutThreadFactory, STF: ScriptThreadFactory> Constellation<LTF, STF>
child_process.arg(token); child_process.arg(token);
ChildProcess::Unsandboxed(child_process.spawn().unwrap()) ChildProcess::Unsandboxed(child_process.spawn().unwrap())
}; };
self.child_processes.push(child_process);
self.child_processes.push(child_process);
let (_receiver, sender) = server.accept().unwrap(); let (_receiver, sender) = server.accept().unwrap();
sender.send(unprivileged_pipeline_content).unwrap(); sender.send(unprivileged_pipeline_content).unwrap();
} else {
unprivileged_pipeline_content.start_all::<LTF, STF>(false);
}
} }
assert!(!self.pipelines.contains_key(&pipeline_id)); #[cfg(target_os = "windows")]
self.pipelines.insert(pipeline_id, pipeline); fn spawn_multiprocess(&mut self, _: UnprivilegedPipelineContent) {
panic!("Multiprocess is not supported on Windows.");
} }
// Push a new (loading) pipeline to the list of pending frame changes // Push a new (loading) pipeline to the list of pending frame changes

View file

@ -92,7 +92,9 @@ def _activate_virtualenv(topdir):
if python is None: if python is None:
sys.exit("Python is not installed. Please install it prior to running mach.") sys.exit("Python is not installed. Please install it prior to running mach.")
activate_path = os.path.join(virtualenv_path, "bin", "activate_this.py") # Virtualenv calls its scripts folder "bin" on linux/OSX but "Scripts" on Windows, detect which one then use that
script_dir = "Scripts" if os.name == "nt" else "bin"
activate_path = os.path.join(virtualenv_path, script_dir, "activate_this.py")
if not (os.path.exists(virtualenv_path) and os.path.exists(activate_path)): if not (os.path.exists(virtualenv_path) and os.path.exists(activate_path)):
virtualenv = _get_exec(*VIRTUALENV_NAMES) virtualenv = _get_exec(*VIRTUALENV_NAMES)
if virtualenv is None: if virtualenv is None:

View file

@ -28,7 +28,7 @@ from mach.decorators import (
Command, Command,
) )
from servo.command_base import CommandBase, cd, host_triple, use_nightly_rust, check_call, BIN_SUFFIX from servo.command_base import CommandBase, cd, host_triple, check_call, BIN_SUFFIX
def download(desc, src, writer): def download(desc, src, writer):

View file

@ -16,9 +16,7 @@ import toml
from mach.registrar import Registrar from mach.registrar import Registrar
BIN_SUFFIX = "" BIN_SUFFIX = ".exe" if sys.platform == "win32" else ""
if sys.platform == "win32":
BIN_SUFFIX = ".exe"
@contextlib.contextmanager @contextlib.contextmanager
@ -59,10 +57,8 @@ def host_triple():
def use_nightly_rust(): def use_nightly_rust():
envvar = os.environ.get("SERVO_USE_NIGHTLY_RUST") envvar = os.environ.get("SERVO_USE_NIGHTLY_RUST", "0")
if envvar:
return envvar != "0" return envvar != "0"
return False
def call(*args, **kwargs): def call(*args, **kwargs):
@ -70,11 +66,9 @@ def call(*args, **kwargs):
verbose = kwargs.pop('verbose', False) verbose = kwargs.pop('verbose', False)
if verbose: if verbose:
print(' '.join(args[0])) print(' '.join(args[0]))
if sys.platform == "win32":
# we have to use shell=True in order to get PATH handling # we have to use shell=True in order to get PATH handling
# when looking for the binary on Windows # when looking for the binary on Windows
return subprocess.call(*args, shell=True, **kwargs) return subprocess.call(*args, shell=sys.platform == 'win32', **kwargs)
return subprocess.call(*args, **kwargs)
def check_call(*args, **kwargs): def check_call(*args, **kwargs):
@ -82,11 +76,9 @@ def check_call(*args, **kwargs):
verbose = kwargs.pop('verbose', False) verbose = kwargs.pop('verbose', False)
if verbose: if verbose:
print(' '.join(args[0])) print(' '.join(args[0]))
if sys.platform == "win32":
# we have to use shell=True in order to get PATH handling # we have to use shell=True in order to get PATH handling
# when looking for the binary on Windows # when looking for the binary on Windows
return subprocess.check_call(*args, shell=True, **kwargs) return subprocess.check_call(*args, shell=sys.platform == 'win32', **kwargs)
return subprocess.check_call(*args, **kwargs)
class CommandBase(object): class CommandBase(object):

View file

@ -10,6 +10,7 @@
from __future__ import print_function, unicode_literals from __future__ import print_function, unicode_literals
from os import path, getcwd, listdir from os import path, getcwd, listdir
import subprocess
import sys import sys
from mach.decorators import ( from mach.decorators import (