GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

setup-virtualenv 959 Bytes
Newer Older
boklm's avatar
boklm committed
1 2 3 4
#!/usr/bin/perl -w
use strict;
use FindBin;
use IO::CaptureOutput qw(qxx);
5
use Cwd;
boklm's avatar
boklm committed
6 7

my $virtenv = "$FindBin::Bin/virtualenv";
8
my $virtenv_marionette = "$FindBin::Bin/virtualenv-marionette";
boklm's avatar
boklm committed
9 10 11 12 13 14
my $pip = "$virtenv/bin/pip";

sub run {
    system(@_) == 0 || die "Error running " . join(' ', @_);
}

15 16 17 18 19 20 21 22
sub run_from_dir {
    my $old_cwd = getcwd;
    chdir shift @_;
    my $res = run(@_);
    chdir $old_cwd;
    return $res;
}

boklm's avatar
boklm committed
23 24
sub pip_install {
    my ($pkg) = @_;
25
    my ($output) = qxx($pip, 'show', '--disable-pip-version-check', $pkg);
boklm's avatar
boklm committed
26 27 28 29 30 31 32 33
    run($pip, 'install', $pkg) unless $output;
}

run('virtualenv', $virtenv) unless -d $virtenv;
for my $pkg (qw(selenium mozmill)) {
    pip_install($pkg);
}

34 35 36 37
run('virtualenv', $virtenv_marionette) unless -d $virtenv_marionette;
run_from_dir('marionette/firefox-ui-tests',
    "$virtenv_marionette/bin/python", 'setup.py', 'develop');
run_from_dir('marionette', "$virtenv_marionette/bin/python", 'setup.py', 'develop');