[Python-checkins] distutils2: Style nitpicks
tarek.ziade
python-checkins at python.org
Sun Aug 8 11:50:48 CEST 2010
tarek.ziade pushed e51ba85f26cd to distutils2:
http://hg.python.org/distutils2/rev/e51ba85f26cd
changeset: 521:e51ba85f26cd
tag: tip
user: ?ric Araujo <merwok at netwok.org>
date: Sun Aug 08 02:48:27 2010 +0200
summary: Style nitpicks
files: src/distutils2/command/build_py.py, src/distutils2/command/sdist.py, src/distutils2/dist.py
diff --git a/src/distutils2/command/build_py.py b/src/distutils2/command/build_py.py
--- a/src/distutils2/command/build_py.py
+++ b/src/distutils2/command/build_py.py
@@ -375,8 +375,7 @@
sources += [
os.path.join(src_dir, filename)
for package, src_dir, build_dir, filenames in self.data_files
- for filename in filenames
- ]
+ for filename in filenames]
return sources
def get_module_outfile(self, build_dir, package, module):
@@ -399,8 +398,7 @@
outputs += [
os.path.join(build_dir, filename)
for package, src_dir, build_dir, filenames in self.data_files
- for filename in filenames
- ]
+ for filename in filenames]
return outputs
diff --git a/src/distutils2/command/sdist.py b/src/distutils2/command/sdist.py
--- a/src/distutils2/command/sdist.py
+++ b/src/distutils2/command/sdist.py
@@ -238,7 +238,6 @@
for cmd_name in self.distribution.get_command_names():
cmd_obj = self.get_finalized_command(cmd_name)
self.filelist.extend(cmd_obj.get_source_files())
-
def prune_file_list(self):
"""Prune off branches that might slip into the file list as created
diff --git a/src/distutils2/dist.py b/src/distutils2/dist.py
--- a/src/distutils2/dist.py
+++ b/src/distutils2/dist.py
@@ -699,27 +699,20 @@
def _get_command_groups(self):
"""Helper function to retrieve all the command class names divided
- into "standard commands" (listed in distutils2.command.__all__)
- and "extra commands" (mentioned in self.cmdclass, but not a standard
- command).
+ into standard commands (listed in distutils2.command.__all__)
+ and extra commands (given in self.cmdclass and not standard
+ commands).
"""
- import distutils2.command
- std_commands = distutils2.command.__all__
- is_std = {}
- for cmd in std_commands:
- is_std[cmd] = 1
-
- extra_commands = []
- for cmd in self.cmdclass:
- if not is_std.get(cmd):
- extra_commands.append(cmd)
+ from distutils2.command import __all__ as std_commands
+ extra_commands = [cmd for cmd in self.cmdclass
+ if cmd not in std_commands]
return std_commands, extra_commands
def print_commands(self):
"""Print out a help message listing all available commands with a
- description of each. The list is divided into "standard commands"
- (listed in distutils2.command.__all__) and "extra commands"
- (mentioned in self.cmdclass, but not a standard command). The
+ description of each. The list is divided into standard commands
+ (listed in distutils2.command.__all__) and extra commands
+ (given in self.cmdclass and not standard commands). The
descriptions come from the command class attribute
'description'.
"""
@@ -740,9 +733,10 @@
def get_command_list(self):
"""Get a list of (command, description) tuples.
- The list is divided into "standard commands" (listed in
- distutils2.command.__all__) and "extra commands" (mentioned in
- self.cmdclass, but not a standard command). The descriptions come
+
+ The list is divided into standard commands (listed in
+ distutils2.command.__all__) and extra commands (given in
+ self.cmdclass and not standard commands). The descriptions come
from the command class attribute 'description'.
"""
# Currently this is only used on Mac OS, for the Mac-only GUI
@@ -772,7 +766,7 @@
return pkgs
def get_command_names(self):
- """Return a list of command names."""
+ """Return a list of all command names."""
return [getattr(cls, 'command_name', cls.__name__)
for cls in self.get_command_classes()]
--
Repository URL: http://hg.python.org/distutils2
More information about the Python-checkins
mailing list