author Joel Maher <>
Sat, 22 Aug 2015 06:09:50 -0400
changeset 1001 762f27d9a07bae369c036d6ad601e2db62fe3211
parent 790 788139c327eed4145b8a12a2bc6c2237341b591c
permissions -rwxr-xr-x
Bug 1193707 - temporary record network statistics from the operating system as counters and only submit to treeherder for linux64 tresize. r=parkouss

#!/usr/bin/env python

installation script for talos. This script:
- creates a virtualenv in the current directory
- sets up talos in development mode: `python develop`
- downloads pageloader and packages to talos/page_load_test/pageloader.xpi

import os
import subprocess
import sys
import urllib2
    from subprocess import check_call as call
    from subprocess import call

# globals
here = os.path.dirname(os.path.abspath(__file__))

def which(binary, path=os.environ['PATH']):
    dirs = path.split(os.pathsep)
    for dir in dirs:
        if os.path.isfile(os.path.join(dir, path)):
            return os.path.join(dir, path)
        if os.path.isfile(os.path.join(dir, path + ".exe")):
            return os.path.join(dir, path + ".exe")

def main(args=sys.argv[1:]):

    # sanity check
    # ensure exists
    setup_py = os.path.join(here, '')
    assert os.path.exists(setup_py), " not found"

    # create a virtualenv
    virtualenv = which('virtualenv') or which('')
    if virtualenv:
        call([virtualenv, '--system-site-packages', here])
        process = subprocess.Popen([sys.executable, '-', '--system-site-packages', here], stdin=subprocess.PIPE)
        stdout, stderr = process.communicate(input=urllib2.urlopen(VIRTUALENV).read())

    # find the virtualenv's python
    for i in ('bin', 'Scripts'):
        bindir = os.path.join(here, i)
        if os.path.exists(bindir):
        raise AssertionError('virtualenv binary directory not found')
    for i in ('python', 'python.exe'):
        virtualenv_python = os.path.join(bindir, i)
        if os.path.exists(virtualenv_python):
        raise AssertionError('virtualenv python not found')

    # install talos into the virtualenv
    call([os.path.abspath(virtualenv_python), '', 'develop'], cwd=here)

if __name__ == '__main__':