Skip to content

Commit

Permalink
👹 Feed the hobgoblins (delint).
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Jan 19, 2020
1 parent a0e8d05 commit 3d4d8b9
Show file tree
Hide file tree
Showing 32 changed files with 251 additions and 187 deletions.
39 changes: 11 additions & 28 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,3 @@
# -*- coding: utf-8 -*-
#
# Setuptools documentation build configuration file, created by
# sphinx-quickstart on Fri Jul 17 14:22:37 2009.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# The contents of this file are pickled, so don't put values in the namespace
# that aren't pickleable (module imports are okay, they're removed automatically).
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default

# If extensions (or modules to document with autodoc) are in another directory,
# 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.

import subprocess
import sys
import os
Expand All @@ -30,10 +10,8 @@
cwd=os.path.join(os.path.dirname(__file__), os.path.pardir),
)

# -- General configuration -----------------------------------------------------
# -- 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 = ['jaraco.packaging.sphinx', 'rst.linker']

# Add any paths that contain templates here, relative to this directory.
Expand All @@ -45,7 +23,8 @@
# The master toctree document.
master_doc = 'index'

# A list of glob-style patterns that should be excluded when looking for source files.
# A list of glob-style patterns that should be excluded
# when looking for source files.
exclude_patterns = ['requirements.txt']

# List of directories, relative to source directory, that shouldn't be searched
Expand All @@ -55,7 +34,7 @@
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'

# -- Options for HTML output ---------------------------------------------------
# -- Options for HTML output --

# The theme to use for HTML and HTML Help pages. Major themes that come with
# Sphinx are currently 'default' and 'sphinxdoc'.
Expand All @@ -69,18 +48,22 @@
html_use_smartypants = True

# Custom sidebar templates, maps document names to template names.
html_sidebars = {'index': ['relations.html', 'sourcelink.html', 'indexsidebar.html', 'searchbox.html']}
html_sidebars = {
'index': [
'relations.html', 'sourcelink.html', 'indexsidebar.html',
'searchbox.html']}

# If false, no module index is generated.
html_use_modindex = False

# If false, no index is generated.
html_use_index = False

# -- Options for LaTeX output --------------------------------------------------
# -- Options for LaTeX output --

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
# (source start file, target name, title, author,
# documentclass [howto/manual]).
latex_documents = [
('index', 'Setuptools.tex', 'Setuptools Documentation',
'The fellowship of the packaging', 'manual'),
Expand Down
4 changes: 3 additions & 1 deletion pkg_resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2329,7 +2329,8 @@ def null_ns_handler(importer, path_item, packageName, module):

def normalize_path(filename):
"""Normalize a file/dir name for comparison purposes"""
return os.path.normcase(os.path.realpath(os.path.normpath(_cygwin_patch(filename))))
return os.path.normcase(os.path.realpath(os.path.normpath(
_cygwin_patch(filename))))


def _cygwin_patch(filename): # pragma: nocover
Expand Down Expand Up @@ -3288,6 +3289,7 @@ def _initialize_master_working_set():
list(map(working_set.add_entry, sys.path))
globals().update(locals())


class PkgResourcesDeprecationWarning(Warning):
"""
Base class for warning about deprecations in ``pkg_resources``
Expand Down
8 changes: 5 additions & 3 deletions pkg_resources/tests/test_pkg_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
except ImportError:
import mock

from pkg_resources import DistInfoDistribution, Distribution, EggInfoDistribution
from pkg_resources import (
DistInfoDistribution, Distribution, EggInfoDistribution,
)
from setuptools.extern import six
from pkg_resources.extern.six.moves import map
from pkg_resources.extern.six import text_type, string_types
Expand Down Expand Up @@ -279,8 +281,8 @@ def make_distribution_no_version(tmpdir, basename):
('dist-info', 'METADATA', DistInfoDistribution),
],
)
def test_distribution_version_missing(tmpdir, suffix, expected_filename,
expected_dist_type):
def test_distribution_version_missing(
tmpdir, suffix, expected_filename, expected_dist_type):
"""
Test Distribution.version when the "Version" header is missing.
"""
Expand Down
3 changes: 1 addition & 2 deletions pkg_resources/tests/test_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from pkg_resources import (
parse_requirements, VersionConflict, parse_version,
Distribution, EntryPoint, Requirement, safe_version, safe_name,
WorkingSet, PkgResourcesDeprecationWarning)
WorkingSet)


# from Python 3.6 docs.
Expand Down Expand Up @@ -501,7 +501,6 @@ def testDeprecationWarnings(self):
ep.load(require=False)



class TestRequirements:
def testBasics(self):
r = Requirement.parse("Twisted>=1.2")
Expand Down
6 changes: 3 additions & 3 deletions setuptools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Extensions to the 'distutils' for large or complex distributions"""

import os
import sys
import functools
import distutils.core
import distutils.filelist
Expand Down Expand Up @@ -31,7 +30,7 @@
]

