Commit e64901cd authored by Jason R. Coombs's avatar Jason R. Coombs

Normalize style per PEP-8

parent 11ae970c
......@@ -4,7 +4,9 @@ Provides the Distribution class, which represents the module distribution
being built/installed/distributed.
"""
import sys, os, re
import sys
import os
import re
from email import message_from_file
try:
......@@ -22,7 +24,7 @@ from distutils.debug import DEBUG
# the same as a Python NAME -- I don't allow leading underscores. The fact
# that they're very similar is no coincidence; the default naming scheme is
# to look for a Python module named after the command.
command_re = re.compile (r'^[a-zA-Z]([a-zA-Z0-9_]*)$')
command_re = re.compile(r'^[a-zA-Z]([a-zA-Z0-9_]*)$')
class Distribution:
......@@ -39,7 +41,6 @@ class Distribution:
See the code for 'setup()', in core.py, for details.
"""
# 'global_options' describes the command-line options that may be
# supplied to the setup script prior to any actual commands.
# Eg. "./setup.py -n" or "./setup.py --quiet" both take advantage of
......@@ -48,7 +49,8 @@ class Distribution:
# don't want to pollute the commands with too many options that they
# have minimal control over.
# The fourth entry for verbose means that it can be repeated.
global_options = [('verbose', 'v', "run verbosely (default)", 1),
global_options = [
('verbose', 'v', "run verbosely (default)", 1),
('quiet', 'q', "run quietly (turns verbosity off)"),
('dry-run', 'n', "don't actually do anything"),
('help', 'h', "show detailed help message"),
......@@ -115,10 +117,9 @@ Common commands: (see '--help-commands' for more)
# negative options are options that exclude other options
negative_opt = {'quiet': 'verbose'}
# -- Creation/initialization methods -------------------------------
def __init__ (self, attrs=None):
def __init__(self, attrs=None):
"""Construct a new Distribution instance: initialize all the
attributes of a Distribution, and then use 'attrs' (a dictionary
mapping attribute names to values) to assign some of those
......@@ -538,9 +539,9 @@ Common commands: (see '--help-commands' for more)
# known options.
if not (hasattr(cmd_class, 'user_options') and
isinstance(cmd_class.user_options, list)):
raise DistutilsClassError(("command class %s must provide " +
"'user_options' attribute (a list of tuples)") % \
cmd_class)
msg = ("command class %s must provide "
"'user_options' attribute (a list of tuples)")
raise DistutilsClassError(msg % cmd_class)
# If the command class has a list of negative alias options,
# merge it in with the global negative aliases.
......@@ -557,7 +558,6 @@ Common commands: (see '--help-commands' for more)
else:
help_options = []
# All commands support the global options too, just by adding
# in 'global_options'.
parser.set_option_table(self.global_options +
......@@ -814,7 +814,7 @@ Common commands: (see '--help-commands' for more)
klass_name = command
try:
__import__ (module_name)
__import__(module_name)
module = sys.modules[module_name]
except ImportError:
continue
......@@ -840,7 +840,7 @@ Common commands: (see '--help-commands' for more)
cmd_obj = self.command_obj.get(command)
if not cmd_obj and create:
if DEBUG:
self.announce("Distribution.get_command_obj(): " \
self.announce("Distribution.get_command_obj(): "
"creating '%s' command object" % command)
klass = self.get_command_class(command)
......@@ -974,7 +974,6 @@ Common commands: (see '--help-commands' for more)
cmd_obj.run()
self.have_run[command] = 1
# -- Distribution query methods ------------------------------------
def has_pure_modules(self):
......@@ -1116,13 +1115,13 @@ class DistributionMetadata:
version = '1.1'
file.write('Metadata-Version: %s\n' % version)
file.write('Name: %s\n' % self.get_name() )
file.write('Version: %s\n' % self.get_version() )
file.write('Summary: %s\n' % self.get_description() )
file.write('Home-page: %s\n' % self.get_url() )
file.write('Author: %s\n' % self.get_contact() )
file.write('Author-email: %s\n' % self.get_contact_email() )
file.write('License: %s\n' % self.get_license() )
file.write('Name: %s\n' % self.get_name())
file.write('Version: %s\n' % self.get_version())
file.write('Summary: %s\n' % self.get_description())
file.write('Home-page: %s\n' % self.get_url())
file.write('Author: %s\n' % self.get_contact())
file.write('Author-email: %s\n' % self.get_contact_email())
file.write('License: %s\n' % self.get_license())
if self.download_url:
file.write('Download-URL: %s\n' % self.download_url)
......@@ -1131,7 +1130,7 @@ class DistributionMetadata:
keywords = ','.join(self.get_keywords())
if keywords:
file.write('Keywords: %s\n' % keywords )
file.write('Keywords: %s\n' % keywords)
self._write_list(file, 'Platform', self.get_platforms())
self._write_list(file, 'Classifier', self.get_classifiers())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment