[Python-checkins] distutils2: cleanup
tarek.ziade
python-checkins at python.org
Sun Jan 30 14:49:23 CET 2011
tarek.ziade pushed 5e6e1c546a70 to distutils2:
http://hg.python.org/distutils2/rev/5e6e1c546a70
changeset: 966:5e6e1c546a70
user: Tarek Ziade <tarek at ziade.org>
date: Sun Jan 30 12:01:46 2011 +0100
summary:
cleanup
files:
distutils2/run.py
diff --git a/distutils2/run.py b/distutils2/run.py
--- a/distutils2/run.py
+++ b/distutils2/run.py
@@ -83,10 +83,10 @@
dist = distclass(attrs)
except DistutilsSetupError, msg:
if 'name' in attrs:
- raise SystemExit, "error in %s setup command: %s" % \
- (attrs['name'], msg)
+ raise SystemExit("error in %s setup command: %s" % \
+ (attrs['name'], msg))
else:
- raise SystemExit, "error in setup command: %s" % msg
+ raise SystemExit("error in setup command: %s" % msg)
# Find and parse the config file(s): they will override options from
# the setup script, but be overridden by the command line.
@@ -98,22 +98,21 @@
try:
res = dist.parse_command_line()
except DistutilsArgError, msg:
- raise SystemExit, gen_usage(dist.script_name) + "\nerror: %s" % msg
+ raise SystemExit(gen_usage(dist.script_name) + "\nerror: %s" % msg)
# And finally, run all the commands found on the command line.
if res:
try:
dist.run_commands()
except KeyboardInterrupt:
- raise SystemExit, "interrupted"
+ raise SystemExit("interrupted")
except (IOError, os.error), exc:
error = grok_environment_error(exc)
- raise SystemExit, error
+ raise SystemExit(error)
except (DistutilsError,
CCompilerError), msg:
- raise
- raise SystemExit, "error: " + str(msg)
+ raise SystemExit("error: " + str(msg))
return dist
@@ -127,7 +126,10 @@
def main():
- """Main entry point for Distutils2"""
+ """Main entry point for Distutils2
+
+ Execute an action or delegate to the commands system.
+ """
_set_logger()
parser = OptionParser()
parser.disable_interspersed_args()
@@ -164,7 +166,7 @@
options, args = parser.parse_args()
if options.version:
print('Distutils2 %s' % __version__)
-# sys.exit(0)
+ return 0
if len(options.metadata):
from distutils2.dist import Distribution
@@ -178,18 +180,18 @@
keys = options.metadata
if len(keys) == 1:
print metadata[keys[0]]
- sys.exit(0)
+ return
for key in keys:
if key in metadata:
- print(metadata._convert_name(key)+':')
+ print(metadata._convert_name(key) + ':')
value = metadata[key]
if isinstance(value, list):
for v in value:
- print(' '+v)
+ print(' ' + v)
else:
- print(' '+value.replace('\n', '\n '))
- sys.exit(0)
+ print(' ' + value.replace('\n', '\n '))
+ return 0
if options.search is not None:
search = options.search.lower()
@@ -199,7 +201,7 @@
print('%s %s at %s' % (dist.name, dist.metadata['version'],
dist.path))
- sys.exit(0)
+ return 0
if options.graph is not None:
name = options.graph
@@ -211,25 +213,25 @@
graph = generate_graph(dists)
print(graph.repr_node(dist))
- sys.exit(0)
+ return 0
if options.fgraph:
dists = get_distributions(use_egg_info=True)
graph = generate_graph(dists)
print(graph)
- sys.exit(0)
+ return 0
if options.install is not None:
install(options.install)
- sys.exit(0)
+ return 0
if len(args) == 0:
parser.print_help()
- sys.exit(0)
+ return 0
- return commands_main()
-# sys.exit(0)
+ commands_main()
+ return 0
if __name__ == '__main__':
- main()
+ sys.exit(main())
--
Repository URL: http://hg.python.org/distutils2
More information about the Python-checkins
mailing list