Use env variables everywhere

pull/20/head
Raphaël Vinot 2014-08-22 14:52:02 +02:00
parent 277d138a5d
commit 78125db4ea
5 changed files with 28 additions and 34 deletions

View File

@ -9,10 +9,13 @@ WHITE="\\033[0;02m"
YELLOW="\\033[1;33m" YELLOW="\\033[1;33m"
CYAN="\\033[1;36m" CYAN="\\033[1;36m"
#Modify these PATH [ -z "$AIL_HOME" ] && echo "Needs the env var AIL_HOME. Run the script from the virtual environment." && exit 1;
export PATH=$(pwd):$PATH [ -z "$AIL_REDIS" ] && echo "Needs the env var AIL_REDIS. Run the script from the virtual environment." && exit 1;
export PATH=/opt/redis-2.8.12/src/:$PATH [ -z "$AIL_LEVELDB" ] && echo "Needs the env var AIL_LEVELDB. Run the script from the virtual environment." && exit 1;
export PATH=/opt/redis-leveldb/:$PATH
export PATH=$AIL_HOME:$PATH
export PATH=$AIL_REDIS:$PATH
export PATH=$AIL_LEVELDB:$PATH
function helptext { function helptext {
echo -e $YELLOW" echo -e $YELLOW"
@ -45,7 +48,7 @@ function helptext {
} }
function launching_redis { function launching_redis {
conf_dir='/home/user/AIL-framework/configs/' conf_dir="${AIL_HOME}/configs/"
screen -dmS "Redis" screen -dmS "Redis"
sleep 0.1 sleep 0.1
@ -60,7 +63,7 @@ function launching_redis {
function launching_lvldb { function launching_lvldb {
#Want to launch more level_db? #Want to launch more level_db?
lvdbhost='127.0.0.1' lvdbhost='127.0.0.1'
lvdbdir='/home/user/AIL-framework/LEVEL_DB_DATA/' lvdbdir="${AIL_HOME}/LEVEL_DB_DATA/"
db1_y='2013' db1_y='2013'
db2_y='2014' db2_y='2014'
nb_db=13 nb_db=13

View File

@ -22,8 +22,9 @@ Requirements
""" """
import redis import redis
import ConfigParser import ConfigParser
import os
configfile = './packages/config.cfg' configfile = os.path.join(os.environ('AIL_BIN'), './packages/config.cfg')
def main(): def main():

View File

@ -19,7 +19,6 @@ Conditions to fulfill to be able to use this class correctly:
import os import os
import magic import magic
import gzip import gzip
import pprint
import redis import redis
import operator import operator
import string import string
@ -376,8 +375,3 @@ class Paste(object):
if match != '' and len(match) < 100: if match != '' and len(match) < 100:
matchs.append(match) matchs.append(match)
return matchs return matchs
if __name__ == "__main__":
pp = pprint.PrettyPrinter(indent=4)
main()

View File

@ -5,15 +5,8 @@ set -x
sudo apt-get update sudo apt-get update
sudo apt-get install python-pip python-virtualenv python-dev libfreetype6-dev screen sudo apt-get install python-pip python-virtualenv python-dev libfreetype6-dev \
screen g++ python-tk
virtualenv AILENV
echo export AIL_HOME=$(pwd) >> ./AILENV/bin/activate
echo export AIL_BIN=$(pwd)/bin/ >> ./AILENV/bin/activate
echo export AIL_FLASK=$(pwd)/var/www/ >> ./AILENV/bin/activate
sudo apt-get install g++ python-tk
#Needed for bloom filters #Needed for bloom filters
sudo apt-get install libssl-dev libfreetype6-dev python-numpy sudo apt-get install libssl-dev libfreetype6-dev python-numpy
@ -24,23 +17,13 @@ sudo apt-get install libadns1 libadns1-dev
#needed for mathplotlib #needed for mathplotlib
test ! -L /usr/include/ft2build.h && sudo ln -s freetype2/ft2build.h /usr/include/ test ! -L /usr/include/ft2build.h && sudo ln -s freetype2/ft2build.h /usr/include/
. ./AILENV/bin/activate
pip install -r pip_packages_requirement.txt --upgrade
pip install -U textblob
python -m textblob.download_corpora
# REDIS # # REDIS #
test ! -d redis/ && git clone https://github.com/antirez/redis.git test ! -d redis/ && git clone https://github.com/antirez/redis.git
pushd redis/ pushd redis/
git checkout 2.8 git checkout 2.8
git pull
make make
popd popd
echo export AIL_REDIS=$(pwd)/src/ >> ./AILENV/bin/activate
# REDIS LEVEL DB # # REDIS LEVEL DB #
test ! -d redis-leveldb/ && git clone https://github.com/KDr2/redis-leveldb.git test ! -d redis-leveldb/ && git clone https://github.com/KDr2/redis-leveldb.git
pushd redis-leveldb/ pushd redis-leveldb/
@ -48,7 +31,20 @@ git submodule init
git submodule update git submodule update
popd popd
mkdir -p $AIL_HOME/{PASTES,Blooms,dumps} virtualenv AILENV
echo export AIL_HOME=$(pwd) >> ./AILENV/bin/activate
echo export AIL_BIN=$(pwd)/bin/ >> ./AILENV/bin/activate
echo export AIL_FLASK=$(pwd)/var/www/ >> ./AILENV/bin/activate
echo export AIL_REDIS=$(pwd)/redis/src/ >> ./AILENV/bin/activate
echo export AIL_LEVELDB=$(pwd)/redis-leveldb/ >> ./AILENV/bin/activate
. ./AILENV/bin/activate
mkdir -p $AIL_HOME/{PASTES,Blooms,dumps}
mkdir -p $AIL_HOME/LEVEL_DB_DATA/{2014,2013} mkdir -p $AIL_HOME/LEVEL_DB_DATA/{2014,2013}
pip install -r pip_packages_requirement.txt
# Download the necessary NLTK corpora
HOME=$(pwd) python -m textblob.download_corpora

View File

@ -4,7 +4,7 @@ pyzmq
dnspython dnspython
logbook logbook
pubsublogger pubsublogger
textblob
#Graph #Graph
numpy numpy