servo/mach
author Aidan Hobson Sayers <aidanhs@cantab.net>
Wed, 16 Sep 2015 14:34:17 -0600
changeset 475330 f85e0eba385cbdd40a2fbc649e57d967d882e437
parent 473047 011d6feca67a86ea040809de94e51c634766265f
child 477093 74ffb4163f720d00a09055d167a7d6b49056fb83
permissions -rwxr-xr-x
servo: Merge #7632 - Speedup mach startup (from aidanhs:aphs-speedup-mach-startup); r=metajack ...by using a 'marker file' to indicate whether we actually need to run pip. Also a minor tweak for clarity. Before (consistently): ``` $ time ./mach >/dev/null real 0m0.666s user 0m0.477s sys 0m0.190s ``` After: ``` $ time ./mach >/dev/null # first run real 0m0.665s user 0m0.501s sys 0m0.166s $ time ./mach >/dev/null real 0m0.121s user 0m0.083s sys 0m0.039s ``` Source-Repo: https://github.com/servo/servo Source-Revision: b511004a616862394318381d7ef5ac3c59c7babe

#!/bin/sh
# 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/.

# The beginning of this script is both valid shell and valid python,
# such that the script starts with the shell and is reexecuted with
# the right python.
'''which' python2.7 > /dev/null && exec python2.7 "$0" "$@" || exec python "$0" "$@"
'''

from __future__ import print_function, unicode_literals

import os
import sys

def main(args):
    topdir = os.path.dirname(sys.argv[0])
    sys.path.insert(0, os.path.join(topdir, "python"))
    import mach_bootstrap
    mach = mach_bootstrap.bootstrap(topdir)
    sys.exit(mach.run(sys.argv[1:]))

if __name__ == '__main__':
    main(sys.argv)