zephyr_mirror: Move parse_args into its own function.

(imported from commit b56ca627e3d34b8dcefead2cfecfa77bb428b0ec)
This commit is contained in:
Tim Abbott 2012-11-19 12:30:15 -05:00
parent 99f90762d3
commit 70e7c9fd14

View file

@ -630,15 +630,7 @@ def configure_logger(direction_name):
logger.addHandler(file_handler) logger.addHandler(file_handler)
return logger return logger
if __name__ == "__main__": def parse_args():
# Set the SIGCHLD handler back to SIG_DFL to prevent these errors
# when importing the "requests" module after being restarted using
# the restart_stamp functionality:
#
# close failed in file object destructor:
# IOError: [Errno 10] No child processes
signal.signal(signal.SIGCHLD, signal.SIG_DFL)
parser = optparse.OptionParser() parser = optparse.OptionParser()
parser.add_option('--forward-class-messages', parser.add_option('--forward-class-messages',
dest='forward_class_messages', dest='forward_class_messages',
@ -698,7 +690,18 @@ if __name__ == "__main__":
dest='api_key_file', dest='api_key_file',
default=os.path.join(os.environ["HOME"], "Private", ".humbug-api-key"), default=os.path.join(os.environ["HOME"], "Private", ".humbug-api-key"),
action='store') action='store')
(options, args) = parser.parse_args() return parser.parse_args()
if __name__ == "__main__":
# Set the SIGCHLD handler back to SIG_DFL to prevent these errors
# when importing the "requests" module after being restarted using
# the restart_stamp functionality:
#
# close failed in file object destructor:
# IOError: [Errno 10] No child processes
signal.signal(signal.SIGCHLD, signal.SIG_DFL)
(options, args) = parse_args()
sys.path[:0] = [options.root_path, os.path.join(options.root_path, "python-zephyr"), sys.path[:0] = [options.root_path, os.path.join(options.root_path, "python-zephyr"),
os.path.join(options.root_path, "python-zephyr/build/lib.linux-x86_64-2.6/")] os.path.join(options.root_path, "python-zephyr/build/lib.linux-x86_64-2.6/")]