2 # This Source Code Form is subject to the terms of the Mozilla Public
3 # License, v. 2.0. If a copy of the MPL was not distributed with this
4 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 installation script for talos. This script:
9 - creates a virtualenv in the current directory
10 - sets up talos in development mode: `python setup.py develop`
11 - downloads pageloader and packages to talos/page_load_test/pageloader.xpi
20 from subprocess
import check_call
as call
22 from subprocess
import call
25 here
= os
.path
.dirname(os
.path
.abspath(__file__
))
26 VIRTUALENV
= "https://raw.github.com/pypa/virtualenv/1.10/virtualenv.py"
29 def which(binary
, path
=os
.environ
["PATH"]):
30 dirs
= path
.split(os
.pathsep
)
32 if os
.path
.isfile(os
.path
.join(dir, path
)):
33 return os
.path
.join(dir, path
)
34 if os
.path
.isfile(os
.path
.join(dir, path
+ ".exe")):
35 return os
.path
.join(dir, path
+ ".exe")
38 def main(args
=sys
.argv
[1:]):
40 # ensure setup.py exists
41 setup_py
= os
.path
.join(here
, "setup.py")
42 assert os
.path
.exists(setup_py
), "setup.py not found"
45 virtualenv
= which("virtualenv") or which("virtualenv.py")
47 call([virtualenv
, "--system-site-packages", here
])
49 process
= subprocess
.Popen(
50 [sys
.executable
, "-", "--system-site-packages", here
], stdin
=subprocess
.PIPE
52 stdout
, stderr
= process
.communicate(
53 input=six
.moves
.urllib
.request
.urlopen(VIRTUALENV
).read()
56 # find the virtualenv's python
57 for i
in ("bin", "Scripts"):
58 bindir
= os
.path
.join(here
, i
)
59 if os
.path
.exists(bindir
):
62 raise AssertionError("virtualenv binary directory not found")
63 for i
in ("python", "python.exe"):
64 virtualenv_python
= os
.path
.join(bindir
, i
)
65 if os
.path
.exists(virtualenv_python
):
68 raise AssertionError("virtualenv python not found")
70 # install talos into the virtualenv
71 call([os
.path
.abspath(virtualenv_python
), "setup.py", "develop"], cwd
=here
)
74 if __name__
== "__main__":