Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
setuptools
Commits
31bd37c6
Commit
31bd37c6
authored
Oct 18, 2016
by
stepshal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix quantity of blank lines.
parent
f774a0be
Changes
45
Hide whitespace changes
Inline
Side-by-side
Showing
45 changed files
with
48 additions
and
88 deletions
+48
-88
bootstrap.py
bootstrap.py
+0
-1
docs/conf.py
docs/conf.py
+0
-2
pkg_resources/__init__.py
pkg_resources/__init__.py
+2
-7
pkg_resources/tests/test_pkg_resources.py
pkg_resources/tests/test_pkg_resources.py
+1
-4
pkg_resources/tests/test_resources.py
pkg_resources/tests/test_resources.py
+2
-5
setup.py
setup.py
+0
-7
setuptools/__init__.py
setuptools/__init__.py
+0
-1
setuptools/archive_util.py
setuptools/archive_util.py
+0
-1
setuptools/command/__init__.py
setuptools/command/__init__.py
+0
-1
setuptools/command/bdist_egg.py
setuptools/command/bdist_egg.py
+1
-1
setuptools/command/bdist_wininst.py
setuptools/command/bdist_wininst.py
+0
-1
setuptools/command/build_ext.py
setuptools/command/build_ext.py
+0
-2
setuptools/command/easy_install.py
setuptools/command/easy_install.py
+3
-4
setuptools/command/sdist.py
setuptools/command/sdist.py
+2
-0
setuptools/command/setopt.py
setuptools/command/setopt.py
+0
-1
setuptools/command/test.py
setuptools/command/test.py
+0
-2
setuptools/extension.py
setuptools/extension.py
+0
-1
setuptools/extern/__init__.py
setuptools/extern/__init__.py
+0
-1
setuptools/glob.py
setuptools/glob.py
+11
-0
setuptools/lib2to3_ex.py
setuptools/lib2to3_ex.py
+0
-2
setuptools/monkey.py
setuptools/monkey.py
+0
-1
setuptools/msvc.py
setuptools/msvc.py
+3
-0
setuptools/package_index.py
setuptools/package_index.py
+5
-2
setuptools/py26compat.py
setuptools/py26compat.py
+1
-1
setuptools/py27compat.py
setuptools/py27compat.py
+1
-0
setuptools/py31compat.py
setuptools/py31compat.py
+1
-0
setuptools/sandbox.py
setuptools/sandbox.py
+6
-0
setuptools/ssl_support.py
setuptools/ssl_support.py
+3
-2
setuptools/tests/__init__.py
setuptools/tests/__init__.py
+0
-4
setuptools/tests/server.py
setuptools/tests/server.py
+0
-1
setuptools/tests/test_bdist_egg.py
setuptools/tests/test_bdist_egg.py
+0
-2
setuptools/tests/test_build_ext.py
setuptools/tests/test_build_ext.py
+0
-1
setuptools/tests/test_develop.py
setuptools/tests/test_develop.py
+0
-1
setuptools/tests/test_easy_install.py
setuptools/tests/test_easy_install.py
+0
-8
setuptools/tests/test_egg_info.py
setuptools/tests/test_egg_info.py
+0
-1
setuptools/tests/test_find_packages.py
setuptools/tests/test_find_packages.py
+0
-1
setuptools/tests/test_integration.py
setuptools/tests/test_integration.py
+1
-0
setuptools/tests/test_manifest.py
setuptools/tests/test_manifest.py
+0
-4
setuptools/tests/test_packageindex.py
setuptools/tests/test_packageindex.py
+0
-3
setuptools/tests/test_sandbox.py
setuptools/tests/test_sandbox.py
+4
-2
setuptools/tests/test_sdist.py
setuptools/tests/test_sdist.py
+0
-5
setuptools/tests/test_test.py
setuptools/tests/test_test.py
+0
-1
setuptools/tests/test_upload_docs.py
setuptools/tests/test_upload_docs.py
+0
-2
setuptools/tests/test_windows_wrappers.py
setuptools/tests/test_windows_wrappers.py
+0
-2
tests/manual_test.py
tests/manual_test.py
+1
-0
No files found.
bootstrap.py
View file @
31bd37c6
...
...
@@ -10,7 +10,6 @@ import sys
import
textwrap
import
subprocess
minimal_egg_info
=
textwrap
.
dedent
(
"""
[distutils.commands]
egg_info = setuptools.command.egg_info:egg_info
...
...
docs/conf.py
View file @
31bd37c6
...
...
@@ -60,7 +60,6 @@ exclude_trees = []
# The name of the Pygments (syntax highlighting) style to use.
pygments_style
=
'sphinx'
# -- Options for HTML output ---------------------------------------------------
# The theme to use for HTML and HTML Help pages. Major themes that come with
...
...
@@ -93,7 +92,6 @@ html_use_index = False
# Output file base name for HTML help builder.
htmlhelp_basename
=
'Setuptoolsdoc'
# -- Options for LaTeX output --------------------------------------------------
# Grouping the document tree into LaTeX files. List of tuples
...
...
pkg_resources/__init__.py
View file @
31bd37c6
# coding: utf-8
"""
Package resource API
--------------------
...
...
@@ -74,7 +73,6 @@ __import__('pkg_resources.extern.packaging.specifiers')
__import__
(
'pkg_resources.extern.packaging.requirements'
)
__import__
(
'pkg_resources.extern.packaging.markers'
)
if
(
3
,
0
)
<
sys
.
version_info
<
(
3
,
3
):
msg
=
(
"Support for Python 3.0-3.2 has been dropped. Future versions "
...
...
@@ -96,7 +94,6 @@ class PEP440Warning(RuntimeWarning):
class
_SetuptoolsVersionMixin
(
object
):
def
__hash__
(
self
):
return
super
(
_SetuptoolsVersionMixin
,
self
).
__hash__
()
...
...
@@ -578,7 +575,6 @@ def get_entry_info(dist, group, name):
class IMetadataProvider:
def has_metadata(name):
"""
Does
the
package
's distribution contain the named metadata?"""
...
...
@@ -2738,7 +2734,6 @@ class Distribution(object):
class
EggInfoDistribution
(
Distribution
):
def
_reload_version
(
self
):
"""
Packages installed by distutils (e.g. numpy or scipy),
...
...
@@ -2825,7 +2820,6 @@ def issue_warning(*args, **kw):
class RequirementParseError(ValueError):
def __str__(self):
return ' '.join(self.args)
...
...
@@ -2850,7 +2844,6 @@ def parse_requirements(strs):
class Requirement(packaging.requirements.Requirement):
def __init__(self, requirement_string):
"""DO NOT CALL THIS UNDOCUMENTED METHOD; use Requirement.parse()!"""
try:
...
...
@@ -2906,8 +2899,10 @@ class Requirement(packaging.requirements.Requirement):
def _get_mro(cls):
"""Get an mro for a type or classic class"""
if not isinstance(cls, type):
class cls(cls, object):
pass
return cls.__mro__[1:]
return cls.__mro__
...
...
pkg_resources/tests/test_pkg_resources.py
View file @
31bd37c6
...
...
@@ -18,7 +18,6 @@ import pytest
import
pkg_resources
try
:
unicode
except
NameError
:
...
...
@@ -37,7 +36,6 @@ def timestamp(dt):
class
EggRemover
(
unicode
):
def
__call__
(
self
):
if
self
in
sys
.
path
:
sys
.
path
.
remove
(
self
)
...
...
@@ -100,7 +98,6 @@ class TestZipProvider(object):
class
TestResourceManager
(
object
):
def
test_get_cache_path
(
self
):
mgr
=
pkg_resources
.
ResourceManager
()
path
=
mgr
.
get_cache_path
(
'foo'
)
...
...
@@ -130,13 +127,13 @@ class TestIndependence:
class
TestDeepVersionLookupDistutils
(
object
):
@
pytest
.
fixture
def
env
(
self
,
tmpdir
):
"""
Create a package environment, similar to a virtualenv,
in which packages are installed.
"""
class
Environment
(
str
):
pass
...
...
pkg_resources/tests/test_resources.py
View file @
31bd37c6
...
...
@@ -36,7 +36,6 @@ dist_from_fn = pkg_resources.Distribution.from_filename
class
TestDistro
:
def
testCollection
(
self
):
# empty path should produce no distributions
ad
=
pkg_resources
.
Environment
([],
platform
=
None
,
python
=
None
)
...
...
@@ -313,7 +312,6 @@ class TestDistro:
class
TestWorkingSet
:
def
test_find_conflicting
(
self
):
ws
=
WorkingSet
([])
Foo
=
Distribution
.
from_filename
(
"/foo_dir/Foo-1.2.egg"
)
...
...
@@ -356,7 +354,6 @@ class TestWorkingSet:
class
TestEntryPoints
:
def
assertfields
(
self
,
ep
):
assert
ep
.
name
==
"foo"
assert
ep
.
module_name
==
"pkg_resources.tests.test_resources"
...
...
@@ -457,7 +454,6 @@ class TestEntryPoints:
class
TestRequirements
:
def
testBasics
(
self
):
r
=
Requirement
.
parse
(
"Twisted>=1.2"
)
assert
str
(
r
)
==
"Twisted>=1.2"
...
...
@@ -538,7 +534,6 @@ class TestRequirements:
class
TestParsing
:
def
testEmptyParse
(
self
):
assert
list
(
parse_requirements
(
''
))
==
[]
...
...
@@ -701,6 +696,7 @@ class TestParsing:
value of parse_version. The new parse_version returns a Version class
which needs to support this behavior, at least for now.
"""
def
buildout
(
parsed_version
):
_final_parts
=
'*final-'
,
'*final'
...
...
@@ -709,6 +705,7 @@ class TestParsing:
if
(
part
[:
1
]
==
'*'
)
and
(
part
not
in
_final_parts
):
return
False
return
True
return
_final_version
(
parsed_version
)
assert
buildout
(
parse_version
(
"1.0"
))
...
...
setup.py
View file @
31bd37c6
...
...
@@ -10,7 +10,6 @@ import textwrap
import
setuptools
here
=
os
.
path
.
dirname
(
__file__
)
...
...
@@ -97,11 +96,8 @@ setup_params = dict(
src_root
=
None
,
packages
=
setuptools
.
find_packages
(
exclude
=
[
'*.tests'
]),
package_data
=
package_data
,
py_modules
=
[
'easy_install'
],
zip_safe
=
True
,
entry_points
=
{
"distutils.commands"
:
[
"%(cmd)s = setuptools.command.%(cmd)s:%(cmd)s"
%
locals
()
...
...
@@ -141,12 +137,9 @@ setup_params = dict(
"dependency_links.txt = setuptools.command.egg_info:overwrite_arg"
,
],
"console_scripts"
:
list
(
_gen_console_scripts
()),
"setuptools.installation"
:
[
'eggsecutable = setuptools.command.easy_install:bootstrap'
],
},
classifiers
=
textwrap
.
dedent
(
"""
Development Status :: 5 - Production/Stable
Intended Audience :: Developers
...
...
setuptools/__init__.py
View file @
31bd37c6
...
...
@@ -102,7 +102,6 @@ class PackageFinder(object):
class
PEP420PackageFinder
(
PackageFinder
):
@
staticmethod
def
_looks_like_package
(
path
):
return
True
...
...
setuptools/archive_util.py
View file @
31bd37c6
...
...
@@ -10,7 +10,6 @@ from distutils.errors import DistutilsError
from
pkg_resources
import
ensure_directory
,
ContextualZipFile
__all__
=
[
"unpack_archive"
,
"unpack_zipfile"
,
"unpack_tarfile"
,
"default_filter"
,
"UnrecognizedFormat"
,
"extraction_drivers"
,
"unpack_directory"
,
...
...
setuptools/command/__init__.py
View file @
31bd37c6
...
...
@@ -10,7 +10,6 @@ import sys
from
setuptools.command
import
install_scripts
if
'egg'
not
in
bdist
.
format_commands
:
bdist
.
format_command
[
'egg'
]
=
(
'bdist_egg'
,
"Python .egg file"
)
bdist
.
format_commands
.
append
(
'egg'
)
...
...
setuptools/command/bdist_egg.py
View file @
31bd37c6
...
...
@@ -429,10 +429,10 @@ def can_scan():
log
.
warn
(
"Please ask the author to include a 'zip_safe'"
" setting (either True or False) in the package's setup.py"
)
# Attribute names of options for commands that might need to be convinced to
# install to the egg build directory
INSTALL_DIRECTORY_ATTRS
=
[
'install_lib'
,
'install_dir'
,
'install_data'
,
'install_base'
]
...
...
setuptools/command/bdist_wininst.py
View file @
31bd37c6
...
...
@@ -2,7 +2,6 @@ import distutils.command.bdist_wininst as orig
class
bdist_wininst
(
orig
.
bdist_wininst
):
def
reinitialize_command
(
self
,
command
,
reinit_subcommands
=
0
):
"""
Supplement reinitialize_command to work around
...
...
setuptools/command/build_ext.py
View file @
31bd37c6
...
...
@@ -56,7 +56,6 @@ elif os.name != 'nt':
except
ImportError
:
pass
if_dl
=
lambda
s
:
s
if
have_rtld
else
''
...
...
@@ -70,7 +69,6 @@ def get_abi3_suffix():
class
build_ext
(
_build_ext
):
def
run
(
self
):
"""Build extensions in build directory, then copy if --inplace"""
old_inplace
,
self
.
inplace
=
self
.
inplace
,
0
...
...
setuptools/command/easy_install.py
View file @
31bd37c6
#!/usr/bin/env python
"""
Easy Install
------------
...
...
@@ -64,7 +63,6 @@ import pkg_resources
# Turn on PEP440Warnings
warnings
.
filterwarnings
(
"default"
,
category
=
pkg_resources
.
PEP440Warning
)
__all__
=
[
'samefile'
,
'easy_install'
,
'PthDistributions'
,
'extract_wininst_cfg'
,
'main'
,
'get_exe_prefixes'
,
...
...
@@ -92,6 +90,7 @@ def samefile(p1, p2):
if
six
.
PY2
:
def
_to_ascii
(
s
):
return
s
...
...
@@ -102,6 +101,7 @@ if six.PY2:
except
UnicodeError
:
return
False
else
:
def
_to_ascii
(
s
):
return
s
.
encode
(
'ascii'
)
...
...
@@ -1632,7 +1632,6 @@ class PthDistributions(Environment):
class
RewritePthDistributions
(
PthDistributions
):
@
classmethod
def
_wrap_lines
(
cls
,
lines
):
yield
cls
.
prelude
...
...
@@ -1837,6 +1836,7 @@ if '__pypy__' in sys.builtin_module_names:
_replace_zip_directory_cache_data
=
\
_remove_and_clear_zip_directory_cache_data
else
:
def
_replace_zip_directory_cache_data
(
normalized_path
):
def
replace_cached_zip_archive_directory_data
(
path
,
old_entry
):
# N.B. In theory, we could load the zip directory information just
...
...
@@ -2164,7 +2164,6 @@ class WindowsScriptWriter(ScriptWriter):
class
WindowsExecutableLauncherWriter
(
WindowsScriptWriter
):
@
classmethod
def
_get_script_args
(
cls
,
type_
,
name
,
header
,
script_text
):
"""
...
...
setuptools/command/sdist.py
View file @
31bd37c6
...
...
@@ -89,8 +89,10 @@ class sdist(sdist_add_defaults, orig.sdist):
"""
In a context, remove and restore os.link if it exists
"""
class
NoValue
:
pass
orig_val
=
getattr
(
os
,
'link'
,
NoValue
)
try
:
del
os
.
link
...
...
setuptools/command/setopt.py
View file @
31bd37c6
...
...
@@ -8,7 +8,6 @@ from setuptools.extern.six.moves import configparser
from
setuptools
import
Command
__all__
=
[
'config_file'
,
'edit_config'
,
'option_base'
,
'setopt'
]
...
...
setuptools/command/test.py
View file @
31bd37c6
...
...
@@ -17,7 +17,6 @@ from setuptools.py31compat import unittest_main
class
ScanningLoader
(
TestLoader
):
def
loadTestsFromModule
(
self
,
module
,
pattern
=
None
):
"""Return a suite of all tests cases contained in the given module
...
...
@@ -50,7 +49,6 @@ class ScanningLoader(TestLoader):
# adapted from jaraco.classes.properties:NonDataProperty
class
NonDataProperty
(
object
):
def
__init__
(
self
,
fget
):
self
.
fget
=
fget
...
...
setuptools/extension.py
View file @
31bd37c6
...
...
@@ -26,7 +26,6 @@ def _have_cython():
# for compatibility
have_pyrex
=
_have_cython
_Extension
=
get_unpatched
(
distutils
.
core
.
Extension
)
...
...
setuptools/extern/__init__.py
View file @
31bd37c6
from
pkg_resources.extern
import
VendorImporter
names
=
'six'
,
VendorImporter
(
__name__
,
names
,
'pkg_resources._vendor'
).
install
()
setuptools/glob.py
View file @
31bd37c6
...
...
@@ -14,6 +14,7 @@ from setuptools.extern.six import binary_type
__all__
=
[
"glob"
,
"iglob"
,
"escape"
]
def
glob
(
pathname
,
recursive
=
False
):
"""Return a list of paths matching a pathname pattern.
...
...
@@ -27,6 +28,7 @@ def glob(pathname, recursive=False):
"""
return
list
(
iglob
(
pathname
,
recursive
=
recursive
))
def
iglob
(
pathname
,
recursive
=
False
):
"""Return an iterator which yields the paths matching a pathname pattern.
...
...
@@ -44,6 +46,7 @@ def iglob(pathname, recursive=False):
assert
not
s
return
it
def
_iglob
(
pathname
,
recursive
):
dirname
,
basename
=
os
.
path
.
split
(
pathname
)
if
not
has_magic
(
pathname
):
...
...
@@ -81,10 +84,12 @@ def _iglob(pathname, recursive):
for
name
in
glob_in_dir
(
dirname
,
basename
):
yield
os
.
path
.
join
(
dirname
,
name
)
# These 2 helper functions non-recursively glob inside a literal directory.
# They return a list of basenames. `glob1` accepts a pattern while `glob0`
# takes a literal basename (so it only has to check for its existence).
def
glob1
(
dirname
,
pattern
):
if
not
dirname
:
if
isinstance
(
pattern
,
binary_type
):
...
...
@@ -97,6 +102,7 @@ def glob1(dirname, pattern):
return
[]
return
fnmatch
.
filter
(
names
,
pattern
)
def
glob0
(
dirname
,
basename
):
if
not
basename
:
# `os.path.split()` returns an empty basename for paths ending with a
...
...
@@ -108,9 +114,11 @@ def glob0(dirname, basename):
return
[
basename
]
return
[]
# This helper function recursively yields relative pathnames inside a literal
# directory.
def
glob2
(
dirname
,
pattern
):
assert
_isrecursive
(
pattern
)
yield
pattern
[:
0
]
...
...
@@ -139,6 +147,7 @@ def _rlistdir(dirname):
magic_check
=
re
.
compile
(
'([*?[])'
)
magic_check_bytes
=
re
.
compile
(
b'([*?[])'
)
def
has_magic
(
s
):
if
isinstance
(
s
,
binary_type
):
match
=
magic_check_bytes
.
search
(
s
)
...
...
@@ -146,12 +155,14 @@ def has_magic(s):
match
=
magic_check
.
search
(
s
)
return
match
is
not
None
def
_isrecursive
(
pattern
):
if
isinstance
(
pattern
,
binary_type
):
return
pattern
==
b'**'
else
:
return
pattern
==
'**'
def
escape
(
pathname
):
"""Escape all special characters.
"""
...
...
setuptools/lib2to3_ex.py
View file @
31bd37c6
...
...
@@ -15,7 +15,6 @@ import setuptools
class
DistutilsRefactoringTool
(
RefactoringTool
):
def
log_error
(
self
,
msg
,
*
args
,
**
kw
):
log
.
error
(
msg
,
*
args
)
...
...
@@ -27,7 +26,6 @@ class DistutilsRefactoringTool(RefactoringTool):
class
Mixin2to3
(
_Mixin2to3
):
def
run_2to3
(
self
,
files
,
doctests
=
False
):
# See of the distribution option has been set, otherwise check the
# setuptools default.
...
...
setuptools/monkey.py
View file @
31bd37c6
...
...
@@ -13,7 +13,6 @@ from setuptools.extern import six
import
setuptools
__all__
=
[]
"""
Everything is private. Contact the project team
...
...
setuptools/msvc.py
View file @
31bd37c6
...
...
@@ -34,11 +34,13 @@ else:
Mock winreg and environ so the module can be imported
on this platform.
"""
class
winreg
:
HKEY_USERS
=
None
HKEY_CURRENT_USER
=
None
HKEY_LOCAL_MACHINE
=
None
HKEY_CLASSES_ROOT
=
None
safe_env
=
dict
()
try
:
...
...
@@ -458,6 +460,7 @@ class SystemInfo:
vc_ver: float
Required Microsoft Visual C++ version.
"""
# Variables and properties in this class use originals CamelCase variables
# names from Microsoft source files for more easy comparaison.
WinDir = safe_env.get('
WinDir
', '')
...
...
setuptools/package_index.py
View file @
31bd37c6
...
...
@@ -47,7 +47,6 @@ __all__ = [
_SOCKET_TIMEOUT = 15
_tmpl = "setuptools/{setuptools.__version__} Python-urllib/{py_major}"
user_agent = _tmpl.format(py_major=sys.version[:3], **globals())
...
...
@@ -198,9 +197,11 @@ def unique_values(func):
Wrap a function returning an iterable such that the resulting iterable
only ever yields unique items.
"""
@wraps(func)
def wrapper(*args, **kwargs):
return unique_everseen(func(*args, **kwargs))
return wrapper
...
...
@@ -415,6 +416,7 @@ class PackageIndex(Environment):
def process_index(self, url, page):
"""
Process
the
contents
of
a
PyPI
page
"""
def scan(link):
# Process a URL to see if it's for a package page
if link.startswith(self.index_url):
...
...
@@ -946,7 +948,9 @@ def socket_timeout(timeout=15):
return func(*args, **kwargs)
finally:
socket.setdefaulttimeout(old_timeout)
return _socket_timeout
return _socket_timeout
...
...
@@ -991,7 +995,6 @@ class Credential(object):
class PyPIConfig(configparser.RawConfigParser):
def __init__(self):
"""
Load
from
~/
.
pypirc
...
...
setuptools/py26compat.py
View file @
31bd37c6
...
...
@@ -23,9 +23,9 @@ def strip_fragment(url):
if
sys
.
version_info
>=
(
2
,
7
):
strip_fragment
=
lambda
x
:
x
try
:
from
importlib
import
import_module
except
ImportError
:
def
import_module
(
module_name
):
return
__import__
(
module_name
,
fromlist
=
[
'__name__'
])
setuptools/py27compat.py
View file @
31bd37c6
...
...
@@ -13,5 +13,6 @@ def get_all_headers(message, key):
if
sys
.
version_info
<
(
3
,):
def
get_all_headers
(
message
,
key
):
return
message
.
getheaders
(
key
)
setuptools/py31compat.py
View file @
31bd37c6
...
...
@@ -14,6 +14,7 @@ except ImportError:
raise
ValueError
(
"Name must be purelib or platlib"
)
return
get_python_lib
(
name
==
'platlib'
)
try
:
# Python >=3.2
from
tempfile
import
TemporaryDirectory
...
...
setuptools/sandbox.py
View file @
31bd37c6
...
...
@@ -99,6 +99,7 @@ class UnpickleableException(Exception):
"""
An exception representing another Exception that could not be pickled.
"""
@
staticmethod
def
dump
(
type
,
exc
):
"""
...
...
@@ -243,6 +244,7 @@ def run_setup(setup_script, args):
def runner():
ns = dict(__file__=setup_script, __name__='__main__')
_execfile(setup_script, ns)
DirectorySandbox(setup_dir).run(runner)
except SystemExit as v:
if v.args and v.args[0]:
...
...
@@ -301,6 +303,7 @@ class AbstractSandbox:
if self._active:
path = self._remap_input(name, path, *args, **kw)
return original(path, *args, **kw)
return wrap
if _file:
...
...
@@ -322,6 +325,7 @@ class AbstractSandbox:
path = self._remap_input(name, path, *args, **kw)
return self._remap_output(name, original(path, *args, **kw))
return original(path, *args, **kw)
return wrap
for name in ['readlink', 'tempnam']:
...
...
@@ -336,6 +340,7 @@ class AbstractSandbox:
if self._active:
return self._remap_output(name, retval)
return retval
return wrap
for name in ['getcwd', 'tmpnam']:
...
...
@@ -404,6 +409,7 @@ class DirectorySandbox(AbstractSandbox):
raise SandboxViolation(operation, args, kw)
if _file:
def _file(self, path, mode='r', *args, **kw):
if mode not in ('r', 'rt', 'rb', 'rU', 'U') and not self._ok(path):
self._violation("file", path, mode, *args, **kw)
...
...
setuptools/ssl_support.py
View file @
31bd37c6
...
...
@@ -29,7 +29,6 @@ cert_paths = """
/etc/ssl/ca-bundle.pem
"""
.
strip
().
split
()
try
:
HTTPSHandler
=
urllib
.
request
.
HTTPSHandler
HTTPSConnection
=
http_client
.
HTTPSConnection
...
...
@@ -50,10 +49,13 @@ except ImportError:
match_hostname
=
None
if
not
CertificateError
:
class
CertificateError
(
ValueError
):
pass
if
not
match_hostname
:
def
_dnsname_match
(
dn
,
hostname
,
max_wildcards
=
1
):
"""Matching according to RFC 6125, section 6.4.3
...
...
@@ -216,7 +218,6 @@ def get_win_certfile():
return None
class MyCertFile(CertFile):
def __init__(self, stores=(), certs=()):
CertFile.__init__(self)
for store in stores:
...
...
setuptools/tests/__init__.py
View file @
31bd37c6
...
...
@@ -42,7 +42,6 @@ needs_bytecode = pytest.mark.skipif(
class
TestDepends
:
def
testExtractConst
(
self
):
if
not
hasattr
(
dep
,
'extract_constant'
):
# skip on non-bytecode platforms
...
...
@@ -123,7 +122,6 @@ class TestDepends:
class
TestDistro
:
def
setup_method
(
self
,
method
):
self
.
e1
=
Extension
(
'bar.ext'
,
[
'bar.c'
])
self
.
e2
=
Extension
(
'c.y'
,
[
'y.c'
])
...
...
@@ -214,7 +212,6 @@ class TestDistro:
class
TestFeatures
:
def
setup_method
(
self
,
method
):
self
.
req
=
Require
(
'Distutils'
,
'1.0.3'
,
'distutils'
)
self
.
dist
=
makeSetup
(
...
...
@@ -292,7 +289,6 @@ class TestFeatures:
class
TestCommandTests
:
def
testTestIsCommand
(
self
):
test_cmd
=
makeSetup
().
get_command_obj
(
'test'
)
assert
(
isinstance
(
test_cmd
,
distutils
.
cmd
.
Command
))
...
...
setuptools/tests/server.py
View file @
31bd37c6
...
...
@@ -45,7 +45,6 @@ class IndexServer(BaseHTTPServer.HTTPServer):
class
RequestRecorder
(
BaseHTTPServer
.
BaseHTTPRequestHandler
):
def
do_GET
(
self
):
requests
=
vars
(
self
.
server
).
setdefault
(
'requests'
,
[])
requests
.
append
(
self
)
...
...
setuptools/tests/test_bdist_egg.py
View file @
31bd37c6
...
...
@@ -9,7 +9,6 @@ from setuptools.dist import Distribution
from
.
import
contexts
SETUP_PY
=
"""
\
from setuptools import setup
...
...
@@ -28,7 +27,6 @@ def setup_context(tmpdir):
class
Test
:
def
test_bdist_egg
(
self
,
setup_context
,
user_override
):
dist
=
Distribution
(
dict
(
script_name
=
'setup.py'
,
...
...
setuptools/tests/test_build_ext.py
View file @
31bd37c6
...
...
@@ -10,7 +10,6 @@ from setuptools.extension import Extension
class
TestBuildExt
:
def
test_get_ext_filename
(
self
):
"""
Setuptools needs to give back the same
...
...
setuptools/tests/test_develop.py
View file @
31bd37c6
...
...
@@ -13,7 +13,6 @@ from setuptools.command.develop import develop
from
setuptools.dist
import
Distribution
from
.
import
contexts
SETUP_PY
=
"""
\
from setuptools import setup
...
...
setuptools/tests/test_easy_install.py
View file @
31bd37c6
# -*- coding: utf-8 -*-
"""Easy install Tests
"""
from
__future__
import
absolute_import
...
...
@@ -42,7 +41,6 @@ from .textwrap import DALS
class
FakeDist
(
object
):
def
get_entry_map
(
self
,
group
):
if
group
!=
'console_scripts'
:
return
{}
...
...
@@ -60,7 +58,6 @@ SETUP_PY = DALS("""
class
TestEasyInstallTest
:
def
test_install_site_py
(
self
,
tmpdir
):
dist
=
Distribution
()
cmd
=
ei
.
easy_install
(
dist
)
...
...
@@ -194,7 +191,6 @@ class TestEasyInstallTest:
class
TestPTHFileWriter
:
def
test_add_from_cwd_site_sets_dirty
(
self
):
'''a pth file manager should set dirty
if a distribution is in site but also the cwd
...
...
@@ -328,13 +324,11 @@ def distutils_package():
class
TestDistutilsPackage
:
def
test_bdist_egg_available_on_distutils_pkg
(
self
,
distutils_package
):
run_setup
(
'setup.py'
,
[
'bdist_egg'
])
class
TestSetupRequires
:
def
test_setup_requires_honors_fetch_params
(
self
):
"""
When easy_install installs a source distribution which specifies
...
...
@@ -623,7 +617,6 @@ class TestScriptHeader:
class
TestCommandSpec
:
def
test_custom_launch_command
(
self
):
"""
Show how a custom CommandSpec could be used to specify a #! executable
...
...
@@ -659,7 +652,6 @@ class TestCommandSpec:
class
TestWindowsScriptWriter
:
def
test_header
(
self
):
hdr
=
ei
.
WindowsScriptWriter
.
get_script_header
(
''
)
assert
hdr
.
startswith
(
'#!'
)
...
...
setuptools/tests/test_egg_info.py
View file @
31bd37c6
...
...
@@ -262,7 +262,6 @@ class TestEggInfo(object):
def
_find_egg_info_files
(
self
,
root
):
class
DirList
(
list
):
def
__init__
(
self
,
files
,
base
):
super
(
DirList
,
self
).
__init__
(
files
)
self
.
base
=
base
...
...
setuptools/tests/test_find_packages.py
View file @
31bd37c6
...
...
@@ -38,7 +38,6 @@ def has_symlink():
class
TestFindPackages
:
def
setup_method
(
self
,
method
):
self
.
dist_dir
=
tempfile
.
mkdtemp
()
self
.
_make_pkg_structure
()
...
...
setuptools/tests/test_integration.py
View file @
31bd37c6
...
...
@@ -49,6 +49,7 @@ def install_context(request, tmpdir, monkeypatch):
user_base
.
remove
()
user_site
.
remove
()
install_dir
.
remove
()
request
.
addfinalizer
(
fin
)
# Change the environment and site settings to control where the
...
...
setuptools/tests/test_manifest.py
View file @
31bd37c6
...
...
@@ -30,7 +30,6 @@ SETUP_ATTRS = {
'packages'
:
[
'app'
],
}
SETUP_PY
=
"""
\
from setuptools import setup
...
...
@@ -95,7 +94,6 @@ def test_translated_pattern_test():
class TempDirTestCase(object):
def setup_method(self, method):
self.temp_dir = tempfile.mkdtemp()
self.old_cwd = os.getcwd()
...
...
@@ -107,14 +105,12 @@ class TempDirTestCase(object):
class TestManifestTest(TempDirTestCase):
def setup_method(self, method):
super(TestManifestTest, self).setup_method(method)
f = open(os.path.join(self.temp_dir, '
setup
.
py
'), '
w
')
f.write(SETUP_PY)
f.close()
"""
Create a file tree like:
- LICENSE
...
...
setuptools/tests/test_packageindex.py
View file @
31bd37c6
...
...
@@ -14,7 +14,6 @@ from .textwrap import DALS
class
TestPackageIndex
:
def
test_regex
(
self
):
hash_url
=
'http://other_url?:action=show_md5&'
hash_url
+=
'digest=0123456789abcdef0123456789abcdef'
...
...
@@ -184,7 +183,6 @@ class TestPackageIndex:
class
TestContentCheckers
:
def
test_md5
(
self
):
checker
=
setuptools
.
package_index
.
HashChecker
.
from_url
(
'http://foo/bar#md5=f12895fdffbd45007040d2e44df98478'
)
...
...
@@ -219,7 +217,6 @@ class TestContentCheckers:
class
TestPyPIConfig
:
def
test_percent_in_password
(
self
,
tmpdir
,
monkeypatch
):
monkeypatch
.
setitem
(
os
.
environ
,
'HOME'
,
str
(
tmpdir
))
pypirc
=
tmpdir
/
'.pypirc'
...
...
setuptools/tests/test_sandbox.py
View file @
31bd37c6
...
...
@@ -11,7 +11,6 @@ from setuptools.sandbox import DirectorySandbox
class
TestSandbox
:
def
test_devnull
(
self
,
tmpdir
):
sandbox
=
DirectorySandbox
(
str
(
tmpdir
))
sandbox
.
run
(
self
.
_file_writer
(
os
.
devnull
))
...
...
@@ -21,6 +20,7 @@ class TestSandbox:
def
do_write
():
with
open
(
path
,
'w'
)
as
f
:
f
.
write
(
'xxx'
)
return
do_write
def
test_win32com
(
self
,
tmpdir
):
...
...
@@ -57,7 +57,6 @@ class TestSandbox:
class
TestExceptionSaver
:
def
test_exception_trapped
(
self
):
with
setuptools
.
sandbox
.
ExceptionSaver
():
raise
ValueError
(
"details"
)
...
...
@@ -107,6 +106,7 @@ class TestExceptionSaver:
As revealed in #440, an infinite recursion can occur if an unpickleable
exception while setuptools is hidden. Ensure this doesn't happen.
"""
class
ExceptionUnderTest
(
Exception
):
"""
An unpickleable exception (not in globals).
...
...
@@ -126,10 +126,12 @@ class TestExceptionSaver:
should reflect a proper exception and not be wrapped in
an UnpickleableException.
"""
def
write_file
():
"Trigger a SandboxViolation by writing outside the sandbox"
with
open
(
'/etc/foo'
,
'w'
):
pass
sandbox
=
DirectorySandbox
(
str
(
tmpdir
))
with
pytest
.
raises
(
setuptools
.
sandbox
.
SandboxViolation
)
as
caught
:
with
setuptools
.
sandbox
.
save_modules
():
...
...
setuptools/tests/test_sdist.py
View file @
31bd37c6
...
...
@@ -20,10 +20,8 @@ from setuptools.command.egg_info import manifest_maker
from
setuptools.dist
import
Distribution
from
setuptools.tests
import
fail_on_ascii
py3_only
=
pytest
.
mark
.
xfail
(
six
.
PY2
,
reason
=
"Test runs on Python 3 only"
)
SETUP_ATTRS
=
{
'name'
:
'sdist_test'
,
'version'
:
'0.0'
,
...
...
@@ -31,14 +29,12 @@ SETUP_ATTRS = {
'package_data'
:
{
'sdist_test'
:
[
'*.txt'
]}
}
SETUP_PY
=
"""
\
from setuptools import setup
setup(**%r)
"""
%
SETUP_ATTRS
if
six
.
PY3
:
LATIN1_FILENAME
=
'smörbröd.py'
.
encode
(
'latin-1'
)
else
:
...
...
@@ -90,7 +86,6 @@ def read_all_bytes(filename):
class
TestSdistTest
:
def
setup_method
(
self
,
method
):
self
.
temp_dir
=
tempfile
.
mkdtemp
()
f
=
open
(
os
.
path
.
join
(
self
.
temp_dir
,
'setup.py'
),
'w'
)
...
...
setuptools/tests/test_test.py
View file @
31bd37c6
...
...
@@ -70,7 +70,6 @@ def sample_test(tmpdir_cwd):
@
pytest
.
mark
.
usefixtures
(
'user_override'
)
@
pytest
.
mark
.
usefixtures
(
'sample_test'
)
class
TestTestTest
:
def
test_test
(
self
):
params
=
dict
(
name
=
'foo'
,
...
...
setuptools/tests/test_upload_docs.py
View file @
31bd37c6
...
...
@@ -10,7 +10,6 @@ from setuptools.dist import Distribution
from
.textwrap
import
DALS
from
.
import
contexts
SETUP_PY
=
DALS
(
"""
from setuptools import setup
...
...
@@ -38,7 +37,6 @@ def sample_project(tmpdir_cwd):
@
pytest
.
mark
.
usefixtures
(
'sample_project'
)
@
pytest
.
mark
.
usefixtures
(
'user_override'
)
class
TestUploadDocsTest
:
def
test_create_zipfile
(
self
):
"""
Ensure zipfile creation handles common cases, including a folder
...
...
setuptools/tests/test_windows_wrappers.py
View file @
31bd37c6
...
...
@@ -23,12 +23,10 @@ import pytest
from
setuptools.command.easy_install
import
nt_quote_arg
import
pkg_resources
pytestmark
=
pytest
.
mark
.
skipif
(
sys
.
platform
!=
'win32'
,
reason
=
"Windows only"
)
class
WrapperTester
:
@
classmethod
def
prep_script
(
cls
,
template
):
python_exe
=
nt_quote_arg
(
sys
.
executable
)
...
...
tests/manual_test.py
View file @
31bd37c6
...
...
@@ -25,6 +25,7 @@ def tempdir(func):
finally
:
os
.
chdir
(
old_dir
)
shutil
.
rmtree
(
test_dir
)
return
_tempdir
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment