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
f749ccab
Commit
f749ccab
authored
Jul 14, 2016
by
stepshal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add missing whitespace.
parent
45de6ea8
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
190 additions
and
190 deletions
+190
-190
setuptools/archive_util.py
setuptools/archive_util.py
+1
-1
setuptools/depends.py
setuptools/depends.py
+6
-6
setuptools/dist.py
setuptools/dist.py
+68
-68
setuptools/package_index.py
setuptools/package_index.py
+37
-37
setuptools/py26compat.py
setuptools/py26compat.py
+1
-1
setuptools/sandbox.py
setuptools/sandbox.py
+34
-34
setuptools/site-patch.py
setuptools/site-patch.py
+5
-5
setuptools/tests/__init__.py
setuptools/tests/__init__.py
+36
-36
setuptools/tests/contexts.py
setuptools/tests/contexts.py
+1
-1
setuptools/tests/test_find_packages.py
setuptools/tests/test_find_packages.py
+1
-1
No files found.
setuptools/archive_util.py
View file @
f749ccab
...
@@ -20,7 +20,7 @@ class UnrecognizedFormat(DistutilsError):
...
@@ -20,7 +20,7 @@ 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/depends.py
View file @
f749ccab
...
@@ -31,7 +31,7 @@ class Require:
...
@@ -31,7 +31,7 @@ class Require:
def
full_name
(
self
):
def
full_name
(
self
):
"""Return full package/distribution name, w/version"""
"""Return full package/distribution name, w/version"""
if
self
.
requested_version
is
not
None
:
if
self
.
requested_version
is
not
None
:
return
'%s-%s'
%
(
self
.
name
,
self
.
requested_version
)
return
'%s-%s'
%
(
self
.
name
,
self
.
requested_version
)
return
self
.
name
return
self
.
name
def
version_ok
(
self
,
version
):
def
version_ok
(
self
,
version
):
...
@@ -52,7 +52,7 @@ class Require:
...
@@ -52,7 +52,7 @@ class Require:
if
self
.
attribute
is
None
:
if
self
.
attribute
is
None
:
try
:
try
:
f
,
p
,
i
=
find_module
(
self
.
module
,
paths
)
f
,
p
,
i
=
find_module
(
self
.
module
,
paths
)
if
f
:
f
.
close
()
if
f
:
f
.
close
()
return
default
return
default
except
ImportError
:
except
ImportError
:
...
@@ -83,7 +83,7 @@ def _iter_code(code):
...
@@ -83,7 +83,7 @@ def _iter_code(code):
from
array
import
array
from
array
import
array
from
dis
import
HAVE_ARGUMENT
,
EXTENDED_ARG
from
dis
import
HAVE_ARGUMENT
,
EXTENDED_ARG
bytes
=
array
(
'b'
,
code
.
co_code
)
bytes
=
array
(
'b'
,
code
.
co_code
)
eof
=
len
(
code
.
co_code
)
eof
=
len
(
code
.
co_code
)
ptr
=
0
ptr
=
0
...
@@ -107,7 +107,7 @@ def _iter_code(code):
...
@@ -107,7 +107,7 @@ def _iter_code(code):
arg
=
None
arg
=
None
ptr
+=
1
ptr
+=
1
yield
op
,
arg
yield
op
,
arg
def
find_module
(
module
,
paths
=
None
):
def
find_module
(
module
,
paths
=
None
):
...
@@ -117,14 +117,14 @@ def find_module(module, paths=None):
...
@@ -117,14 +117,14 @@ def find_module(module, paths=None):
while
parts
:
while
parts
:
part
=
parts
.
pop
(
0
)
part
=
parts
.
pop
(
0
)
f
,
path
,
(
suffix
,
mode
,
kind
)
=
info
=
imp
.
find_module
(
part
,
paths
)
f
,
path
,
(
suffix
,
mode
,
kind
)
=
info
=
imp
.
find_module
(
part
,
paths
)
if
kind
==
PKG_DIRECTORY
:
if
kind
==
PKG_DIRECTORY
:
parts
=
parts
or
[
'__init__'
]
parts
=
parts
or
[
'__init__'
]
paths
=
[
path
]
paths
=
[
path
]
elif
parts
:
elif
parts
:
raise
ImportError
(
"Can't find %r in %s"
%
(
parts
,
module
))
raise
ImportError
(
"Can't find %r in %s"
%
(
parts
,
module
))
return
info
return
info
...
...
setuptools/dist.py
View file @
f749ccab
This diff is collapsed.
Click to expand it.
setuptools/package_index.py
View file @
f749ccab
This diff is collapsed.
Click to expand it.
setuptools/py26compat.py
View file @
f749ccab
...
@@ -19,5 +19,5 @@ def strip_fragment(url):
...
@@ -19,5 +19,5 @@ def strip_fragment(url):
url
,
fragment
=
splittag
(
url
)
url
,
fragment
=
splittag
(
url
)
return
url
return
url
if
sys
.
version_info
>=
(
2
,
7
):
if
sys
.
version_info
>=
(
2
,
7
):
strip_fragment
=
lambda
x
:
x
strip_fragment
=
lambda
x
:
x
setuptools/sandbox.py
View file @
f749ccab
...
@@ -238,7 +238,7 @@ def run_setup(setup_script, args):
...
@@ -238,7 +238,7 @@ def run_setup(setup_script, args):
sys.path.insert(0, setup_dir)
sys.path.insert(0, setup_dir)
# 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__')
...
@@ -258,12 +258,12 @@ class AbstractSandbox:
...
@@ -258,12 +258,12 @@ class AbstractSandbox:
def __init__(self):
def __init__(self):
self._attrs = [
self._attrs = [
name for name in dir(_os)
name for name in dir(_os)
if not name.startswith('_') and hasattr(self,name)
if not name.startswith('_') and hasattr(self,
name)
]
]
def _copy(self, source):
def _copy(self, source):
for name in self._attrs:
for name in self._attrs:
setattr(os, name, getattr(source,name))
setattr(os, name, getattr(source,
name))
def run(self, func):
def run(self, func):
"""
Run
'func'
under
os
sandboxing
"""
"""
Run
'func'
under
os
sandboxing
"""
...
@@ -282,24 +282,24 @@ class AbstractSandbox:
...
@@ -282,24 +282,24 @@ class AbstractSandbox:
self._copy(_os)
self._copy(_os)
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)
return original(src,
dst,*args,
**kw)
return original(src,
dst, *args,
**kw)
return wrap
return wrap
for name in ["rename", "link", "symlink"]:
for name in ["rename", "link", "symlink"]:
if hasattr(_os,name): locals()[name] = _mk_dual_path_wrapper(name)
if hasattr(_os,
name): locals()[name] = _mk_dual_path_wrapper(name)
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)
return original(path,
*args,
**kw)
return original(path,
*args,
**kw)
return wrap
return wrap
if _file:
if _file:
...
@@ -310,51 +310,51 @@ class AbstractSandbox:
...
@@ -310,51 +310,51 @@ class AbstractSandbox:
"remove", "unlink", "rmdir", "utime", "lchown", "chroot", "lstat",
"remove", "unlink", "rmdir", "utime", "lchown", "chroot", "lstat",
"startfile", "mkfifo", "mknod", "pathconf", "access"
"startfile", "mkfifo", "mknod", "pathconf", "access"
]:
]:
if hasattr(_os,name): locals()[name] = _mk_single_path_wrapper(name)
if hasattr(_os,
name): locals()[name] = _mk_single_path_wrapper(name)
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)
return self._remap_output(name, original(path,
*args,
**kw))
return self._remap_output(name, original(path,
*args,
**kw))
return original(path,
*args,
**kw)
return original(path,
*args,
**kw)
return wrap
return wrap
for name in ['readlink', 'tempnam']:
for name in ['readlink', 'tempnam']:
if hasattr(_os,name): locals()[name] = _mk_single_with_return(name)
if hasattr(_os,
name): locals()[name] = _mk_single_with_return(name)
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:
return self._remap_output(name, retval)
return self._remap_output(name, retval)
return retval
return retval
return wrap
return wrap
for name in ['getcwd', 'tmpnam']:
for name in ['getcwd', 'tmpnam']:
if hasattr(_os,name): locals()[name] = _mk_query(name)
if hasattr(_os,
name): locals()[name] = _mk_query(name)
def _validate_path(self,path):
def _validate_path(self,
path):
"""
Called
to
remap
or
validate
any
path
,
whether
input
or
output
"""
"""
Called
to
remap
or
validate
any
path
,
whether
input
or
output
"""
return path
return path
def _remap_input(self,
operation,path,*args,
**kw):
def _remap_input(self,
operation, path, *args,
**kw):
"""
Called
for
path
inputs
"""
"""
Called
for
path
inputs
"""
return self._validate_path(path)
return self._validate_path(path)
def _remap_output(self,
operation,
path):
def _remap_output(self,
operation,
path):
"""
Called
for
path
outputs
"""
"""
Called
for
path
outputs
"""
return self._validate_path(path)
return self._validate_path(path)
def _remap_pair(self,
operation,src,dst,*args,
**kw):
def _remap_pair(self,
operation, src, dst, *args,
**kw):
"""
Called
for
path
pairs
like
rename
,
link
,
and
symlink
operations
"""
"""
Called
for
path
pairs
like
rename
,
link
,
and
symlink
operations
"""
return (
return (
self._remap_input(operation+'-from',
src,*args,
**kw),
self._remap_input(operation+'-from',
src, *args,
**kw),
self._remap_input(operation+'-to',
dst,*args,
**kw)
self._remap_input(operation+'-to',
dst, *args,
**kw)
)
)
...
@@ -388,7 +388,7 @@ class DirectorySandbox(AbstractSandbox):
...
@@ -388,7 +388,7 @@ class DirectorySandbox(AbstractSandbox):
def __init__(self, sandbox, exceptions=_EXCEPTIONS):
def __init__(self, sandbox, exceptions=_EXCEPTIONS):
self._sandbox = os.path.normcase(os.path.realpath(sandbox))
self._sandbox = os.path.normcase(os.path.realpath(sandbox))
self._prefix = os.path.join(self._sandbox,'')
self._prefix = os.path.join(self._sandbox,
'')
self._exceptions = [
self._exceptions = [
os.path.normcase(os.path.realpath(path))
os.path.normcase(os.path.realpath(path))
for path in exceptions
for path in exceptions
...
@@ -403,12 +403,12 @@ class DirectorySandbox(AbstractSandbox):
...
@@ -403,12 +403,12 @@ class DirectorySandbox(AbstractSandbox):
def _file(self, path, mode='r', *args, **kw):
def _file(self, path, mode='r', *args, **kw):
if mode not in ('r', 'rt', 'rb', 'rU', 'U') and not self._ok(path):
if mode not in ('r', 'rt', 'rb', 'rU', 'U') and not self._ok(path):
self._violation("file", path, mode, *args, **kw)
self._violation("file", path, mode, *args, **kw)
return _file(path,
mode,*args,
**kw)
return _file(path,
mode, *args,
**kw)
def _open(self, path, mode='r', *args, **kw):
def _open(self, path, mode='r', *args, **kw):
if mode not in ('r', 'rt', 'rb', 'rU', 'U') and not self._ok(path):
if mode not in ('r', 'rt', 'rb', 'rU', 'U') and not self._ok(path):
self._violation("open", path, mode, *args, **kw)
self._violation("open", path, mode, *args, **kw)
return _open(path,
mode,*args,
**kw)
return _open(path,
mode, *args,
**kw)
def tmpnam(self):
def tmpnam(self):
self._violation("tmpnam")
self._violation("tmpnam")
...
@@ -448,13 +448,13 @@ class DirectorySandbox(AbstractSandbox):
...
@@ -448,13 +448,13 @@ class DirectorySandbox(AbstractSandbox):
"""
Called
for
path
pairs
like
rename
,
link
,
and
symlink
operations
"""
"""
Called
for
path
pairs
like
rename
,
link
,
and
symlink
operations
"""
if not self._ok(src) or not self._ok(dst):
if not self._ok(src) or not self._ok(dst):
self._violation(operation, src, dst, *args, **kw)
self._violation(operation, src, dst, *args, **kw)
return (src,dst)
return (src,
dst)
def open(self, file, flags, mode=0o777, *args, **kw):
def open(self, file, flags, mode=0o777, *args, **kw):
"""
Called
for
low
-
level
os
.
open
()
"""
"""
Called
for
low
-
level
os
.
open
()
"""
if flags & WRITE_FLAGS and not self._ok(file):
if flags & WRITE_FLAGS and not self._ok(file):
self._violation("os.open", file, flags, mode, *args, **kw)
self._violation("os.open", file, flags, mode, *args, **kw)
return _os.open(file,
flags,
mode, *args, **kw)
return _os.open(file,
flags,
mode, *args, **kw)
WRITE_FLAGS = functools.reduce(
WRITE_FLAGS = functools.reduce(
operator.or_, [getattr(_os, a, 0) for a in
operator.or_, [getattr(_os, a, 0) for a in
...
...
setuptools/site-patch.py
View file @
f749ccab
...
@@ -7,7 +7,7 @@ def __boot():
...
@@ -7,7 +7,7 @@ def __boot():
else
:
else
:
PYTHONPATH
=
PYTHONPATH
.
split
(
os
.
pathsep
)
PYTHONPATH
=
PYTHONPATH
.
split
(
os
.
pathsep
)
pic
=
getattr
(
sys
,
'path_importer_cache'
,
{})
pic
=
getattr
(
sys
,
'path_importer_cache'
,
{})
stdpath
=
sys
.
path
[
len
(
PYTHONPATH
):]
stdpath
=
sys
.
path
[
len
(
PYTHONPATH
):]
mydir
=
os
.
path
.
dirname
(
__file__
)
mydir
=
os
.
path
.
dirname
(
__file__
)
#print "searching",stdpath,sys.path
#print "searching",stdpath,sys.path
...
@@ -25,14 +25,14 @@ def __boot():
...
@@ -25,14 +25,14 @@ def __boot():
else
:
else
:
try
:
try
:
import
imp
# Avoid import loop in Python >= 3.3
import
imp
# Avoid import loop in Python >= 3.3
stream
,
path
,
descr
=
imp
.
find_module
(
'site'
,[
item
])
stream
,
path
,
descr
=
imp
.
find_module
(
'site'
,
[
item
])
except
ImportError
:
except
ImportError
:
continue
continue
if
stream
is
None
:
if
stream
is
None
:
continue
continue
try
:
try
:
# This should actually reload the current module
# This should actually reload the current module
imp
.
load_module
(
'site'
,
stream
,
path
,
descr
)
imp
.
load_module
(
'site'
,
stream
,
path
,
descr
)
finally
:
finally
:
stream
.
close
()
stream
.
close
()
break
break
...
@@ -41,9 +41,9 @@ def __boot():
...
@@ -41,9 +41,9 @@ def __boot():
#print "loaded", __file__
#print "loaded", __file__
known_paths
=
dict
([(
makepath
(
item
)[
1
],
1
)
for
item
in
sys
.
path
])
# 2.2 comp
known_paths
=
dict
([(
makepath
(
item
)[
1
],
1
)
for
item
in
sys
.
path
])
# 2.2 comp
oldpos
=
getattr
(
sys
,
'__egginsert'
,
0
)
# save old insertion position
oldpos
=
getattr
(
sys
,
'__egginsert'
,
0
)
# save old insertion position
sys
.
__egginsert
=
0
# and reset the current one
sys
.
__egginsert
=
0
# and reset the current one
for
item
in
PYTHONPATH
:
for
item
in
PYTHONPATH
:
...
...
setuptools/tests/__init__.py
View file @
f749ccab
...
@@ -27,7 +27,7 @@ def makeSetup(**args):
...
@@ -27,7 +27,7 @@ def makeSetup(**args):
distutils
.
core
.
_setup_stop_after
=
"commandline"
distutils
.
core
.
_setup_stop_after
=
"commandline"
# Don't let system command line leak into tests!
# Don't let system command line leak into tests!
args
.
setdefault
(
'script_args'
,[
'install'
])
args
.
setdefault
(
'script_args'
,
[
'install'
])
try
:
try
:
return
setuptools
.
setup
(
**
args
)
return
setuptools
.
setup
(
**
args
)
...
@@ -56,35 +56,35 @@ class TestDepends:
...
@@ -56,35 +56,35 @@ class TestDepends:
fc
=
six
.
get_function_code
(
f1
)
fc
=
six
.
get_function_code
(
f1
)
# unrecognized name
# unrecognized name
assert
dep
.
extract_constant
(
fc
,
'q'
,
-
1
)
is
None
assert
dep
.
extract_constant
(
fc
,
'q'
,
-
1
)
is
None
# constant assigned
# constant assigned
dep
.
extract_constant
(
fc
,
'x'
,
-
1
)
==
"test"
dep
.
extract_constant
(
fc
,
'x'
,
-
1
)
==
"test"
# expression assigned
# expression assigned
dep
.
extract_constant
(
fc
,
'y'
,
-
1
)
==
-
1
dep
.
extract_constant
(
fc
,
'y'
,
-
1
)
==
-
1
# recognized name, not assigned
# recognized name, not assigned
dep
.
extract_constant
(
fc
,
'z'
,
-
1
)
is
None
dep
.
extract_constant
(
fc
,
'z'
,
-
1
)
is
None
def
testFindModule
(
self
):
def
testFindModule
(
self
):
with
pytest
.
raises
(
ImportError
):
with
pytest
.
raises
(
ImportError
):
dep
.
find_module
(
'no-such.-thing'
)
dep
.
find_module
(
'no-such.-thing'
)
with
pytest
.
raises
(
ImportError
):
with
pytest
.
raises
(
ImportError
):
dep
.
find_module
(
'setuptools.non-existent'
)
dep
.
find_module
(
'setuptools.non-existent'
)
f
,
p
,
i
=
dep
.
find_module
(
'setuptools.tests'
)
f
,
p
,
i
=
dep
.
find_module
(
'setuptools.tests'
)
f
.
close
()
f
.
close
()
@
needs_bytecode
@
needs_bytecode
def
testModuleExtract
(
self
):
def
testModuleExtract
(
self
):
from
email
import
__version__
from
email
import
__version__
assert
dep
.
get_module_constant
(
'email'
,
'__version__'
)
==
__version__
assert
dep
.
get_module_constant
(
'email'
,
'__version__'
)
==
__version__
assert
dep
.
get_module_constant
(
'sys'
,
'version'
)
==
sys
.
version
assert
dep
.
get_module_constant
(
'sys'
,
'version'
)
==
sys
.
version
assert
dep
.
get_module_constant
(
'setuptools.tests'
,
'__doc__'
)
==
__doc__
assert
dep
.
get_module_constant
(
'setuptools.tests'
,
'__doc__'
)
==
__doc__
@
needs_bytecode
@
needs_bytecode
def
testRequire
(
self
):
def
testRequire
(
self
):
req
=
Require
(
'Email'
,
'1.0.3'
,
'email'
)
req
=
Require
(
'Email'
,
'1.0.3'
,
'email'
)
assert
req
.
name
==
'Email'
assert
req
.
name
==
'Email'
assert
req
.
module
==
'email'
assert
req
.
module
==
'email'
...
@@ -101,12 +101,12 @@ class TestDepends:
...
@@ -101,12 +101,12 @@ class TestDepends:
assert
req
.
is_present
()
assert
req
.
is_present
()
assert
req
.
is_current
()
assert
req
.
is_current
()
req
=
Require
(
'Email 3000'
,
'03000'
,
'email'
,
format
=
LooseVersion
)
req
=
Require
(
'Email 3000'
,
'03000'
,
'email'
,
format
=
LooseVersion
)
assert
req
.
is_present
()
assert
req
.
is_present
()
assert
not
req
.
is_current
()
assert
not
req
.
is_current
()
assert
not
req
.
version_ok
(
'unknown'
)
assert
not
req
.
version_ok
(
'unknown'
)
req
=
Require
(
'Do-what-I-mean'
,
'1.0'
,
'd-w-i-m'
)
req
=
Require
(
'Do-what-I-mean'
,
'1.0'
,
'd-w-i-m'
)
assert
not
req
.
is_present
()
assert
not
req
.
is_present
()
assert
not
req
.
is_current
()
assert
not
req
.
is_current
()
...
@@ -125,22 +125,22 @@ class TestDepends:
...
@@ -125,22 +125,22 @@ class TestDepends:
class
TestDistro
:
class
TestDistro
:
def
setup_method
(
self
,
method
):
def
setup_method
(
self
,
method
):
self
.
e1
=
Extension
(
'bar.ext'
,[
'bar.c'
])
self
.
e1
=
Extension
(
'bar.ext'
,
[
'bar.c'
])
self
.
e2
=
Extension
(
'c.y'
,
[
'y.c'
])
self
.
e2
=
Extension
(
'c.y'
,
[
'y.c'
])
self
.
dist
=
makeSetup
(
self
.
dist
=
makeSetup
(
packages
=
[
'a'
,
'a.b'
,
'a.b.c'
,
'b'
,
'c'
],
packages
=
[
'a'
,
'a.b'
,
'a.b.c'
,
'b'
,
'c'
],
py_modules
=
[
'b.d'
,
'x'
],
py_modules
=
[
'b.d'
,
'x'
],
ext_modules
=
(
self
.
e1
,
self
.
e2
),
ext_modules
=
(
self
.
e1
,
self
.
e2
),
package_dir
=
{},
package_dir
=
{},
)
)
def
testDistroType
(
self
):
def
testDistroType
(
self
):
assert
isinstance
(
self
.
dist
,
setuptools
.
dist
.
Distribution
)
assert
isinstance
(
self
.
dist
,
setuptools
.
dist
.
Distribution
)
def
testExcludePackage
(
self
):
def
testExcludePackage
(
self
):
self
.
dist
.
exclude_package
(
'a'
)
self
.
dist
.
exclude_package
(
'a'
)
assert
self
.
dist
.
packages
==
[
'b'
,
'c'
]
assert
self
.
dist
.
packages
==
[
'b'
,
'c'
]
self
.
dist
.
exclude_package
(
'b'
)
self
.
dist
.
exclude_package
(
'b'
)
assert
self
.
dist
.
packages
==
[
'c'
]
assert
self
.
dist
.
packages
==
[
'c'
]
...
@@ -169,7 +169,7 @@ class TestDistro:
...
@@ -169,7 +169,7 @@ class TestDistro:
assert
self
.
dist
.
ext_modules
==
[
self
.
e2
,
self
.
e1
]
assert
self
.
dist
.
ext_modules
==
[
self
.
e2
,
self
.
e1
]
def
testExcludePackages
(
self
):
def
testExcludePackages
(
self
):
self
.
dist
.
exclude
(
packages
=
[
'c'
,
'b'
,
'a'
])
self
.
dist
.
exclude
(
packages
=
[
'c'
,
'b'
,
'a'
])
assert
self
.
dist
.
packages
==
[]
assert
self
.
dist
.
packages
==
[]
assert
self
.
dist
.
py_modules
==
[
'x'
]
assert
self
.
dist
.
py_modules
==
[
'x'
]
assert
self
.
dist
.
ext_modules
==
[
self
.
e1
]
assert
self
.
dist
.
ext_modules
==
[
self
.
e1
]
...
@@ -199,13 +199,13 @@ class TestDistro:
...
@@ -199,13 +199,13 @@ class TestDistro:
with
pytest
.
raises
(
DistutilsSetupError
):
with
pytest
.
raises
(
DistutilsSetupError
):
self
.
dist
.
exclude
(
nonexistent_option
=
'x'
)
self
.
dist
.
exclude
(
nonexistent_option
=
'x'
)
with
pytest
.
raises
(
DistutilsSetupError
):
with
pytest
.
raises
(
DistutilsSetupError
):
self
.
dist
.
include
(
packages
=
{
'x'
:
'y'
})
self
.
dist
.
include
(
packages
=
{
'x'
:
'y'
})
with
pytest
.
raises
(
DistutilsSetupError
):
with
pytest
.
raises
(
DistutilsSetupError
):
self
.
dist
.
exclude
(
packages
=
{
'x'
:
'y'
})
self
.
dist
.
exclude
(
packages
=
{
'x'
:
'y'
})
with
pytest
.
raises
(
DistutilsSetupError
):
with
pytest
.
raises
(
DistutilsSetupError
):
self
.
dist
.
include
(
ext_modules
=
{
'x'
:
'y'
})
self
.
dist
.
include
(
ext_modules
=
{
'x'
:
'y'
})
with
pytest
.
raises
(
DistutilsSetupError
):
with
pytest
.
raises
(
DistutilsSetupError
):
self
.
dist
.
exclude
(
ext_modules
=
{
'x'
:
'y'
})
self
.
dist
.
exclude
(
ext_modules
=
{
'x'
:
'y'
})
with
pytest
.
raises
(
DistutilsSetupError
):
with
pytest
.
raises
(
DistutilsSetupError
):
self
.
dist
.
include
(
package_dir
=
[
'q'
])
self
.
dist
.
include
(
package_dir
=
[
'q'
])
...
@@ -216,31 +216,31 @@ class TestDistro:
...
@@ -216,31 +216,31 @@ class TestDistro:
class
TestFeatures
:
class
TestFeatures
:
def
setup_method
(
self
,
method
):
def
setup_method
(
self
,
method
):
self
.
req
=
Require
(
'Distutils'
,
'1.0.3'
,
'distutils'
)
self
.
req
=
Require
(
'Distutils'
,
'1.0.3'
,
'distutils'
)
self
.
dist
=
makeSetup
(
self
.
dist
=
makeSetup
(
features
=
{
features
=
{
'foo'
:
Feature
(
"foo"
,
standard
=
True
,
require_features
=
[
'baz'
,
self
.
req
]),
'foo'
:
Feature
(
"foo"
,
standard
=
True
,
require_features
=
[
'baz'
,
self
.
req
]),
'bar'
:
Feature
(
"bar"
,
standard
=
True
,
packages
=
[
'pkg.bar'
],
'bar'
:
Feature
(
"bar"
,
standard
=
True
,
packages
=
[
'pkg.bar'
],
py_modules
=
[
'bar_et'
],
remove
=
[
'bar.ext'
],
py_modules
=
[
'bar_et'
],
remove
=
[
'bar.ext'
],
),
),
'baz'
:
Feature
(
'baz'
:
Feature
(
"baz"
,
optional
=
False
,
packages
=
[
'pkg.baz'
],
"baz"
,
optional
=
False
,
packages
=
[
'pkg.baz'
],
scripts
=
[
'scripts/baz_it'
],
scripts
=
[
'scripts/baz_it'
],
libraries
=
[(
'libfoo'
,
'foo/foofoo.c'
)]
libraries
=
[(
'libfoo'
,
'foo/foofoo.c'
)]
),
),
'dwim'
:
Feature
(
"DWIM"
,
available
=
False
,
remove
=
'bazish'
),
'dwim'
:
Feature
(
"DWIM"
,
available
=
False
,
remove
=
'bazish'
),
},
},
script_args
=
[
'--without-bar'
,
'install'
],
script_args
=
[
'--without-bar'
,
'install'
],
packages
=
[
'pkg.bar'
,
'pkg.foo'
],
packages
=
[
'pkg.bar'
,
'pkg.foo'
],
py_modules
=
[
'bar_et'
,
'bazish'
],
py_modules
=
[
'bar_et'
,
'bazish'
],
ext_modules
=
[
Extension
(
'bar.ext'
,[
'bar.c'
])]
ext_modules
=
[
Extension
(
'bar.ext'
,
[
'bar.c'
])]
)
)
def
testDefaults
(
self
):
def
testDefaults
(
self
):
assert
not
Feature
(
assert
not
Feature
(
"test"
,
standard
=
True
,
remove
=
'x'
,
available
=
False
"test"
,
standard
=
True
,
remove
=
'x'
,
available
=
False
).
include_by_default
()
).
include_by_default
()
assert
Feature
(
"test"
,
standard
=
True
,
remove
=
'x'
).
include_by_default
()
assert
Feature
(
"test"
,
standard
=
True
,
remove
=
'x'
).
include_by_default
()
# Feature must have either kwargs, removes, or require_features
# Feature must have either kwargs, removes, or require_features
with
pytest
.
raises
(
DistutilsSetupError
):
with
pytest
.
raises
(
DistutilsSetupError
):
Feature
(
"test"
)
Feature
(
"test"
)
...
@@ -252,16 +252,16 @@ class TestFeatures:
...
@@ -252,16 +252,16 @@ class TestFeatures:
def
testFeatureOptions
(
self
):
def
testFeatureOptions
(
self
):
dist
=
self
.
dist
dist
=
self
.
dist
assert
(
assert
(
(
'with-dwim'
,
None
,
'include DWIM'
)
in
dist
.
feature_options
(
'with-dwim'
,
None
,
'include DWIM'
)
in
dist
.
feature_options
)
)
assert
(
assert
(
(
'without-dwim'
,
None
,
'exclude DWIM (default)'
)
in
dist
.
feature_options
(
'without-dwim'
,
None
,
'exclude DWIM (default)'
)
in
dist
.
feature_options
)
)
assert
(
assert
(
(
'with-bar'
,
None
,
'include bar (default)'
)
in
dist
.
feature_options
(
'with-bar'
,
None
,
'include bar (default)'
)
in
dist
.
feature_options
)
)
assert
(
assert
(
(
'without-bar'
,
None
,
'exclude bar'
)
in
dist
.
feature_options
(
'without-bar'
,
None
,
'exclude bar'
)
in
dist
.
feature_options
)
)
assert
dist
.
feature_negopt
[
'without-foo'
]
==
'with-foo'
assert
dist
.
feature_negopt
[
'without-foo'
]
==
'with-foo'
assert
dist
.
feature_negopt
[
'without-bar'
]
==
'with-bar'
assert
dist
.
feature_negopt
[
'without-bar'
]
==
'with-bar'
...
@@ -277,7 +277,7 @@ class TestFeatures:
...
@@ -277,7 +277,7 @@ class TestFeatures:
assert
(
not
'pkg.bar'
in
dist
.
packages
)
assert
(
not
'pkg.bar'
in
dist
.
packages
)
assert
(
'pkg.baz'
in
dist
.
packages
)
assert
(
'pkg.baz'
in
dist
.
packages
)
assert
(
'scripts/baz_it'
in
dist
.
scripts
)
assert
(
'scripts/baz_it'
in
dist
.
scripts
)
assert
((
'libfoo'
,
'foo/foofoo.c'
)
in
dist
.
libraries
)
assert
((
'libfoo'
,
'foo/foofoo.c'
)
in
dist
.
libraries
)
assert
dist
.
ext_modules
==
[]
assert
dist
.
ext_modules
==
[]
assert
dist
.
require_features
==
[
self
.
req
]
assert
dist
.
require_features
==
[
self
.
req
]
...
@@ -288,7 +288,7 @@ class TestFeatures:
...
@@ -288,7 +288,7 @@ class TestFeatures:
def
testFeatureWithInvalidRemove
(
self
):
def
testFeatureWithInvalidRemove
(
self
):
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
:
...
@@ -298,7 +298,7 @@ class TestCommandTests:
...
@@ -298,7 +298,7 @@ class TestCommandTests:
assert
(
isinstance
(
test_cmd
,
distutils
.
cmd
.
Command
))
assert
(
isinstance
(
test_cmd
,
distutils
.
cmd
.
Command
))
def
testLongOptSuiteWNoDefault
(
self
):
def
testLongOptSuiteWNoDefault
(
self
):
ts1
=
makeSetup
(
script_args
=
[
'test'
,
'--test-suite=foo.tests.suite'
])
ts1
=
makeSetup
(
script_args
=
[
'test'
,
'--test-suite=foo.tests.suite'
])
ts1
=
ts1
.
get_command_obj
(
'test'
)
ts1
=
ts1
.
get_command_obj
(
'test'
)
ts1
.
ensure_finalized
()
ts1
.
ensure_finalized
()
assert
ts1
.
test_suite
==
'foo.tests.suite'
assert
ts1
.
test_suite
==
'foo.tests.suite'
...
@@ -311,7 +311,7 @@ class TestCommandTests:
...
@@ -311,7 +311,7 @@ class TestCommandTests:
def
testDefaultWModuleOnCmdLine
(
self
):
def
testDefaultWModuleOnCmdLine
(
self
):
ts3
=
makeSetup
(
ts3
=
makeSetup
(
test_suite
=
'bar.tests'
,
test_suite
=
'bar.tests'
,
script_args
=
[
'test'
,
'-m'
,
'foo.tests'
]
script_args
=
[
'test'
,
'-m'
,
'foo.tests'
]
).
get_command_obj
(
'test'
)
).
get_command_obj
(
'test'
)
ts3
.
ensure_finalized
()
ts3
.
ensure_finalized
()
assert
ts3
.
test_module
==
'foo.tests'
assert
ts3
.
test_module
==
'foo.tests'
...
@@ -319,7 +319,7 @@ class TestCommandTests:
...
@@ -319,7 +319,7 @@ class TestCommandTests:
def
testConflictingOptions
(
self
):
def
testConflictingOptions
(
self
):
ts4
=
makeSetup
(
ts4
=
makeSetup
(
script_args
=
[
'test'
,
'-m'
,
'bar.tests'
,
'-s'
,
'foo.tests.suite'
]
script_args
=
[
'test'
,
'-m'
,
'bar.tests'
,
'-s'
,
'foo.tests.suite'
]
).
get_command_obj
(
'test'
)
).
get_command_obj
(
'test'
)
with
pytest
.
raises
(
DistutilsOptionError
):
with
pytest
.
raises
(
DistutilsOptionError
):
ts4
.
ensure_finalized
()
ts4
.
ensure_finalized
()
...
...
setuptools/tests/contexts.py
View file @
f749ccab
...
@@ -10,7 +10,7 @@ import pkg_resources
...
@@ -10,7 +10,7 @@ import pkg_resources
@
contextlib
.
contextmanager
@
contextlib
.
contextmanager
def
tempdir
(
cd
=
lambda
dir
:
None
,
**
kwargs
):
def
tempdir
(
cd
=
lambda
dir
:
None
,
**
kwargs
):
temp_dir
=
tempfile
.
mkdtemp
(
**
kwargs
)
temp_dir
=
tempfile
.
mkdtemp
(
**
kwargs
)
orig_dir
=
os
.
getcwd
()
orig_dir
=
os
.
getcwd
()
try
:
try
:
...
...
setuptools/tests/test_find_packages.py
View file @
f749ccab
...
@@ -32,7 +32,7 @@ def can_symlink():
...
@@ -32,7 +32,7 @@ def can_symlink():
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
platform
.
system
()
==
'Windows'
and
sys
.
version_info
[:
2
]
==
(
3
,
2
)
platform
.
system
()
==
'Windows'
and
sys
.
version_info
[:
2
]
==
(
3
,
2
)
)
)
return
can_symlink
()
and
not
bad_symlink
return
can_symlink
()
and
not
bad_symlink
...
...
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