if PY3:
__all__.append('find_namespace_packages')
__all__.append('find_namespace_packages')

__version__ = setuptools.version.__version__

Expand Down Expand Up @@ -123,7 +122,7 @@ def _looks_like_package(path):
find_packages = PackageFinder.find

if PY3:
find_namespace_packages = PEP420PackageFinder.find
find_namespace_packages = PEP420PackageFinder.find


def _install_setup_requires(attrs):
Expand All @@ -144,6 +143,7 @@ def setup(**attrs):
_install_setup_requires(attrs)
return distutils.core.setup(**attrs)


setup.__doc__ = distutils.core.setup.__doc__


Expand Down
6 changes: 4 additions & 2 deletions setuptools/archive_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ def default_filter(src, dst):
return dst


def unpack_archive(filename, extract_dir, progress_filter=default_filter,
def unpack_archive(
filename, extract_dir, progress_filter=default_filter,
drivers=None):
"""Unpack `filename` to `extract_dir`, or raise ``UnrecognizedFormat``
Expand Down Expand Up @@ -148,7 +149,8 @@ def unpack_tarfile(filename, extract_dir, progress_filter=default_filter):

# resolve any links and to extract the link targets as normal
# files
while member is not None and (member.islnk() or member.issym()):
while member is not None and (
member.islnk() or member.issym()):
linkpath = member.linkname
if member.issym():
base = posixpath.dirname(member.name)
Expand Down
24 changes: 16 additions & 8 deletions setuptools/build_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
'__legacy__',
'SetupRequirementsError']


class SetupRequirementsError(BaseException):
def __init__(self, specifiers):
self.specifiers = specifiers
Expand Down Expand Up @@ -143,7 +144,8 @@ def run_setup(self, setup_script='setup.py'):

def get_requires_for_build_wheel(self, config_settings=None):
config_settings = self._fix_config(config_settings)
return self._get_build_requires(config_settings, requirements=['wheel'])
return self._get_build_requires(
config_settings, requirements=['wheel'])

def get_requires_for_build_sdist(self, config_settings=None):
config_settings = self._fix_config(config_settings)
Expand All @@ -160,8 +162,10 @@ def prepare_metadata_for_build_wheel(self, metadata_directory,
dist_infos = [f for f in os.listdir(dist_info_directory)
if f.endswith('.dist-info')]

if (len(dist_infos) == 0 and
len(_get_immediate_subdirectories(dist_info_directory)) == 1):
if (
len(dist_infos) == 0 and
len(_get_immediate_subdirectories(dist_info_directory)) == 1
):

dist_info_directory = os.path.join(
dist_info_directory, os.listdir(dist_info_directory)[0])
Expand Down Expand Up @@ -193,7 +197,8 @@ def _build_with_temp_dir(self, setup_command, result_extension,
config_settings["--global-option"])
self.run_setup()

result_basename = _file_with_extension(tmp_dist_dir, result_extension)
result_basename = _file_with_extension(
tmp_dist_dir, result_extension)
result_path = os.path.join(result_directory, result_basename)
if os.path.exists(result_path):
# os.rename will fail overwriting on non-Unix.
Expand All @@ -202,7 +207,6 @@ def _build_with_temp_dir(self, setup_command, result_extension,

return result_basename


def build_wheel(self, wheel_directory, config_settings=None,
metadata_directory=None):
return self._build_with_temp_dir(['bdist_wheel'], '.whl',
Expand All @@ -217,9 +221,12 @@ def build_sdist(self, sdist_directory, config_settings=None):
class _BuildMetaLegacyBackend(_BuildMetaBackend):
"""Compatibility backend for setuptools
This is a version of setuptools.build_meta that endeavors to maintain backwards
compatibility with pre-PEP 517 modes of invocation. It exists as a temporary
bridge between the old packaging mechanism and the new packaging mechanism,
This is a version of setuptools.build_meta that endeavors
to maintain backwards
compatibility with pre-PEP 517 modes of invocation. It
exists as a temporary
bridge between the old packaging mechanism and the new
packaging mechanism,
and will eventually be removed.
"""
def run_setup(self, setup_script='setup.py'):
Expand Down Expand Up @@ -250,6 +257,7 @@ def run_setup(self, setup_script='setup.py'):
sys.path[:] = sys_path
sys.argv[0] = sys_argv_0


# The primary backend
_BACKEND = _BuildMetaBackend()

Expand Down
31 changes: 17 additions & 14 deletions setuptools/command/build_clib.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,28 +71,31 @@ def build_libraries(self, libraries):
output_dir=self.build_temp
)

if newer_pairwise_group(dependencies, expected_objects) != ([], []):
if (
newer_pairwise_group(dependencies, expected_objects)
!= ([], [])
):
# First, compile the source code to object files in the library
# directory. (This should probably change to putting object
# files in a temporary build directory.)
macros = build_info.get('macros')
include_dirs = build_info.get('include_dirs')
cflags = build_info.get('cflags')
objects = self.compiler.compile(
sources,
output_dir=self.build_temp,
macros=macros,
include_dirs=include_dirs,
extra_postargs=cflags,
debug=self.debug
)
self.compiler.compile(
sources,
output_dir=self.build_temp,
macros=macros,
include_dirs=include_dirs,
extra_postargs=cflags,
debug=self.debug
)

# Now "link" the object files together into a static library.
# (On Unix at least, this isn't really linking -- it just
# builds an archive. Whatever.)
self.compiler.create_static_lib(
expected_objects,
lib_name,
output_dir=self.build_clib,
debug=self.debug
)
expected_objects,
lib_name,
output_dir=self.build_clib,
debug=self.debug
)
9 changes: 6 additions & 3 deletions setuptools/command/build_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
if six.PY2:
import imp

EXTENSION_SUFFIXES = [s for s, _, tp in imp.get_suffixes() if tp == imp.C_EXTENSION]
EXTENSION_SUFFIXES = [
s for s, _, tp in imp.get_suffixes() if tp == imp.C_EXTENSION]
else:
from importlib.machinery import EXTENSION_SUFFIXES

Expand All @@ -29,7 +30,7 @@

# make sure _config_vars is initialized
get_config_var("LDSHARED")
from distutils.sysconfig import _config_vars as _CONFIG_VARS
from distutils.sysconfig import _config_vars as _CONFIG_VARS # noqa


def _customize_compiler_for_shlib(compiler):
Expand Down Expand Up @@ -65,7 +66,9 @@ def _customize_compiler_for_shlib(compiler):
except ImportError:
pass

if_dl = lambda s: s if have_rtld else ''

def if_dl(s):
return s if have_rtld else ''


def get_abi3_suffix():
Expand Down
Loading

0 comments on commit 3d4d8b9

Please sign in to comment.