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