Merge branch 'devel' of dev.sourcefabric.org:airtime into devel

This commit is contained in:
Naomi Aro 2011-07-25 11:36:12 +02:00
commit 79f8bb8af9
10 changed files with 17 additions and 11 deletions

View file

@ -9,14 +9,12 @@
require_once(dirname(__FILE__).'/../../include/AirtimeIni.php'); require_once(dirname(__FILE__).'/../../include/AirtimeIni.php');
require_once(dirname(__FILE__).'/../../include/AirtimeInstall.php'); require_once(dirname(__FILE__).'/../../include/AirtimeInstall.php');
/** /**
* This function creates the /etc/airtime configuration folder * This function creates the /etc/airtime configuration folder
* and copies the default config files to it. * and copies the default config files to it.
*/ */
function CreateIniFiles() function CreateIniFiles()
{ {
global $AIRTIME_SRC;
global $AIRTIME_PYTHON_APPS; global $AIRTIME_PYTHON_APPS;
if (!file_exists("/etc/airtime/")){ if (!file_exists("/etc/airtime/")){
@ -26,7 +24,7 @@ function CreateIniFiles()
} }
} }
if (!copy($AIRTIME_SRC."/build/airtime.conf.170", CONF_FILE_AIRTIME)){ if (!copy("airtime.conf.170", CONF_FILE_AIRTIME)){
echo "Could not copy airtime.conf to /etc/airtime/. Exiting."; echo "Could not copy airtime.conf to /etc/airtime/. Exiting.";
exit(1); exit(1);
} }

View file

@ -59,7 +59,6 @@ foreach ($configFiles as $conf) {
*/ */
function CreateIniFiles() function CreateIniFiles()
{ {
global $AIRTIME_SRC;
global $AIRTIME_PYTHON_APPS; global $AIRTIME_PYTHON_APPS;
if (!file_exists("/etc/airtime/")){ if (!file_exists("/etc/airtime/")){
@ -69,7 +68,7 @@ function CreateIniFiles()
} }
} }
if (!copy($AIRTIME_SRC."/build/airtime.conf.180", CONF_FILE_AIRTIME)){ if (!copy("airtime.conf.180", CONF_FILE_AIRTIME)){
echo "Could not copy airtime.conf to /etc/airtime/. Exiting."; echo "Could not copy airtime.conf to /etc/airtime/. Exiting.";
exit(1); exit(1);
} }

View file

@ -112,7 +112,6 @@ function LoadConfig($CC_CONFIG) {
*/ */
function CreateIniFiles() function CreateIniFiles()
{ {
global $AIRTIME_SRC;
global $AIRTIME_PYTHON_APPS; global $AIRTIME_PYTHON_APPS;
if (!file_exists("/etc/airtime/")){ if (!file_exists("/etc/airtime/")){
@ -122,7 +121,7 @@ function CreateIniFiles()
} }
} }
if (!copy($AIRTIME_SRC."/build/airtime.conf.181", CONF_FILE_AIRTIME)){ if (!copy("airtime.conf.181", CONF_FILE_AIRTIME)){
echo "Could not copy airtime.conf to /etc/airtime/. Exiting."; echo "Could not copy airtime.conf to /etc/airtime/. Exiting.";
exit(1); exit(1);
} }

View file

@ -112,7 +112,6 @@ function LoadConfig($CC_CONFIG) {
*/ */
function CreateIniFiles() function CreateIniFiles()
{ {
global $AIRTIME_SRC;
global $AIRTIME_PYTHON_APPS; global $AIRTIME_PYTHON_APPS;
if (!file_exists("/etc/airtime/")){ if (!file_exists("/etc/airtime/")){
@ -122,7 +121,7 @@ function CreateIniFiles()
} }
} }
if (!copy($AIRTIME_SRC."/build/airtime.conf.182", CONF_FILE_AIRTIME)){ if (!copy("airtime.conf.182", CONF_FILE_AIRTIME)){
echo "Could not copy airtime.conf to /etc/airtime/. Exiting."; echo "Could not copy airtime.conf to /etc/airtime/. Exiting.";
exit(1); exit(1);
} }

View file

@ -3,6 +3,8 @@
virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/" virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/"
. ${virtualenv_bin}activate . ${virtualenv_bin}activate
invokePwd=$PWD
airtime_import_path="/usr/lib/airtime/utils/airtime-import/" airtime_import_path="/usr/lib/airtime/utils/airtime-import/"
airtime_import_script="airtime-import.py" airtime_import_script="airtime-import.py"
@ -14,6 +16,6 @@ exec 2>&1
export PYTHONPATH=${api_client_path} export PYTHONPATH=${api_client_path}
# 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 python -u ${airtime_import_path}${airtime_import_script} "$@" exec python -u ${airtime_import_path}${airtime_import_script} --dir "$invokePwd" "$@"
# EOF # EOF

View file

@ -33,6 +33,10 @@ api_client = api_client.api_client_factory(config)
# flag should be 'copy' or 'move' # flag should be 'copy' or 'move'
def copy_or_move_files_to(paths, dest, flag): def copy_or_move_files_to(paths, dest, flag):
for path in paths: for path in paths:
if (path[0] == "/" or path[0] == "~"):
path = os.path.realpath(path)
else:
path = currentDir+path
if(os.path.exists(path)): if(os.path.exists(path)):
if(os.path.isdir(path)): if(os.path.isdir(path)):
path = format_dir_string(path) path = format_dir_string(path)
@ -73,7 +77,7 @@ def helper_get_stor_dir():
def checkOtherOption(args): def checkOtherOption(args):
for i in args: for i in args:
if('-' in i): if(i[0] == '-'):
return True return True
def errorIfMultipleOption(args, msg=''): def errorIfMultipleOption(args, msg=''):
@ -243,6 +247,11 @@ parser.add_option('--storage-dir-set', action='callback', callback=StorageSetAct
parser.add_option('--storage-dir-get', action='callback', callback=StorageGetAction, help='Show the current storage dir.') parser.add_option('--storage-dir-get', action='callback', callback=StorageGetAction, help='Show the current storage dir.')
parser.add_option('-h', '--help', dest='help', action='store_true', help='show this help message and exit') parser.add_option('-h', '--help', dest='help', action='store_true', help='show this help message and exit')
# pop "--dir"
sys.argv.pop(1)
# pop "invoked pwd"
currentDir = sys.argv.pop(1)+'/'
if('-l' in sys.argv or '--link' in sys.argv): if('-l' in sys.argv or '--link' in sys.argv):
print "\nThe [-l][--link] option is deprecated. Please use the --watch-add option.\nTry 'airtime-import -h' for more detail.\n" print "\nThe [-l][--link] option is deprecated. Please use the --watch-add option.\nTry 'airtime-import -h' for more detail.\n"
sys.exit() sys.exit()