4 installation script for talos. This script:
5 - creates a virtualenv in the current directory
6 - sets up talos in development mode: `python setup.py develop`
7 - downloads pageloader and packages to talos/page_load_test/pageloader.xpi
9 from __future__
import absolute_import
17 from subprocess
import check_call
as call
19 from subprocess
import call
22 here
= os
.path
.dirname(os
.path
.abspath(__file__
))
23 VIRTUALENV
= 'https://raw.github.com/pypa/virtualenv/1.10/virtualenv.py'
26 def which(binary
, path
=os
.environ
['PATH']):
27 dirs
= path
.split(os
.pathsep
)
29 if os
.path
.isfile(os
.path
.join(dir, path
)):
30 return os
.path
.join(dir, path
)
31 if os
.path
.isfile(os
.path
.join(dir, path
+ ".exe")):
32 return os
.path
.join(dir, path
+ ".exe")
35 def main(args
=sys
.argv
[1:]):
38 # ensure setup.py exists
39 setup_py
= os
.path
.join(here
, 'setup.py')
40 assert os
.path
.exists(setup_py
), "setup.py not found"
43 virtualenv
= which('virtualenv') or which('virtualenv.py')
45 call([virtualenv
, '--system-site-packages', here
])
47 process
= subprocess
.Popen([sys
.executable
,
49 '--system-site-packages',
51 stdin
=subprocess
.PIPE
)
52 stdout
, stderr
= process
.communicate(input=urllib2
.urlopen(VIRTUALENV
).read())
54 # find the virtualenv's python
55 for i
in ('bin', 'Scripts'):
56 bindir
= os
.path
.join(here
, i
)
57 if os
.path
.exists(bindir
):
60 raise AssertionError('virtualenv binary directory not found')
61 for i
in ('python', 'python.exe'):
62 virtualenv_python
= os
.path
.join(bindir
, i
)
63 if os
.path
.exists(virtualenv_python
):
66 raise AssertionError('virtualenv python not found')
68 # install talos into the virtualenv
69 call([os
.path
.abspath(virtualenv_python
), 'setup.py', 'develop'], cwd
=here
)
72 if __name__
== '__main__':