CC-2016: Rearrange python scripts for reusability

-Added api_client to PYTHONPATH env variable
This commit is contained in:
martin 2011-03-24 00:35:01 -04:00
parent 5c8719d90c
commit 079878e5f0
4 changed files with 9 additions and 4 deletions

View File

@ -53,7 +53,7 @@ echo "* Python eggs Setup".PHP_EOL;
AirtimeInstall::SetUpPythonEggs(); AirtimeInstall::SetUpPythonEggs();
echo PHP_EOL."*** Pypo Installation ***".PHP_EOL; echo PHP_EOL."*** Pypo Installation ***".PHP_EOL;
system("python ".__DIR__."/../pypo/install/pypo-install.py"); system("python ".__DIR__."/../python_apps/pypo/install/pypo-install.py");
echo PHP_EOL."*** Recorder Installation ***".PHP_EOL; echo PHP_EOL."*** Recorder Installation ***".PHP_EOL;
system("python ".__DIR__."/../python_apps/show-recorder/install/recorder-install.py"); system("python ".__DIR__."/../python_apps/show-recorder/install/recorder-install.py");

View File

@ -79,7 +79,7 @@ class AirtimeInstall {
{ {
$api_key = AirtimeInstall::GenerateRandomString(); $api_key = AirtimeInstall::GenerateRandomString();
AirtimeInstall::UpdateIniValue(__DIR__.'/../build/airtime.conf', 'api_key', $api_key); AirtimeInstall::UpdateIniValue(__DIR__.'/../build/airtime.conf', 'api_key', $api_key);
AirtimeInstall::UpdateIniValue(__DIR__.'/../pypo/config.cfg', 'api_key', "'$api_key'"); AirtimeInstall::UpdateIniValue(__DIR__.'/../python_apps/pypo/config.cfg', 'api_key', "'$api_key'");
} }
public static function ExitIfNotRoot() public static function ExitIfNotRoot()

View File

@ -3,12 +3,16 @@ pypo_user="pypo"
export HOME="/home/pypo/" export HOME="/home/pypo/"
# Location of pypo_cli.py Python script # Location of pypo_cli.py Python script
pypo_path="/opt/pypo/bin/" pypo_path="/opt/pypo/bin/"
api_client_path="/opt/pypo/"
pypo_script="pypo-cli.py" pypo_script="pypo-cli.py"
echo "*** Daemontools: starting daemon" echo "*** Daemontools: starting daemon"
cd ${pypo_path} cd ${pypo_path}
exec 2>&1 exec 2>&1
PYTHONPATH=${api_client_path}:$PYTHONPATH
export PYTHONPATH
# Note the -u when calling python! we need it to get unbuffered binary stdout and stderr # Note the -u when calling python! we need it to get unbuffered binary stdout and stderr
exec setuidgid ${pypo_user} \ exec setuidgid ${pypo_user} \
python -u ${pypo_path}${pypo_script} \ python -u ${pypo_path}${pypo_script}
-f
# EOF # EOF

View File

@ -94,6 +94,7 @@ try:
sys.exit(1) sys.exit(1)
copy_dir("%s/.."%current_script_dir, BASE_PATH+"bin/") copy_dir("%s/.."%current_script_dir, BASE_PATH+"bin/")
copy_dir("%s/../../api_clients"%current_script_dir, BASE_PATH+"api_clients/")
print "Setting permissions" print "Setting permissions"
os.system("chmod -R 755 "+BASE_PATH) os.system("chmod -R 755 "+BASE_PATH)