X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=htsworkflow.git;a=blobdiff_plain;f=scripts%2Fhtsw-get-config;h=1417baf3ac950ca7f8e63e0b77a4c4f3f066e341;hp=e4fdff1fad42122e6a20b0f678f9660aed9c5809;hb=bc27b813d0cdd3513323434405ee2ec5126490e5;hpb=0123277f86af843d47170d56d217f45e7d7cb4a6 diff --git a/scripts/htsw-get-config b/scripts/htsw-get-config index e4fdff1..1417baf 100755 --- a/scripts/htsw-get-config +++ b/scripts/htsw-get-config @@ -1,4 +1,8 @@ #!/usr/bin/env python +import os +if not 'DJANGO_SETTINGS_MODULE' in os.environ: + os.environ['DJANGO_SETTINGS_MODULE'] = 'htsworkflow.settings' + import logging import sys from htsworkflow.pipelines.retrieve_config import * @@ -7,37 +11,43 @@ from htsworkflow.pipelines import retrieve_config #Turn on built-in command-line parsing. retrieve_config.DISABLE_CMDLINE = False + def main(argv=None): - if argv is None: - argv = sys.argv - - #Display help if no args are presented - options = getCombinedOptions(argv) - - if options.verbose: - logging.basicConfig(level=logging.DEBUG) - else: - logging.basicConfig(level=logging.INFO) - - msg_list = ['ERROR MESSAGES:'] - if options.flowcell is None: - msg_list.append(" Flow cell argument required. -f or --flowcell=") - - if options.url is None: - msg_list.append(" URL argument required (-u or --url=), or entry\n" \ - " in /etc/ga_frontend/ga_frontend.conf or ~/.ga_frontend.conf") - if options.genome_dir is None: - msg_list.append(" genome_dir argument required (-g or \n" \ - " --genome_dir=, or entry in \n" \ - " /etc/ga_frontend/ga_frontend.conf or ~/.ga_frontend.conf") - - if len(msg_list) > 1: - print '\n'.join(msg_list) - return 1 - - saveConfigFile(options) - - return 0 - + if argv is None: + argv = sys.argv + + #Display help if no args are presented + options = getCombinedOptions(argv) + + if options.verbose: + logging.basicConfig(level=logging.DEBUG) + else: + logging.basicConfig(level=logging.INFO) + + msg_list = ['ERROR MESSAGES:'] + if options.flowcell is None: + msg_list.append( + " Flow cell argument required. -f or "\ + "--flowcell=") + + if options.url is None: + msg_list.append( + " URL argument required (-u or --url=), or entry\n" \ + " in /etc/ga_frontend/ga_frontend.conf or ~/.ga_frontend.conf") + + if options.genome_dir is None: + msg_list.append( + " genome_dir argument required (-g or \n" \ + " --genome_dir=, or entry in \n" \ + " /etc/ga_frontend/ga_frontend.conf or ~/.ga_frontend.conf") + + if len(msg_list) > 1: + print '\n'.join(msg_list) + return 1 + + saveConfigFile(options) + + return 0 + if __name__ == "__main__": - sys.exit(main(sys.argv[1:])) + sys.exit(main(sys.argv[1:]))