Fix code to handle the latest flake8

This commit is contained in:
Donald Stufft 2014-03-26 18:24:19 -04:00
parent 91dc583661
commit 5a76a47d3b
36 changed files with 166 additions and 166 deletions

View File

@ -1 +1 @@
#docs module
# docs module

View File

@ -20,13 +20,13 @@ on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath(os.pardir))
#sys.path.append(os.path.join(os.path.dirname(__file__), '../'))
# sys.path.append(os.path.join(os.path.dirname(__file__), '../'))
# -- General configuration ----------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
#extensions = ['sphinx.ext.autodoc']
# extensions = ['sphinx.ext.autodoc']
extensions = ['sphinx.ext.extlinks', 'docs.pipext']
# Add any paths that contain templates here, relative to this directory.
@ -36,7 +36,7 @@ templates_path = []
source_suffix = '.rst'
# The encoding of source files.
#source_encoding = 'utf-8'
# source_encoding = 'utf-8'
# The master toctree document.
master_doc = 'index'
@ -61,40 +61,40 @@ except ImportError:
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
# language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# today = ''
# Else, today_fmt is used as the format for a strftime call.
today_fmt = '%B %d, %Y'
# List of documents that shouldn't be included in the build.
#unused_docs = []
# unused_docs = []
# List of directories, relative to source directory, that shouldn't be searched
# for source files.
exclude_trees = ['build']
# The reST default role (used for this markup: `text`) to use for all documents
#default_role = None
# default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# modindex_common_prefix = []
extlinks = {
'issue': ('https://github.com/pypa/pip/issues/%s', '#'),
@ -117,25 +117,25 @@ if not on_rtd:
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#html_theme_options = {}
# html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
#html_title = None
# html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
# html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = '_static/piplogo.png'
# html_logo = '_static/piplogo.png'
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = 'favicon.png'
# html_favicon = 'favicon.png'
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
@ -151,11 +151,11 @@ html_last_updated_fmt = '%b %d, %Y'
html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# html_additional_pages = {}
# If false, no module index is generated.
html_use_modindex = False
@ -164,7 +164,7 @@ html_use_modindex = False
html_use_index = False
# If true, the index is split into individual pages for each letter.
#html_split_index = False
# html_split_index = False
# If true, links to the reST sources are added to the pages.
html_show_sourcelink = False
@ -172,10 +172,10 @@ html_show_sourcelink = False
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
# html_use_opensearch = ''
# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = ''
# html_file_suffix = ''
# Output file base name for HTML help builder.
htmlhelp_basename = 'pipdocs'
@ -184,10 +184,10 @@ htmlhelp_basename = 'pipdocs'
# -- Options for LaTeX output -------------------------------------------------
# The paper size ('letter' or 'a4').
#latex_paper_size = 'letter'
# latex_paper_size = 'letter'
# The font size ('10pt', '11pt' or '12pt').
#latex_font_size = '10pt'
# latex_font_size = '10pt'
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual])
@ -203,17 +203,17 @@ latex_documents = [
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None
# latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
# latex_use_parts = False
# Additional stuff for the LaTeX preamble.
#latex_preamble = ''
# latex_preamble = ''
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# latex_appendices = []
# If false, no module index is generated.
#latex_use_modindex = True
# latex_use_modindex = True

View File

@ -54,9 +54,9 @@ class PipOptions(rst.Directive):
if option.takes_value():
metavar = option.metavar or option.dest.lower()
line += " <%s>" % metavar.lower()
#fix defaults
# fix defaults
opt_help = option.help.replace('%default', str(option.default))
#fix paths with sys.prefix
# fix paths with sys.prefix
opt_help = opt_help.replace(sys.prefix, "<sys.prefix>")
opt_help = opt_help.replace(
default_log_file,

View File

@ -151,7 +151,7 @@ def parseopts(args):
# the subcommand name
cmd_name = args_else[0].lower()
#all the args without the subcommand
# all the args without the subcommand
cmd_args = args[:]
cmd_args.remove(args_else[0].lower())
@ -184,8 +184,8 @@ def main(args=None):
return command.main(cmd_args)
############################################################
## Writing freeze files
# ###########################################################
# # Writing freeze files
class FrozenRequirement(object):

View File

@ -104,7 +104,7 @@ class Command(object):
self.setup_logging()
#TODO: try to get these passing down from the command?
# TODO: try to get these passing down from the command?
# without resorting to os.environ to hold these.
if options.no_input:

View File

@ -69,11 +69,11 @@ class PrettyHelpFormatter(optparse.IndentedHelpFormatter):
label = 'Commands'
else:
label = 'Description'
#some doc strings have inital newlines, some don't
# some doc strings have inital newlines, some don't
description = description.lstrip('\n')
#some doc strings have final newlines and spaces, some don't
# some doc strings have final newlines and spaces, some don't
description = description.rstrip()
#dedent, then reindent
# dedent, then reindent
description = self.indent_lines(textwrap.dedent(description), " ")
description = '%s:\n%s\n' % (label, description)
return description

View File

@ -59,7 +59,7 @@ class FreezeCommand(Command):
requirement = options.requirement
find_links = options.find_links or []
local_only = options.local
## FIXME: Obviously this should be settable:
# FIXME: Obviously this should be settable:
find_tags = False
skip_match = None

View File

@ -133,8 +133,8 @@ def compare_versions(version1, version2):
try:
return cmp(LooseVersion(version1), LooseVersion(version2))
except TypeError:
# certain LooseVersion comparions raise due to unorderable types,
# fallback to string comparison
# certain LooseVersion comparions raise due to unorderable types,
# fallback to string comparison
return cmp([str(v) for v in LooseVersion(version1).version],
[str(v) for v in LooseVersion(version2).version])

View File

@ -171,7 +171,7 @@ class WheelCommand(Command):
if not os.path.exists(options.wheel_dir):
os.makedirs(options.wheel_dir)
#parse args and/or requirements files
# parse args and/or requirements files
for name in args:
requirement_set.add_requirement(
InstallRequirement.from_line(name, None))
@ -187,7 +187,7 @@ class WheelCommand(Command):
continue
requirement_set.add_requirement(req)
#fail if no requirements
# fail if no requirements
if not requirement_set.has_requirements:
opts = {'name': self.name}
msg = ('You must give at least one requirement '
@ -196,7 +196,7 @@ class WheelCommand(Command):
return
try:
#build wheels
# build wheels
wb = WheelBuilder(
requirement_set,
finder,

View File

@ -143,7 +143,7 @@ class ZipCommand(Command):
'Module %s (in %s) isn\'t located in a zip file in %s'
% (module_name, filename, zip_filename))
package_path = os.path.dirname(zip_filename)
if not package_path in self.paths():
if package_path not in self.paths():
logger.warn(
'Unpacking %s into %s, but %s is not on sys.path'
% (display_path(zip_filename), display_path(package_path),
@ -158,7 +158,7 @@ class ZipCommand(Command):
return
logger.indent += 2
try:
## FIXME: this should be undoable:
# FIXME: this should be undoable:
zip = zipfile.ZipFile(zip_filename)
to_save = []
for info in zip.infolist():
@ -206,7 +206,7 @@ class ZipCommand(Command):
else:
dest_filename = filename + '.zip'
try:
## FIXME: I think this needs to be undoable:
# FIXME: I think this needs to be undoable:
if filename == dest_filename:
filename = backup_dir(orig_filename)
logger.notify(
@ -247,9 +247,9 @@ class ZipCommand(Command):
if not self.simulate:
rmtree(filename)
except:
## FIXME: need to do an undo here
# FIXME: need to do an undo here
raise
## FIXME: should also be undone:
# FIXME: should also be undone:
self.add_filename_to_pth(dest_filename)
finally:
logger.indent -= 2
@ -326,7 +326,7 @@ class ZipCommand(Command):
zip.close()
return package, full
zip.close()
## FIXME: need special error for package.py case:
# FIXME: need special error for package.py case:
raise InstallationError(
'No package with the name %s found' % package)

View File

@ -272,7 +272,7 @@ def get_file_content(url, comes_from=None, session=None):
path = '/' + path.lstrip('/')
url = path
else:
## FIXME: catch some errors
# FIXME: catch some errors
resp = session.get(url)
resp.raise_for_status()
@ -428,7 +428,7 @@ def _download_url(resp, link, temp_location):
show_url = link.show_url
try:
if show_progress:
## FIXME: the URL can get really long in this message:
# FIXME: the URL can get really long in this message:
if total_length:
logger.start_progress(
'Downloading %s (%s): ' %

View File

@ -297,7 +297,7 @@ class PackageFinder(object):
for parsed, link, version in file_versions
])
)
#this is an intentional priority ordering
# this is an intentional priority ordering
all_versions = installed_version + file_versions + found_versions \
+ page_versions
applicable_versions = []
@ -419,7 +419,7 @@ class PackageFinder(object):
"""
if not index_url.url.endswith('/'):
# Vaguely part of the PyPI API... weird but true.
## FIXME: bad to modify this?
# FIXME: bad to modify this?
index_url.url += '/'
page = self._get_page(index_url, req)
if page is None:
@ -458,7 +458,7 @@ class PackageFinder(object):
for link in page.rel_links():
normalized = normalize_name(req.name).lower()
if (not normalized in self.allow_external
if (normalized not in self.allow_external
and not self.allow_all_external):
self.need_warn_external = True
logger.debug("Not searching %s for files because external "
@ -467,7 +467,7 @@ class PackageFinder(object):
if (link.trusted is not None
and not link.trusted
and not normalized in self.allow_unverified):
and normalized not in self.allow_unverified):
logger.debug(
"Not searching %s for urls, it is an "
"untrusted link and cannot produce safe or "
@ -695,7 +695,7 @@ class PageCache(object):
class HTMLPage(object):
"""Represents one page, along with its URL"""
## FIXME: these regexes are horrible hacks:
# FIXME: these regexes are horrible hacks:
_homepage_re = re.compile(r'<th>\s*home\s*page', re.I)
_download_re = re.compile(r'<th>\s*download\s+url', re.I)
_href_re = re.compile(
@ -832,9 +832,9 @@ class HTMLPage(object):
session = PipSession()
scheme, netloc, path, query, fragment = urlparse.urlsplit(url)
if not scheme in ('http', 'https', 'ftp', 'ftps'):
## FIXME: some warning or something?
## assertion error?
if scheme not in ('http', 'https', 'ftp', 'ftps'):
# FIXME: some warning or something?
# assertion error?
return ''
resp = session.head(url, allow_redirects=True)

View File

@ -108,7 +108,7 @@ else:
# See https://github.com/pypa/pip/issues/906 for plan to move to mkdtemp
build_prefix = _get_build_prefix()
## FIXME: keep src in cwd for now (it is not a temporary folder)
# FIXME: keep src in cwd for now (it is not a temporary folder)
try:
src_prefix = os.path.join(os.getcwd(), 'src')
except OSError:

View File

@ -142,7 +142,7 @@ class Logger(object):
rendered = msg
rendered = ' ' * self.indent + rendered
if self.explicit_levels:
## FIXME: should this be a name, not a level number?
# FIXME: should this be a name, not a level number?
rendered = '%02i %s' % (level, rendered)
for consumer_level, consumer in self.consumers:

View File

@ -60,8 +60,8 @@ def parse_requirements(filename, finder=None, comes_from=None, options=None,
line = line[2:].strip()
else:
line = line[len('--find-links'):].strip().lstrip('=')
## FIXME: it would be nice to keep track of the source of
## the find_links:
# FIXME: it would be nice to keep track of the source of
# the find_links:
# support a find-links local path relative to a requirements file
relative_to_reqs_file = os.path.join(reqs_file_dir, line)
if os.path.exists(relative_to_reqs_file):

View File

@ -334,8 +334,8 @@ class InstallRequirement(object):
"%(Name)s==%(Version)s" % self.pkg_info())
self.correct_build_location()
## FIXME: This is a lame hack, entirely for PasteScript which has
## a self-provided entry point that causes this awkwardness
# FIXME: This is a lame hack, entirely for PasteScript which has
# a self-provided entry point that causes this awkwardness
_run_setup_py = """
__file__ = __SETUP_PY__
from setuptools.command import egg_info
@ -745,8 +745,8 @@ exec(compile(
install_args += ["--no-compile"]
if running_under_virtualenv():
## FIXME: I'm not sure if this is a reasonable location;
## probably not but we can't put it in the default location, as
# FIXME: I'm not sure if this is a reasonable location;
# probably not but we can't put it in the default location, as
# that is a virtualenv symlink that isn't writable
install_args += ['--install-headers',
os.path.join(sys.prefix, 'include', 'site',
@ -789,8 +789,8 @@ exec(compile(
'%s' % self
)
f.close()
## FIXME: put the record somewhere
## FIXME: should this be an error?
# FIXME: put the record somewhere
# FIXME: should this be an error?
return
f.close()
new_lines = []
@ -827,7 +827,7 @@ exec(compile(
logger.notify('Running setup.py develop for %s' % self.name)
logger.indent += 2
try:
## FIXME: should we do --install-headers here too?
# FIXME: should we do --install-headers here too?
cwd = self.source_dir
if self.editable_options and \
'subdirectory' in self.editable_options:
@ -916,7 +916,7 @@ exec(compile(
return self._is_bundle
base = self._temp_build_dir
if not base:
## FIXME: this doesn't seem right:
# FIXME: this doesn't seem right:
return False
self._is_bundle = (
os.path.exists(os.path.join(base, 'pip-manifest.txt'))
@ -927,7 +927,7 @@ exec(compile(
def bundle_requirements(self):
for dest_dir in self._bundle_editable_dirs:
package = os.path.basename(dest_dir)
## FIXME: svnism:
# FIXME: svnism:
for vcs_backend in vcs.backends:
url = rev = None
vcs_bundle_file = os.path.join(
@ -1005,7 +1005,7 @@ def _strip_postfix(req):
"""
Strip req postfix ( -dev, 0.2, etc )
"""
## FIXME: use package_to_requirement?
# FIXME: use package_to_requirement?
match = re.search(r'^(.*?)(?:-dev|-\d.*)$', req)
if match:
# Strip off -dev, -0.2, etc.

View File

@ -91,7 +91,7 @@ class RequirementSet(object):
install_req.target_dir = self.target_dir
install_req.pycompile = self.pycompile
if not name:
#url or path requirement w/o an egg fragment
# url or path requirement w/o an egg fragment
self.unnamed_requirements.append(install_req)
else:
if self.has_requirement(name):
@ -99,7 +99,7 @@ class RequirementSet(object):
'Double requirement given: %s (already in %s, name=%r)'
% (install_req, self.get_requirement(name), name))
self.requirements[name] = install_req
## FIXME: what about other normalizations? E.g., _ vs. -?
# FIXME: what about other normalizations? E.g., _ vs. -?
if name.lower() != name:
self.requirement_aliases[name.lower()] = name
@ -148,8 +148,8 @@ class RequirementSet(object):
req.commit_uninstall()
def locate_files(self):
## FIXME: duplicates code from prepare_files; relevant code should
## probably be factored out into a separate method
# FIXME: duplicates code from prepare_files; relevant code should
# probably be factored out into a separate method
unnamed = list(self.unnamed_requirements)
reqs = list(self.requirements.values())
while reqs or unnamed:
@ -213,9 +213,9 @@ class RequirementSet(object):
best_installed = False
not_found = None
###############################################
## Search for archive to fulfill requirement ##
###############################################
# ############################################# #
# # Search for archive to fulfill requirement # #
# ############################################# #
if not self.ignore_installed and not req_to_install.editable:
req_to_install.check_if_exists()
@ -267,9 +267,9 @@ class RequirementSet(object):
logger.notify('Downloading/unpacking %s' % req_to_install)
logger.indent += 2
##################################
## vcs update or unpack archive ##
##################################
# ################################ #
# # vcs update or unpack archive # #
# ################################ #
try:
is_bundle = False
@ -289,10 +289,10 @@ class RequirementSet(object):
else:
req_to_install.run_egg_info()
elif install:
##@@ if filesystem packages are not marked
##editable in a req, a non deterministic error
##occurs when the script attempts to unpack the
##build directory
# @@ if filesystem packages are not marked
# editable in a req, a non deterministic error
# occurs when the script attempts to unpack the
# build directory
# NB: This call can result in the creation of a temporary
# build directory
@ -320,7 +320,7 @@ class RequirementSet(object):
(req_to_install, location)
)
else:
## FIXME: this won't upgrade when there's an existing
# FIXME: this won't upgrade when there's an existing
# package unpacked in `location`
if req_to_install.url is None:
if not_found:
@ -330,7 +330,7 @@ class RequirementSet(object):
upgrade=self.upgrade,
)
else:
## FIXME: should req_to_install.url already be a
# FIXME: should req_to_install.url already be a
# link?
url = Link(req_to_install.url)
assert url
@ -395,8 +395,8 @@ class RequirementSet(object):
force_root_egg_info=True,
)
req_to_install.assert_source_matches_version()
#@@ sketchy way of identifying packages not grabbed
# from an index
# @@ sketchy way of identifying packages not
# grabbed from an index
if bundle and req_to_install.url:
self.copy_to_build_dir(req_to_install)
install = False
@ -423,9 +423,9 @@ class RequirementSet(object):
)
install = False
########################
## parse dependencies ##
########################
# ###################### #
# # parse dependencies # #
# ###################### #
if is_wheel:
dist = list(
@ -460,7 +460,7 @@ class RequirementSet(object):
req
).project_name
except ValueError as exc:
## FIXME: proper warning
# FIXME: proper warning
logger.error(
'Invalid requirement: %r (%s) in '
'requirement %s' %
@ -468,13 +468,13 @@ class RequirementSet(object):
)
continue
if self.has_requirement(name):
## FIXME: check for conflict
# FIXME: check for conflict
continue
subreq = InstallRequirement(req, req_to_install)
reqs.append(subreq)
self.add_requirement(subreq)
if not self.has_requirement(req_to_install.name):
#'unnamed' requirements will get added here
# 'unnamed' requirements will get added here
self.add_requirement(req_to_install)
# cleanup tmp src
@ -652,13 +652,13 @@ class RequirementSet(object):
self.successfully_installed = to_install
def create_bundle(self, bundle_filename):
## FIXME: can't decide which is better; zip is easier to read
## random files from, but tar.bz2 is smaller and not as lame a
## format.
# FIXME: can't decide which is better; zip is easier to read
# random files from, but tar.bz2 is smaller and not as lame a
# format.
## FIXME: this file should really include a manifest of the
## packages, maybe some other metadata files. It would make
## it easier to detect as well.
# FIXME: this file should really include a manifest of the
# packages, maybe some other metadata files. It would make
# it easier to detect as well.
zip = zipfile.ZipFile(bundle_filename, 'w', zipfile.ZIP_DEFLATED)
vcs_dirs = []
for dir, basename in (self.build_dir, 'build'), (self.src_dir, 'src'):
@ -720,7 +720,7 @@ class RequirementSet(object):
for req in [req for req in self.requirements.values()
if req.comes_from]:
parts.append('%s==%s\n' % (req.name, req.installed_version))
## FIXME: should we do something with self.unnamed_requirements?
# FIXME: should we do something with self.unnamed_requirements?
return ''.join(parts)
def _clean_zip_name(self, name, prefix):

View File

@ -361,7 +361,7 @@ def dist_in_site_packages(dist):
def dist_is_editable(dist):
"""Is distribution an editable install?"""
#TODO: factor out determining editableness out of FrozenRequirement
# TODO: factor out determining editableness out of FrozenRequirement
from pip import FrozenRequirement
req = FrozenRequirement.from_dist(dist, [])
return req.editable
@ -659,8 +659,8 @@ def unpack_file(filename, location, content_type, link):
from pip.vcs.subversion import Subversion
Subversion('svn+' + link.url).unpack(location)
else:
## FIXME: handle?
## FIXME: magic signatures?
# FIXME: handle?
# FIXME: magic signatures?
logger.fatal(
'Cannot unpack file %s (downloaded from %s, content-type: %s); '
'cannot detect archive format' %

View File

@ -200,8 +200,8 @@ class Git(VersionControl):
work with a ssh:// scheme (e.g. Github). But we need a scheme for
parsing. Hence we remove it again afterwards and return it as a stub.
"""
if not '://' in self.url:
assert not 'file:' in self.url
if '://' not in self.url:
assert 'file:' not in self.url
self.url = self.url.replace('git+', 'git+ssh://')
url, rev = super(Git, self).get_url_rev()
url = url.replace('ssh://', '')

View File

@ -113,7 +113,7 @@ class Subversion(VersionControl):
dirs.remove(self.dirname)
entries_fn = os.path.join(base, self.dirname, 'entries')
if not os.path.exists(entries_fn):
## FIXME: should we warn?
# FIXME: should we warn?
continue
dirurl, localrev = self._get_svn_url_rev(base)
@ -221,7 +221,7 @@ class Subversion(VersionControl):
if repo is None:
return None
parts = repo.split('/')
## FIXME: why not project name?
# FIXME: why not project name?
egg_project_name = dist.egg_name().split('-', 1)[0]
rev = self.get_revision(location)
if parts[-2] in ('tags', 'tag'):

View File

@ -533,7 +533,7 @@ class WheelBuilder(object):
def build(self):
"""Build wheels."""
#unpack and constructs req set
# unpack and constructs req set
self.requirement_set.prepare_files(self.finder)
reqset = self.requirement_set.requirements.values()
@ -557,7 +557,7 @@ class WheelBuilder(object):
build_failure.append(req)
logger.indent -= 2
#notify sucess/failure
# notify sucess/failure
if build_success:
logger.notify(
'Successfully built %s' %

View File

@ -18,7 +18,7 @@ class PyTest(TestCommand):
self.test_suite = True
def run_tests(self):
#import here, cause outside the eggs aren't loaded
# import here, cause outside the eggs aren't loaded
import pytest
sys.exit(pytest.main(self.test_args))

View File

@ -13,14 +13,14 @@ def _check_output(result, expected):
checker = OutputChecker()
actual = str(result)
## FIXME! The following is a TOTAL hack. For some reason the
## __str__ result for pkg_resources.Requirement gets downcased on
## Windows. Since INITools is the only package we're installing
## in this file with funky case requirements, I'm forcibly
## upcasing it. You can also normalize everything to lowercase,
## but then you have to remember to upcase <BLANKLINE>. The right
## thing to do in the end is probably to find out how to report
## the proper fully-cased package name in our error message.
# FIXME! The following is a TOTAL hack. For some reason the
# __str__ result for pkg_resources.Requirement gets downcased on
# Windows. Since INITools is the only package we're installing
# in this file with funky case requirements, I'm forcibly
# upcasing it. You can also normalize everything to lowercase,
# but then you have to remember to upcase <BLANKLINE>. The right
# thing to do in the end is probably to find out how to report
# the proper fully-cased package name in our error message.
if sys.platform == 'win32':
actual = actual.replace('initools', 'INITools')
@ -238,7 +238,7 @@ def test_freeze_bazaar_clone(script, tmpdir):
'release-0.1',
tmpdir.join("cache"),
)
#bzr internally stores windows drives as uppercase; we'll match that.
# bzr internally stores windows drives as uppercase; we'll match that.
checkout_pathC = checkout_path.replace('c:', 'C:')
result = script.run(

View File

@ -593,7 +593,7 @@ def test_url_req_case_mismatch(script, data):
'install', '--no-index', '-f', data.find_links, Upper, 'requiresupper'
)
#only Upper-1.0.tar.gz should get installed.
# only Upper-1.0.tar.gz should get installed.
egg_folder = script.site_packages / 'Upper-1.0-py%s.egg-info' % pyversion
assert egg_folder in result.files_created, str(result)
egg_folder = script.site_packages / 'Upper-2.0-py%s.egg-info' % pyversion

View File

@ -91,10 +91,10 @@ def test_cleanup_req_satisifed_no_name(script, data):
"""
Test cleanup when req is already satisfied, and req has no 'name'
"""
#this test confirms Issue #420 is fixed
#reqs with no 'name' that were already satisfied were leaving behind tmp
# this test confirms Issue #420 is fixed
# reqs with no 'name' that were already satisfied were leaving behind tmp
# build dirs
#2 examples of reqs that would do this
# 2 examples of reqs that would do this
# 1) https://bitbucket.org/ianb/initools/get/tip.zip
# 2) parent-0.1.tar.gz
dist = data.packages.join("parent-0.1.tar.gz")
@ -129,7 +129,7 @@ def test_cleanup_after_install_exception(script, data):
"""
Test clean up after a 'setup.py install' exception.
"""
#broken==0.2broken fails during install; see packages readme file
# broken==0.2broken fails during install; see packages readme file
result = script.pip(
'install', '-f', data.find_links, '--no-index', 'broken==0.2broken',
expect_error=True,
@ -143,7 +143,7 @@ def test_cleanup_after_egg_info_exception(script, data):
"""
Test clean up after a 'setup.py egg_info' exception.
"""
#brokenegginfo fails during egg_info; see packages readme file
# brokenegginfo fails during egg_info; see packages readme file
result = script.pip(
'install', '-f', data.find_links, '--no-index', 'brokenegginfo==0.1',
expect_error=True,

View File

@ -28,4 +28,4 @@ def test_no_extras_uninstall(script):
result2 = script.pip('uninstall', 'Paste', '-y')
# openid should not be uninstalled
initools_folder = script.site_packages / 'openid'
assert not initools_folder in result2.files_deleted, result.files_deleted
assert initools_folder not in result2.files_deleted, result.files_deleted

View File

@ -284,7 +284,7 @@ def test_upgrade_vcs_req_with_dist_found(script):
)
script.pip("install", req)
result = script.pip("install", "-U", req)
assert not "pypi.python.org" in result.stdout, result.stdout
assert "pypi.python.org" not in result.stdout, result.stdout
class TestUpgradeSetuptools(object):

View File

@ -118,7 +118,7 @@ class Tests_UserSite:
result2 = script.pip('install', '--user', 'INITools==0.1')
#usersite has 0.1
# usersite has 0.1
egg_info_folder = (
script.user_site / 'INITools-0.1-py%s.egg-info' % pyversion
)
@ -155,7 +155,7 @@ class Tests_UserSite:
result2 = script.pip('install', '--user', 'INITools==0.1')
#usersite has 0.1
# usersite has 0.1
egg_info_folder = (
script.user_site / 'INITools-0.1-py%s.egg-info' % pyversion
)
@ -163,7 +163,7 @@ class Tests_UserSite:
assert egg_info_folder in result2.files_created, str(result2)
assert initools_folder in result2.files_created, str(result2)
#site still has 0.2 (can't look in result1; have to check)
# site still has 0.2 (can't look in result1; have to check)
egg_info_folder = (
script.base_path / script.site_packages /
'INITools-0.2-py%s.egg-info' % pyversion
@ -196,7 +196,7 @@ class Tests_UserSite:
script.pip('install', 'INITools==0.2')
result2 = script.pip('install', '--user', '--upgrade', 'INITools')
#usersite has 0.3.1
# usersite has 0.3.1
egg_info_folder = (
script.user_site / 'INITools-0.3.1-py%s.egg-info' % pyversion
)
@ -204,7 +204,7 @@ class Tests_UserSite:
assert egg_info_folder in result2.files_created, str(result2)
assert initools_folder in result2.files_created, str(result2)
#site still has 0.2 (can't look in result1; have to check)
# site still has 0.2 (can't look in result1; have to check)
egg_info_folder = (
script.base_path / script.site_packages /
'INITools-0.2-py%s.egg-info' % pyversion
@ -240,7 +240,7 @@ class Tests_UserSite:
result3 = script.pip('install', '--user', 'INITools==0.1')
#usersite has 0.1
# usersite has 0.1
egg_info_folder = (
script.user_site / 'INITools-0.1-py%s.egg-info' % pyversion
)
@ -252,7 +252,7 @@ class Tests_UserSite:
assert egg_info_folder in result3.files_created, str(result3)
assert not isfile(initools_v3_file), initools_v3_file
#site still has 0.2 (can't just look in result1; have to check)
# site still has 0.2 (can't just look in result1; have to check)
egg_info_folder = (
script.base_path / script.site_packages /
'INITools-0.2-py%s.egg-info' % pyversion

View File

@ -69,7 +69,7 @@ class Tests_UninstallUserSite:
virtualenv.system_site_packages = True
script.user_site_path.makedirs()
#install
# install
to_install = data.packages.join("FSPkg")
result1 = script.pip(
'install', '--user', '-e', to_install, expect_error=False,
@ -77,7 +77,7 @@ class Tests_UninstallUserSite:
egg_link = script.user_site / 'FSPkg.egg-link'
assert egg_link in result1.files_created, str(result1.stdout)
#uninstall
# uninstall
result2 = script.pip('uninstall', '-y', 'FSPkg')
assert not isfile(script.base_path / egg_link)

View File

@ -94,7 +94,7 @@ def test_pip_wheel_ignore_wheels_editables(script, data):
assert "Successfully built simple" in result.stdout, result.stdout
assert "Failed to build" not in result.stdout, result.stdout
ignore_editable = "ignoring %s" % path_to_url(local_editable)
#TODO: understand this divergence
# TODO: understand this divergence
if sys.platform == 'win32':
ignore_editable = "ignoring %s" % path_to_url_d(local_editable)
assert ignore_editable in result.stdout, result.stdout

View File

@ -154,7 +154,7 @@ class TestPipResult(object):
(egg_link_path, self)
)
else:
if not egg_link_path in self.files_created:
if egg_link_path not in self.files_created:
raise TestFailure(
'expected egg link file missing: %r\n%s' %
(egg_link_path, self)

View File

@ -73,7 +73,7 @@ def _get_vcs_and_checkout_url(remote_repository, directory):
def local_checkout(remote_repo, directory):
if not os.path.exists(directory):
os.mkdir(directory)
#os.makedirs(directory)
# os.makedirs(directory)
if remote_repo.startswith('svn'):
_create_svn_repository_for_initools(directory)

View File

@ -56,8 +56,8 @@ class VirtualEnvironment(object):
p = subprocess.Popen(
cmd,
cwd=self.pip_source_dir,
#stderr=subprocess.STDOUT,
#stdout=DEVNULL,
# stderr=subprocess.STDOUT,
# stdout=DEVNULL,
)
p.communicate()
if p.returncode != 0:

View File

@ -54,7 +54,7 @@ def test_finder_detects_latest_find_links(data):
def test_finder_detects_latest_already_satisfied_find_links(data):
"""Test PackageFinder detects latest already satisified using find-links"""
req = InstallRequirement.from_line('simple', None)
#the latest simple in local pkgs is 3.0
# the latest simple in local pkgs is 3.0
latest_version = "3.0"
satisfied_by = Mock(
location="/path",
@ -71,7 +71,7 @@ def test_finder_detects_latest_already_satisfied_find_links(data):
def test_finder_detects_latest_already_satisfied_pypi_links():
"""Test PackageFinder detects latest already satisified using pypi links"""
req = InstallRequirement.from_line('initools', None)
#the latest initools on pypi is 0.3.1
# the latest initools on pypi is 0.3.1
latest_version = "0.3.1"
satisfied_by = Mock(
location="/path",
@ -97,7 +97,7 @@ class TestWheel:
log = []
logger.add_consumers((logger.DEBUG, log.append))
req = InstallRequirement.from_line("invalid")
#data.find_links contains "invalid.whl", which is an invalid wheel
# data.find_links contains "invalid.whl", which is an invalid wheel
finder = PackageFinder([data.find_links], [], use_wheel=True)
with pytest.raises(DistributionNotFound):
finder.find_requirement(req, True)

View File

@ -89,7 +89,7 @@ class TestLocations:
from pip import locations
assert locations._get_build_prefix() == self.get_build_dir_location()
#skip on windows, build dir is not created
# skip on windows, build dir is not created
@pytest.mark.skipif("sys.platform == 'win32'")
@pytest.mark.skipif("not hasattr(os, 'O_NOFOLLOW')")
def test_dir_created(self):
@ -103,7 +103,7 @@ class TestLocations:
assert os.path.exists(self.get_build_dir_location()), \
"the build_prefix directory should now exist!"
#skip on windows, build dir is not created
# skip on windows, build dir is not created
@pytest.mark.skipif("sys.platform == 'win32'")
def test_dir_created_without_NOFOLLOW(self, monkeypatch):
""" test that the build_prefix directory is generated when
@ -118,7 +118,7 @@ class TestLocations:
assert os.path.exists(self.get_build_dir_location()), \
"the build_prefix directory should now exist!"
#skip on windows; this exception logic only runs on linux
# skip on windows; this exception logic only runs on linux
@pytest.mark.skipif("sys.platform == 'win32'")
@pytest.mark.skipif("not hasattr(os, 'O_NOFOLLOW')")
def test_error_raised_when_owned_by_another(self):
@ -132,7 +132,7 @@ class TestLocations:
with pytest.raises(pip.exceptions.InstallationError):
locations._get_build_prefix()
#skip on windows; this exception logic only runs on linux
# skip on windows; this exception logic only runs on linux
@pytest.mark.skipif("sys.platform == 'win32'")
def test_error_raised_when_owned_by_another_without_NOFOLLOW(
self, monkeypatch):

View File

@ -36,7 +36,7 @@ class Tests_EgglinkPath:
'%s.egg-link' % project,
)
#patches
# patches
from pip import util
self.old_site_packages = util.site_packages
self.mock_site_packages = util.site_packages = 'SITE_PACKAGES'
@ -66,9 +66,9 @@ class Tests_EgglinkPath:
def eggLinkInSitePackages(self, egglink):
return egglink == self.site_packages_egglink
#########################
## egglink in usersite ##
#########################
# ####################### #
# # egglink in usersite # #
# ####################### #
def test_egglink_in_usersite_notvenv(self):
self.mock_virtualenv_no_global.return_value = False
self.mock_running_under_virtualenv.return_value = False
@ -87,9 +87,9 @@ class Tests_EgglinkPath:
self.mock_isfile.side_effect = self.eggLinkInUserSite
assert egg_link_path(self.mock_dist) == self.user_site_egglink
#########################
## egglink in sitepkgs ##
#########################
# ####################### #
# # egglink in sitepkgs # #
# ####################### #
def test_egglink_in_sitepkgs_notvenv(self):
self.mock_virtualenv_no_global.return_value = False
self.mock_running_under_virtualenv.return_value = False
@ -108,9 +108,9 @@ class Tests_EgglinkPath:
self.mock_isfile.side_effect = self.eggLinkInSitePackages
assert egg_link_path(self.mock_dist) == self.site_packages_egglink
####################################
## egglink in usersite & sitepkgs ##
####################################
# ################################## #
# # egglink in usersite & sitepkgs # #
# ################################## #
def test_egglink_in_both_notvenv(self):
self.mock_virtualenv_no_global.return_value = False
self.mock_running_under_virtualenv.return_value = False
@ -129,9 +129,9 @@ class Tests_EgglinkPath:
self.mock_isfile.return_value = True
assert egg_link_path(self.mock_dist) == self.site_packages_egglink
################
## no egglink ##
################
# ############## #
# # no egglink # #
# ############## #
def test_noegglink_in_sitepkgs_notvenv(self):
self.mock_virtualenv_no_global.return_value = False
self.mock_running_under_virtualenv.return_value = False