Skip to content

Commit

Permalink
Added installation/venv scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
rafie committed Aug 13, 2019
1 parent 3b48576 commit 042572e
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 2 deletions.
13 changes: 13 additions & 0 deletions RLTest.sh
@@ -0,0 +1,13 @@
#!/bin/bash

HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"

if [[ -d venv ]]; then
. $HERE/venv/bin/activate
else
[[ ! `command -v virtualenv` ]] && pip install virtualenv
python -m virtualenv --system-site-packages venv
. $HERE/venv/bin/activate
pip install -r $HERE/requirements.txt
fi
PYTHONPATH=$HERE/RLTest python -m RLTest "$@"
1 change: 1 addition & 0 deletions RLTest/__init__.py
Expand Up @@ -5,3 +5,4 @@
'Env',
'StandardEnv'
]

4 changes: 3 additions & 1 deletion RLTest/__main__.py
Expand Up @@ -17,10 +17,12 @@
from RLTest.Enterprise import binaryrepo
from RLTest import debuggers

import warnings
warnings.filterwarnings("ignore", category=DeprecationWarning)

RLTest_CONFIG_FILE_PREFIX = '@'
RLTest_CONFIG_FILE_NAME = 'config.txt'


class CustomArgumentParser(argparse.ArgumentParser):
def __init__(self, *args, **kwrags):
super(CustomArgumentParser, self).__init__(*args, **kwrags)
Expand Down
41 changes: 41 additions & 0 deletions RLTest2.sh
@@ -0,0 +1,41 @@
#!/bin/bash

set -e

show_if_error() {
[[ $SHOW == 1 ]] && echo "${@:1}"
if [[ $VERBOSE == 1 ]]; then
{ "${@:1}"; }
else
{ "${@:1}"; } > /tmp/rltest.log 2>&1
[ $? != 0 ] && cat /tmp/rltest.log
rm -f /tmp/rltest.log
fi
}

install_prerequisites() {
[[ -f .installed2 ]] && return
show_if_error apt-get -qq update
show_if_error apt-get -q install -y python2 python-psutil
show_if_error apt-get -q install -y curl ca-certificates
show_if_error curl -s https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py
show_if_error python2 /tmp/get-pip.py
show_if_error pip install virtualenv
touch .installed2
}

is_installed() {
[[ $({ dpkg -l "$*" >/dev/null 2>&1 ; echo $? ;}) == 0 ]] && echo yes
}

HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"

install_prerequisites
if [[ -d venv2 ]]; then
. $HERE/venv2/bin/activate
else
show_if_error python2 -m virtualenv --system-site-packages venv2
. $HERE/venv2/bin/activate
show_if_error pip install -r $HERE/requirements.txt
fi
PYTHONPATH=$HERE/RLTest python2 -m RLTest "$@"
41 changes: 41 additions & 0 deletions RLTest3.sh
@@ -0,0 +1,41 @@
#!/bin/bash

set -e

show_if_error() {
[[ $SHOW == 1 ]] && echo "${@:1}"
if [[ $VERBOSE == 1 ]]; then
{ "${@:1}"; }
else
{ "${@:1}"; } > /tmp/rltest.log 2>&1
[ $? != 0 ] && cat /tmp/rltest.log
rm -f /tmp/rltest.log
fi
}

install_prerequisites() {
[[ -f .installed3 ]] && return
show_if_error apt-get -qq update
show_if_error apt-get -q install -y python3 python3-distutils python3-psutil
show_if_error apt-get -q install -y curl ca-certificates
show_if_error curl -s https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py
show_if_error python3 /tmp/get-pip.py
show_if_error pip install virtualenv
touch .installed3
}

is_installed() {
[[ $({ dpkg -l "$*" >/dev/null 2>&1 ; echo $? ;}) == 0 ]] && echo yes
}

HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"

install_prerequisites
if [[ -d venv3 ]]; then
. $HERE/venv3/bin/activate
else
show_if_error python3 -m virtualenv --system-site-packages venv3
. $HERE/venv3/bin/activate
show_if_error pip install -r $HERE/requirements.txt
fi
PYTHONPATH=$HERE/RLTest python3 -m RLTest "$@"
2 changes: 1 addition & 1 deletion requirements.txt
@@ -1,3 +1,3 @@
redis>=2.10.5
redis >= 2.10.5, <= 2.10.6
redis-py-cluster
psutil

0 comments on commit 042572e

Please sign in to comment.