# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright (C) 2012 Yahoo! Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import os import os.path import logging import logging.config import sys #requires http://pypi.python.org/pypi/termcolor #but the colors make it worth it :-) from termcolor import colored, cprint #this needs to happen immediately (or thats what it seems) logfn = os.getenv('LOG_FILE') if(logfn == None): logfn = os.path.join("conf", 'logging.ini') logging.config.fileConfig(logfn) #this handles our option parsing from devstack import opts #these are the program runtimes that actually do the running from devstack.progs import actions from devstack.progs import misc def main(): #parse and get it done! args = opts.parse() run_ok = False #figure out what to do if args.get('list_deps') or args.get('describe_comp'): run_ok = misc.run(args) else: run_ok = actions.run(args) #now do it if run_ok: return 0 else: me = colored((os.path.basename(sys.argv[0])), "red", attrs=['bold']) me += " " + colored('--help', 'red') print("Perhaps you should try %s" % (me)) return 1 if __name__ == "__main__": sys.exit(main())