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
6d11e88f
Commit
6d11e88f
authored
Jul 12, 2016
by
stepshal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix quantity of blank lines after code object.
parent
e3e21fd3
Changes
37
Hide whitespace changes
Inline
Side-by-side
Showing
37 changed files
with
102 additions
and
32 deletions
+102
-32
bootstrap.py
bootstrap.py
+1
-0
pavement.py
pavement.py
+2
-0
setup.py
setup.py
+1
-0
setuptools/__init__.py
setuptools/__init__.py
+4
-0
setuptools/archive_util.py
setuptools/archive_util.py
+2
-0
setuptools/command/bdist_wininst.py
setuptools/command/bdist_wininst.py
+1
-0
setuptools/command/build_ext.py
setuptools/command/build_ext.py
+2
-0
setuptools/command/build_py.py
setuptools/command/build_py.py
+1
-0
setuptools/command/develop.py
setuptools/command/develop.py
+1
-0
setuptools/command/easy_install.py
setuptools/command/easy_install.py
+1
-0
setuptools/command/install_lib.py
setuptools/command/install_lib.py
+1
-0
setuptools/command/sdist.py
setuptools/command/sdist.py
+1
-0
setuptools/command/test.py
setuptools/command/test.py
+2
-0
setuptools/depends.py
setuptools/depends.py
+1
-3
setuptools/dist.py
setuptools/dist.py
+10
-3
setuptools/extension.py
setuptools/extension.py
+2
-0
setuptools/lib2to3_ex.py
setuptools/lib2to3_ex.py
+4
-0
setuptools/msvc.py
setuptools/msvc.py
+1
-0
setuptools/package_index.py
setuptools/package_index.py
+17
-0
setuptools/py26compat.py
setuptools/py26compat.py
+1
-0
setuptools/py27compat.py
setuptools/py27compat.py
+1
-0
setuptools/py31compat.py
setuptools/py31compat.py
+3
-0
setuptools/sandbox.py
setuptools/sandbox.py
+9
-25
setuptools/ssl_support.py
setuptools/ssl_support.py
+4
-0
setuptools/tests/__init__.py
setuptools/tests/__init__.py
+2
-0
setuptools/tests/py26compat.py
setuptools/tests/py26compat.py
+1
-0
setuptools/tests/server.py
setuptools/tests/server.py
+5
-0
setuptools/tests/test_bdist_egg.py
setuptools/tests/test_bdist_egg.py
+1
-0
setuptools/tests/test_build_ext.py
setuptools/tests/test_build_ext.py
+2
-0
setuptools/tests/test_develop.py
setuptools/tests/test_develop.py
+2
-0
setuptools/tests/test_easy_install.py
setuptools/tests/test_easy_install.py
+6
-0
setuptools/tests/test_egg_info.py
setuptools/tests/test_egg_info.py
+1
-0
setuptools/tests/test_find_packages.py
setuptools/tests/test_find_packages.py
+4
-0
setuptools/tests/test_packageindex.py
setuptools/tests/test_packageindex.py
+1
-0
setuptools/tests/test_sandbox.py
setuptools/tests/test_sandbox.py
+1
-0
setuptools/tests/test_sdist.py
setuptools/tests/test_sdist.py
+0
-1
tests/manual_test.py
tests/manual_test.py
+3
-0
No files found.
bootstrap.py
View file @
6d11e88f
...
...
@@ -27,6 +27,7 @@ minimal_egg_info = textwrap.dedent("""
requires.txt = setuptools.command.egg_info:write_requirements
"""
)
def
ensure_egg_info
():
if
os
.
path
.
exists
(
'setuptools.egg-info'
):
return
...
...
pavement.py
View file @
6d11e88f
...
...
@@ -3,10 +3,12 @@ import re
from
paver.easy
import
task
,
path
as
Path
import
pip
def
remove_all
(
paths
):
for
path
in
paths
:
path
.
rmtree
()
if
path
.
isdir
()
else
path
.
remove
()
@
task
def
update_vendored
():
vendor
=
Path
(
'pkg_resources/_vendor'
)
...
...
setup.py
View file @
6d11e88f
...
...
@@ -26,6 +26,7 @@ import setuptools
scripts
=
[]
def
_gen_console_scripts
():
yield
"easy_install = setuptools.command.easy_install:main"
...
...
setuptools/__init__.py
View file @
6d11e88f
...
...
@@ -32,6 +32,7 @@ lib2to3_fixer_packages = ['lib2to3.fixes']
class
PackageFinder
(
object
):
@
classmethod
def
find
(
cls
,
where
=
'.'
,
exclude
=
(),
include
=
(
'*'
,)):
"""Return a list all Python packages found within directory 'where'
...
...
@@ -108,7 +109,9 @@ class PackageFinder(object):
"""
return
lambda
name
:
any
(
fnmatchcase
(
name
,
pat
=
pat
)
for
pat
in
patterns
)
class
PEP420PackageFinder
(
PackageFinder
):
@
staticmethod
def
_looks_like_package
(
path
):
return
True
...
...
@@ -119,6 +122,7 @@ setup = distutils.core.setup
_Command
=
_get_unpatched
(
_Command
)
class
Command
(
_Command
):
__doc__
=
_Command
.
__doc__
...
...
setuptools/archive_util.py
View file @
6d11e88f
...
...
@@ -15,9 +15,11 @@ import contextlib
from
pkg_resources
import
ensure_directory
,
ContextualZipFile
from
distutils.errors
import
DistutilsError
class
UnrecognizedFormat
(
DistutilsError
):
"""Couldn't recognize the archive type"""
def
default_filter
(
src
,
dst
):
"""The default progress/filter callback; returns True for all files"""
return
dst
...
...
setuptools/command/bdist_wininst.py
View file @
6d11e88f
...
...
@@ -2,6 +2,7 @@ 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 @
6d11e88f
...
...
@@ -59,7 +59,9 @@ elif os.name != 'nt':
if_dl
=
lambda
s
:
s
if
have_rtld
else
''
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/build_py.py
View file @
6d11e88f
...
...
@@ -15,6 +15,7 @@ try:
from
setuptools.lib2to3_ex
import
Mixin2to3
except
ImportError
:
class
Mixin2to3
:
def
run_2to3
(
self
,
files
,
doctests
=
True
):
"do nothing"
...
...
setuptools/command/develop.py
View file @
6d11e88f
...
...
@@ -186,6 +186,7 @@ class VersionlessRequirement(object):
>>> str(adapted_dist.as_requirement())
'foo'
"""
def
__init__
(
self
,
dist
):
self
.
__dist
=
dist
...
...
setuptools/command/easy_install.py
View file @
6d11e88f
...
...
@@ -2158,6 +2158,7 @@ class WindowsScriptWriter(ScriptWriter):
class
WindowsExecutableLauncherWriter
(
WindowsScriptWriter
):
@
classmethod
def
_get_script_args
(
cls
,
type_
,
name
,
header
,
script_text
):
"""
...
...
setuptools/command/install_lib.py
View file @
6d11e88f
...
...
@@ -3,6 +3,7 @@ import imp
from
itertools
import
product
,
starmap
import
distutils.command.install_lib
as
orig
class
install_lib
(
orig
.
install_lib
):
"""Don't add compiled flags to filenames of non-Python files"""
...
...
setuptools/command/sdist.py
View file @
6d11e88f
...
...
@@ -15,6 +15,7 @@ READMES = 'README', 'README.rst', 'README.txt'
_default_revctrl
=
list
def
walk_revctrl
(
dirname
=
''
):
"""Find all files under revision control"""
for
ep
in
pkg_resources
.
iter_entry_points
(
'setuptools.file_finders'
):
...
...
setuptools/command/test.py
View file @
6d11e88f
...
...
@@ -14,6 +14,7 @@ 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
...
...
@@ -46,6 +47,7 @@ class ScanningLoader(TestLoader):
# adapted from jaraco.classes.properties:NonDataProperty
class
NonDataProperty
(
object
):
def
__init__
(
self
,
fget
):
self
.
fget
=
fget
...
...
setuptools/depends.py
View file @
6d11e88f
...
...
@@ -10,6 +10,7 @@ __all__ = [
'Require'
,
'find_module'
,
'get_module_constant'
,
'extract_constant'
]
class
Require
:
"""A prerequisite to building or installing a distribution"""
...
...
@@ -39,7 +40,6 @@ class Require:
str
(
version
)
!=
"unknown"
and
version
>=
self
.
requested_version
def
get_version
(
self
,
paths
=
None
,
default
=
"unknown"
):
"""Get version number of installed module, 'None', or 'default'
Search 'paths' for module. If not found, return 'None'. If found,
...
...
@@ -78,7 +78,6 @@ class Require:
def
_iter_code
(
code
):
"""Yield '(op,arg)' pair for each operation in code object 'code'"""
from
array
import
array
...
...
@@ -131,7 +130,6 @@ def find_module(module, paths=None):
def
get_module_constant
(
module
,
symbol
,
default
=-
1
,
paths
=
None
):
"""Find 'module' by searching 'paths', and extract 'symbol'
Return 'None' if 'module' does not exist on 'paths', or it does not define
...
...
setuptools/dist.py
View file @
6d11e88f
...
...
@@ -38,6 +38,7 @@ def _get_unpatched(cls):
_Distribution
=
_get_unpatched
(
_Distribution
)
def
_patch_distribution_metadata_write_pkg_info
():
"""
Workaround issue #197 - Python 3 prior to 3.2.2 uses an environment-local
...
...
@@ -61,6 +62,7 @@ _patch_distribution_metadata_write_pkg_info()
sequence
=
tuple
,
list
def
check_importable
(
dist
,
attr
,
value
):
try
:
ep
=
pkg_resources
.
EntryPoint
.
parse
(
'x='
+
value
)
...
...
@@ -80,6 +82,8 @@ def assert_string_list(dist, attr, value):
raise
DistutilsSetupError
(
"%r must be a list of strings (got %r)"
%
(
attr
,
value
)
)
def
check_nsp
(
dist
,
attr
,
value
):
"""Verify that namespace packages are valid"""
assert_string_list
(
dist
,
attr
,
value
)
...
...
@@ -97,6 +101,7 @@ def check_nsp(dist, attr, value):
" is not: please correct this in setup.py"
,
nsp
,
parent
)
def
check_extras
(
dist
,
attr
,
value
):
"""Verify that extras_require mapping is valid"""
try
:
...
...
@@ -113,6 +118,7 @@ def check_extras(dist, attr, value):
"requirement specifiers."
)
def
assert_bool
(
dist
,
attr
,
value
):
"""Verify that value is True, False, 0, or 1"""
if
bool
(
value
)
!=
value
:
...
...
@@ -131,6 +137,7 @@ def check_requirements(dist, attr, value):
)
raise
DistutilsSetupError
(
tmpl
.
format
(
attr
=
attr
,
error
=
error
))
def
check_entry_points
(
dist
,
attr
,
value
):
"""Verify that entry_points map is parseable"""
try
:
...
...
@@ -138,10 +145,12 @@ def check_entry_points(dist, attr, value):
except
ValueError
as
e
:
raise
DistutilsSetupError
(
e
)
def
check_test_suite
(
dist
,
attr
,
value
):
if
not
isinstance
(
value
,
six
.
string_types
):
raise
DistutilsSetupError
(
"test_suite must be a string"
)
def
check_package_data
(
dist
,
attr
,
value
):
"""Verify that value is a dictionary of package names to glob lists"""
if
isinstance
(
value
,
dict
):
...
...
@@ -157,6 +166,7 @@ def check_package_data(dist, attr, value):
"wildcard patterns"
)
def
check_packages
(
dist
,
attr
,
value
):
for
pkgname
in
value
:
if
not
re
.
match
(
r'\
w+(
\.\
w+)*
', pkgname):
...
...
@@ -815,7 +825,6 @@ class Feature:
return
self
.
available
and
self
.
standard
def
include_in
(
self
,
dist
):
"""Ensure feature and its requirements are included in distribution
You may override this in a subclass to perform additional operations on
...
...
@@ -836,7 +845,6 @@ class Feature:
dist
.
include_feature
(
f
)
def
exclude_from
(
self
,
dist
):
"""Ensure feature is excluded from distribution
You may override this in a subclass to perform additional operations on
...
...
@@ -852,7 +860,6 @@ class Feature:
dist
.
exclude_package
(
item
)
def
validate
(
self
,
dist
):
"""Verify that feature makes sense in context of distribution
This method is called by the distribution just before it parses its
...
...
setuptools/extension.py
View file @
6d11e88f
...
...
@@ -14,6 +14,7 @@ _Extension = _get_unpatched(distutils.core.Extension)
msvc
.
patch_for_specialized_compiler
()
def
_have_cython
():
"""
Return True if Cython can be imported.
...
...
@@ -48,6 +49,7 @@ class Extension(_Extension):
sub
=
functools
.
partial
(
re
.
sub
,
'.pyx$'
,
target_ext
)
self
.
sources
=
list
(
map
(
sub
,
self
.
sources
))
class
Library
(
Extension
):
"""Just like a regular Extension, but built as a library instead"""
...
...
setuptools/lib2to3_ex.py
View file @
6d11e88f
...
...
@@ -12,7 +12,9 @@ from distutils import log
from
lib2to3.refactor
import
RefactoringTool
,
get_fixers_from_package
import
setuptools
class
DistutilsRefactoringTool
(
RefactoringTool
):
def
log_error
(
self
,
msg
,
*
args
,
**
kw
):
log
.
error
(
msg
,
*
args
)
...
...
@@ -22,7 +24,9 @@ class DistutilsRefactoringTool(RefactoringTool):
def
log_debug
(
self
,
msg
,
*
args
):
log
.
debug
(
msg
,
*
args
)
class
Mixin2to3
(
_Mixin2to3
):
def
run_2to3
(
self
,
files
,
doctests
=
False
):
# See of the distribution option has been set, otherwise check the
# setuptools default.
...
...
setuptools/msvc.py
View file @
6d11e88f
...
...
@@ -769,6 +769,7 @@ class EnvironmentInfo:
"""
# Variables and properties in this class use originals CamelCase variables
# names from Microsoft source files for more easy comparaison.
def
__init__
(
self
,
arch
,
vc_ver
=
None
,
vc_min_ver
=
None
):
self
.
pi
=
PlatformInfo
(
arch
)
self
.
ri
=
RegistryInfo
(
self
.
pi
)
...
...
setuptools/package_index.py
View file @
6d11e88f
...
...
@@ -85,6 +85,7 @@ def egg_info_for_url(url):
if '
#' in base: base, fragment = base.split('#',1)
return
base
,
fragment
def
distros_for_url
(
url
,
metadata
=
None
):
"""Yield egg or source distribution objects that might be found at a URL"""
base
,
fragment
=
egg_info_for_url
(
url
)
...
...
@@ -97,6 +98,7 @@ def distros_for_url(url, metadata=None):
):
yield
dist
def
distros_for_location
(
location
,
basename
,
metadata
=
None
):
"""Yield egg or source distribution objects based on basename"""
if
basename
.
endswith
(
'.egg.zip'
):
...
...
@@ -118,6 +120,7 @@ def distros_for_location(location, basename, metadata=None):
return
interpret_distro_name
(
location
,
basename
,
metadata
)
return
[]
# no extension matched
def
distros_for_filename
(
filename
,
metadata
=
None
):
"""Yield possible egg or source distribution objects based on a filename"""
return
distros_for_location
(
...
...
@@ -177,6 +180,7 @@ def unique_everseen(iterable, key=None):
seen_add(k)
yield element
def unique_values(func):
"""
Wrap a function returning an iterable such that the resulting iterable
...
...
@@ -190,6 +194,7 @@ def unique_values(func):
REL = re.compile("""<([^>]*
\
s
r
el
\
s*=
\
s*['"]?([^'"
>
]
+
)[
^>
]
*
)
>
""", re.I)
# this line is here to fix emacs' cruddy broken syntax highlighting
@unique_values
def find_external_links(url, page):
"""
Find
rel
=
"homepage"
and
rel
=
"download"
links
in
`page`
,
yielding
URLs
"""
...
...
@@ -213,6 +218,7 @@ class ContentChecker(object):
"""
A
null
content
checker
that
defines
the
interface
for
checking
content
"""
def feed(self, block):
"""
Feed
a
block
of
data
to
the
hash
.
...
...
@@ -232,6 +238,7 @@ class ContentChecker(object):
"""
return
class HashChecker(ContentChecker):
pattern = re.compile(
r'(?P<hash_name>sha1|sha224|sha384|sha256|sha512|md5)='
...
...
@@ -672,6 +679,7 @@ class PackageIndex(Environment):
)
dl_blocksize = 8192
def _download_to(self, url, filename):
self.info("Downloading %s", url)
# Download the file
...
...
@@ -883,12 +891,14 @@ class PackageIndex(Environment):
# references, a hexadecimal numeric reference, or a named reference).
entity_sub = re.compile(r'&(#(
\
d+|x[
\
da-fA-F]+)|[
\
w.:-]+);?
'
).sub
def uchr(c):
if not isinstance(c, int):
return c
if c>255: return six.unichr(c)
return chr(c)
def decode_entity(match):
what = match.group(1)
if what.startswith('#x'):
...
...
@@ -899,10 +909,12 @@ def decode_entity(match):
what = six.moves.html_entities.name2codepoint.get(what, match.group(0))
return uchr(what)
def htmldecode(text):
"""
Decode
HTML
entities
in
the
given
text
.
"""
return entity_sub(decode_entity, text)
def socket_timeout(timeout=15):
def _socket_timeout(func):
def _socket_timeout(*args, **kwargs):
...
...
@@ -915,6 +927,7 @@ def socket_timeout(timeout=15):
return _socket_timeout
return _socket_timeout
def _encode_auth(auth):
"""
A
function
compatible
with
Python
2.3
-
3.3
that
will
encode
...
...
@@ -937,10 +950,12 @@ def _encode_auth(auth):
# strip the trailing carriage return
return encoded.replace('
\
n
','')
class Credential(object):
"""
A
username
/
password
pair
.
Use
like
a
namedtuple
.
"""
def __init__(self, username, password):
self.username = username
self.password = password
...
...
@@ -952,6 +967,7 @@ class Credential(object):
def __str__(self):
return '%(username)s:%(password)s' % vars(self)
class PyPIConfig(configparser.RawConfigParser):
def __init__(self):
...
...
@@ -1042,6 +1058,7 @@ open_with_auth = socket_timeout(_SOCKET_TIMEOUT)(open_with_auth)
def fix_sf_url(url):
return url # backward compatibility
def local_open(url):
"""
Read
a
local
path
,
with
special
support
for
directories
"""
scheme, server, path, param, query, frag = urllib.parse.urlparse(url)
...
...
setuptools/py26compat.py
View file @
6d11e88f
...
...
@@ -9,6 +9,7 @@ try:
except
ImportError
:
from
urllib
import
splittag
def
strip_fragment
(
url
):
"""
In `Python 8280 <http://bugs.python.org/issue8280>`_, Python 2.7 and
...
...
setuptools/py27compat.py
View file @
6d11e88f
...
...
@@ -4,6 +4,7 @@ Compatibility Support for Python 2.7 and earlier
import
sys
def
get_all_headers
(
message
,
key
):
"""
Given an HTTPMessage, return all headers matching a given key.
...
...
setuptools/py31compat.py
View file @
6d11e88f
...
...
@@ -8,6 +8,7 @@ try:
from
sysconfig
import
get_config_vars
,
get_path
except
ImportError
:
from
distutils.sysconfig
import
get_config_vars
,
get_python_lib
def
get_path
(
name
):
if
name
not
in
(
'platlib'
,
'purelib'
):
raise
ValueError
(
"Name must be purelib or platlib"
)
...
...
@@ -19,12 +20,14 @@ try:
except
ImportError
:
import
shutil
import
tempfile
class
TemporaryDirectory
(
object
):
"""
Very simple temporary directory context manager.
Will try to delete afterward, but will also ignore OS and similar
errors on deletion.
"""
def
__init__
(
self
):
self
.
name
=
None
# Handle mkdtemp raising an exception
self
.
name
=
tempfile
.
mkdtemp
()
...
...
setuptools/sandbox.py
View file @
6d11e88f
...
...
@@ -29,6 +29,7 @@ __all__ = [
"AbstractSandbox"
,
"DirectorySandbox"
,
"SandboxViolation"
,
"run_setup"
,
]
def
_execfile
(
filename
,
globals
,
locals
=
None
):
"""
Python 3 implementation of execfile.
...
...
@@ -117,6 +118,7 @@ class ExceptionSaver:
A Context Manager that will save an exception, serialized, and restore it
later.
"""
def
__enter__
(
self
):
return
self
...
...
@@ -237,6 +239,7 @@ def run_setup(setup_script, args):
# reset to include setup dir, w/clean callback list
working_set.__init__()
working_set.callbacks.append(lambda dist:dist.activate())
def runner():
ns = dict(__file__=setup_script, __name__='__main__')
_execfile(setup_script, ns)
...
...
@@ -280,6 +283,7 @@ class AbstractSandbox:
def _mk_dual_path_wrapper(name):
original = getattr(_os,name)
def wrap(self,src,dst,*args,**kw):
if self._active:
src,dst = self._remap_pair(name,src,dst,*args,**kw)
...
...
@@ -291,6 +295,7 @@ class AbstractSandbox:
def _mk_single_path_wrapper(name, original=None):
original = original or getattr(_os,name)
def wrap(self,path,*args,**kw):
if self._active:
path = self._remap_input(name,path,*args,**kw)
...
...
@@ -309,6 +314,7 @@ class AbstractSandbox:
def _mk_single_with_return(name):
original = getattr(_os,name)
def wrap(self,path,*args,**kw):
if self._active:
path = self._remap_input(name,path,*args,**kw)
...
...
@@ -321,6 +327,7 @@ class AbstractSandbox:
def _mk_query(name):
original = getattr(_os,name)
def wrap(self,*args,**kw):
retval = original(*args,**kw)
if self._active:
...
...
@@ -364,6 +371,7 @@ except ImportError:
# it appears pywin32 is not installed, so no need to exclude.
pass
class DirectorySandbox(AbstractSandbox):
"""
Restrict
operations
to
a
single
subdirectory
-
pseudo
-
chroot
"""
...
...
@@ -453,6 +461,7 @@ WRITE_FLAGS = functools.reduce(
"O_WRONLY O_RDWR O_APPEND O_CREAT O_TRUNC O_TEMPORARY".split()]
)
class SandboxViolation(DistutilsError):
"""
A
setup
script
attempted
to
modify
the
filesystem
outside
the
sandbox
"""
...
...
@@ -468,29 +477,4 @@ script by hand. Please inform the package's author and the EasyInstall
maintainers to find out if a fix or workaround is available.""" % self.args
#
setuptools/ssl_support.py
View file @
6d11e88f
...
...
@@ -161,6 +161,7 @@ class VerifyingHTTPSHandler(HTTPSHandler):
class VerifyingHTTPSConn(HTTPSConnection):
"""Simple verifying connection: no auth, subclasses, timeouts, etc."""
def __init__(self, host, ca_bundle, **kw):
HTTPSConnection.__init__(self, host, **kw)
self.ca_bundle = ca_bundle
...
...
@@ -192,6 +193,7 @@ class VerifyingHTTPSConn(HTTPSConnection):
self.sock.close()
raise
def opener_for(ca_bundle=None):
"""Get a urlopen() replacement that uses ca_bundle for verification"""
return urllib.request.build_opener(
...
...
@@ -201,6 +203,7 @@ def opener_for(ca_bundle=None):
_wincerts = None
def get_win_certfile():
global _wincerts
if _wincerts is not None:
...
...
@@ -212,6 +215,7 @@ 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 @
6d11e88f
...
...
@@ -40,6 +40,7 @@ needs_bytecode = pytest.mark.skipif(
reason
=
"bytecode support not available"
,
)
class
TestDepends
:
def
testExtractConst
(
self
):
...
...
@@ -289,6 +290,7 @@ class TestFeatures:
with
pytest
.
raises
(
SystemExit
):
makeSetup
(
features
=
{
'x'
:
Feature
(
'x'
,
remove
=
'y'
)})
class
TestCommandTests
:
def
testTestIsCommand
(
self
):
...
...
setuptools/tests/py26compat.py
View file @
6d11e88f
...
...
@@ -2,6 +2,7 @@ import sys
import
tarfile
import
contextlib
def
_tarfile_open_ex
(
*
args
,
**
kwargs
):
"""
Extend result as a context manager.
...
...
setuptools/tests/server.py
View file @
6d11e88f
...
...
@@ -18,6 +18,7 @@ class IndexServer(BaseHTTPServer.HTTPServer):
# The index files should be located in setuptools/tests/indexes
s.stop()
"""
def
__init__
(
self
,
server_address
=
(
''
,
0
),
RequestHandlerClass
=
SimpleHTTPServer
.
SimpleHTTPRequestHandler
):
BaseHTTPServer
.
HTTPServer
.
__init__
(
self
,
server_address
,
...
...
@@ -42,16 +43,20 @@ class IndexServer(BaseHTTPServer.HTTPServer):
port
=
self
.
server_port
return
'http://127.0.0.1:%s/setuptools/tests/indexes/'
%
port
class
RequestRecorder
(
BaseHTTPServer
.
BaseHTTPRequestHandler
):
def
do_GET
(
self
):
requests
=
vars
(
self
.
server
).
setdefault
(
'requests'
,
[])
requests
.
append
(
self
)
self
.
send_response
(
200
,
'OK'
)
class
MockServer
(
BaseHTTPServer
.
HTTPServer
,
threading
.
Thread
):
"""
A simple HTTP Server that records the requests made to it.
"""
def
__init__
(
self
,
server_address
=
(
''
,
0
),
RequestHandlerClass
=
RequestRecorder
):
BaseHTTPServer
.
HTTPServer
.
__init__
(
self
,
server_address
,
...
...
setuptools/tests/test_bdist_egg.py
View file @
6d11e88f
...
...
@@ -15,6 +15,7 @@ from setuptools import setup
setup(name='foo', py_modules=['hi'])
"""
@
pytest
.
yield_fixture
def
setup_context
(
tmpdir
):
with
(
tmpdir
/
'setup.py'
).
open
(
'w'
)
as
f
:
...
...
setuptools/tests/test_build_ext.py
View file @
6d11e88f
...
...
@@ -3,7 +3,9 @@ import distutils.command.build_ext as orig
from
setuptools.command.build_ext
import
build_ext
from
setuptools.dist
import
Distribution
class
TestBuildExt
:
def
test_get_ext_filename
(
self
):
"""
Setuptools needs to give back the same
...
...
setuptools/tests/test_develop.py
View file @
6d11e88f
...
...
@@ -26,6 +26,7 @@ setup(name='foo',
INIT_PY
=
"""print "foo"
"""
@
pytest
.
yield_fixture
def
temp_user
(
monkeypatch
):
with
contexts
.
tempdir
()
as
user_base
:
...
...
@@ -54,6 +55,7 @@ def test_env(tmpdir, temp_user):
class
TestDevelop
:
in_virtualenv
=
hasattr
(
sys
,
'real_prefix'
)
in_venv
=
hasattr
(
sys
,
'base_prefix'
)
and
sys
.
base_prefix
!=
sys
.
prefix
@
pytest
.
mark
.
skipif
(
in_virtualenv
or
in_venv
,
reason
=
"Cannot run when invoked in a virtualenv or venv"
)
def
test_2to3_user_mode
(
self
,
test_env
):
...
...
setuptools/tests/test_easy_install.py
View file @
6d11e88f
...
...
@@ -41,6 +41,7 @@ from .textwrap import DALS
class
FakeDist
(
object
):
def
get_entry_map
(
self
,
group
):
if
group
!=
'console_scripts'
:
return
{}
...
...
@@ -55,6 +56,7 @@ SETUP_PY = DALS("""
setup(name='foo')
"""
)
class
TestEasyInstallTest
:
def
test_install_site_py
(
self
,
tmpdir
):
...
...
@@ -133,6 +135,7 @@ 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
...
...
@@ -266,6 +269,7 @@ def distutils_package():
class
TestDistutilsPackage
:
def
test_bdist_egg_available_on_distutils_pkg
(
self
,
distutils_package
):
run_setup
(
'setup.py'
,
[
'bdist_egg'
])
...
...
@@ -557,6 +561,7 @@ class TestScriptHeader:
class
TestCommandSpec
:
def
test_custom_launch_command
(
self
):
"""
Show how a custom CommandSpec could be used to specify a #! executable
...
...
@@ -601,6 +606,7 @@ 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 @
6d11e88f
...
...
@@ -235,6 +235,7 @@ 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 @
6d11e88f
...
...
@@ -13,6 +13,8 @@ from setuptools import find_packages
find_420_packages
=
setuptools
.
PEP420PackageFinder
.
find
# modeled after CPython's test.support.can_symlink
def
can_symlink
():
TESTFN
=
tempfile
.
mktemp
()
symlink_path
=
TESTFN
+
"can_symlink"
...
...
@@ -26,6 +28,7 @@ def can_symlink():
globals
().
update
(
can_symlink
=
lambda
:
can
)
return
can
def
has_symlink
():
bad_symlink
=
(
# Windows symlink directory detection is broken on Python 3.2
...
...
@@ -33,6 +36,7 @@ def has_symlink():
)
return
can_symlink
()
and
not
bad_symlink
class
TestFindPackages
:
def
setup_method
(
self
,
method
):
...
...
setuptools/tests/test_packageindex.py
View file @
6d11e88f
...
...
@@ -209,6 +209,7 @@ 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 @
6d11e88f
...
...
@@ -57,6 +57,7 @@ class TestSandbox:
class
TestExceptionSaver
:
def
test_exception_trapped
(
self
):
with
setuptools
.
sandbox
.
ExceptionSaver
():
raise
ValueError
(
"details"
)
...
...
setuptools/tests/test_sdist.py
View file @
6d11e88f
...
...
@@ -132,7 +132,6 @@ class TestSdistTest:
assert
os
.
path
.
join
(
'sdist_test'
,
'b.txt'
)
in
manifest
assert
os
.
path
.
join
(
'sdist_test'
,
'c.rst'
)
not
in
manifest
def
test_defaults_case_sensitivity
(
self
):
"""
Make sure default files (README.*, etc.) are added in a case-sensitive
...
...
tests/manual_test.py
View file @
6d11e88f
...
...
@@ -10,9 +10,11 @@ from string import Template
from
six.moves
import
urllib
def
_system_call
(
*
args
):
assert
subprocess
.
call
(
args
)
==
0
def
tempdir
(
func
):
def
_tempdir
(
*
args
,
**
kwargs
):
test_dir
=
tempfile
.
mkdtemp
()
...
...
@@ -62,6 +64,7 @@ def test_virtualenv():
res
=
f
.
read
()
assert
'setuptools'
in
res
@
tempdir
def
test_full
():
"""virtualenv + pip + buildout"""
...
...
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