[copr] master: Move the try/except into the main() function (c4265f5)
pingou at fedoraproject.org
pingou at fedoraproject.org
Mon Feb 18 17:53:13 UTC 2013
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit c4265f5aad8dca51c9f80eabefa146186192bfe1
Author: Pierre-Yves Chibon <pingou at pingoured.fr>
Date: Mon Feb 18 18:53:05 2013 +0100
Move the try/except into the main() function
This is necessary if we want the try/except to have some kind of effect when copr-cli
is installed (since setup.py uses entry_point).
>---------------------------------------------------------------
copr_cli/main.py | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/copr_cli/main.py b/copr_cli/main.py
index 15bfb02..0a68128 100644
--- a/copr_cli/main.py
+++ b/copr_cli/main.py
@@ -102,16 +102,12 @@ def setup_parser():
def main(argv=sys.argv[1:]):
""" Main function """
- # Set up parser for global args
- parser = setup_parser()
- # Parse the commandline
- arg = parser.parse_args()
- arg.func(arg)
-
-
-if __name__ == '__main__':
try:
- main()
+ # Set up parser for global args
+ parser = setup_parser()
+ # Parse the commandline
+ arg = parser.parse_args()
+ arg.func(arg)
except KeyboardInterrupt:
print "\nInterrupted by user."
sys.exit(1)
@@ -121,3 +117,7 @@ if __name__ == '__main__':
except Exception, e:
print 'Error: {0}'.format(e)
sys.exit(100)
+
+
+if __name__ == '__main__':
+ main()
More information about the copr-devel
mailing list