From 079878e5f09e2fbed7a351631a5a3e0b7fe935a2 Mon Sep 17 00:00:00 2001 From: martin Date: Thu, 24 Mar 2011 00:35:01 -0400 Subject: [PATCH] CC-2016: Rearrange python scripts for reusability -Added api_client to PYTHONPATH env variable --- install/airtime-install.php | 2 +- install/installInit.php | 2 +- python_apps/pypo/install/pypo-daemontools.sh | 8 ++++++-- python_apps/pypo/install/pypo-install.py | 1 + 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/install/airtime-install.php b/install/airtime-install.php index ffcdea662..fdd867ee5 100644 --- a/install/airtime-install.php +++ b/install/airtime-install.php @@ -53,7 +53,7 @@ echo "* Python eggs Setup".PHP_EOL; AirtimeInstall::SetUpPythonEggs(); 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; system("python ".__DIR__."/../python_apps/show-recorder/install/recorder-install.py"); diff --git a/install/installInit.php b/install/installInit.php index 65fb574fb..fdb4d4d0f 100644 --- a/install/installInit.php +++ b/install/installInit.php @@ -79,7 +79,7 @@ class AirtimeInstall { { $api_key = AirtimeInstall::GenerateRandomString(); 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() diff --git a/python_apps/pypo/install/pypo-daemontools.sh b/python_apps/pypo/install/pypo-daemontools.sh index 6e7bed55d..1f276cc4e 100644 --- a/python_apps/pypo/install/pypo-daemontools.sh +++ b/python_apps/pypo/install/pypo-daemontools.sh @@ -3,12 +3,16 @@ pypo_user="pypo" export HOME="/home/pypo/" # Location of pypo_cli.py Python script pypo_path="/opt/pypo/bin/" +api_client_path="/opt/pypo/" pypo_script="pypo-cli.py" echo "*** Daemontools: starting daemon" cd ${pypo_path} 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 exec setuidgid ${pypo_user} \ - python -u ${pypo_path}${pypo_script} \ - -f + python -u ${pypo_path}${pypo_script} # EOF diff --git a/python_apps/pypo/install/pypo-install.py b/python_apps/pypo/install/pypo-install.py index b764dcec9..1171dfe23 100644 --- a/python_apps/pypo/install/pypo-install.py +++ b/python_apps/pypo/install/pypo-install.py @@ -94,6 +94,7 @@ try: sys.exit(1) copy_dir("%s/.."%current_script_dir, BASE_PATH+"bin/") + copy_dir("%s/../../api_clients"%current_script_dir, BASE_PATH+"api_clients/") print "Setting permissions" os.system("chmod -R 755 "+BASE_PATH)