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
8f82e507
Commit
8f82e507
authored
Jan 28, 2019
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '40.7-maintenance'
parents
f6f85ea2
5133d86c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
101 additions
and
3 deletions
+101
-3
CHANGES.rst
CHANGES.rst
+6
-0
setup.cfg
setup.cfg
+1
-1
setup.py
setup.py
+1
-1
setuptools/dist.py
setuptools/dist.py
+21
-1
setuptools/tests/environment.py
setuptools/tests/environment.py
+2
-0
setuptools/tests/test_build_ext.py
setuptools/tests/test_build_ext.py
+70
-0
No files found.
CHANGES.rst
View file @
8f82e507
v40
.7.1
-------
*
#
1660
:
On
Python
2
,
when
reading
config
files
,
downcast
options
from
text
to
bytes
to
satisfy
distutils
expectations
.
v40
.7.0
-------
...
...
setup.cfg
View file @
8f82e507
[bumpversion]
current_version = 40.7.
0
current_version = 40.7.
1
commit = True
tag = True
...
...
setup.py
View file @
8f82e507
...
...
@@ -89,7 +89,7 @@ def pypi_link(pkg_filename):
setup_params
=
dict
(
name
=
"setuptools"
,
version
=
"40.7.
0
"
,
version
=
"40.7.
1
"
,
description
=
(
"Easily download, build, install, upgrade, and uninstall "
"Python packages"
...
...
setuptools/dist.py
View file @
8f82e507
...
...
@@ -603,7 +603,7 @@ class Distribution(_Distribution):
for
opt
in
options
:
if
opt
!=
'__name__'
and
opt
not
in
ignore_options
:
val
=
parser
.
get
(
section
,
opt
)
val
=
self
.
_try_str
(
parser
.
get
(
section
,
opt
)
)
opt
=
opt
.
replace
(
'-'
,
'_'
)
opt_dict
[
opt
]
=
(
filename
,
val
)
...
...
@@ -627,6 +627,26 @@ class Distribution(_Distribution):
except
ValueError
as
msg
:
raise
DistutilsOptionError
(
msg
)
@
staticmethod
def
_try_str
(
val
):
"""
On Python 2, much of distutils relies on string values being of
type 'str' (bytes) and not unicode text. If the value can be safely
encoded to bytes using the default encoding, prefer that.
Why the default encoding? Because that value can be implicitly
decoded back to text if needed.
Ref #1653
"""
if
six
.
PY3
:
return
val
try
:
return
val
.
encode
()
except
UnicodeEncodeError
:
pass
return
val
def
_set_command_options
(
self
,
command_obj
,
option_dict
=
None
):
"""
Set the options for 'command_obj' from 'option_dict'. Basically
...
...
setuptools/tests/environment.py
View file @
8f82e507
...
...
@@ -46,6 +46,8 @@ def run_setup_py(cmd, pypath=None, path=None,
cmd
,
stdout
=
_PIPE
,
stderr
=
_PIPE
,
shell
=
shell
,
env
=
env
,
)
if
isinstance
(
data_stream
,
tuple
):
data_stream
=
slice
(
*
data_stream
)
data
=
proc
.
communicate
()[
data_stream
]
except
OSError
:
return
1
,
''
...
...
setuptools/tests/test_build_ext.py
View file @
8f82e507
...
...
@@ -8,6 +8,10 @@ from setuptools.command.build_ext import build_ext, get_abi3_suffix
from
setuptools.dist
import
Distribution
from
setuptools.extension
import
Extension
from
.
import
environment
from
.files
import
build_files
from
.textwrap
import
DALS
class
TestBuildExt
:
def
test_get_ext_filename
(
self
):
...
...
@@ -43,3 +47,69 @@ class TestBuildExt:
assert
res
.
endswith
(
'eggs.pyd'
)
else
:
assert
'abi3'
in
res
def
test_build_ext_config_handling
(
tmpdir_cwd
):
files
=
{
'setup.py'
:
DALS
(
"""
from setuptools import Extension, setup
setup(
name='foo',
version='0.0.0',
ext_modules=[Extension('foo', ['foo.c'])],
)
"""
),
'foo.c'
:
DALS
(
"""
#include "Python.h"
#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"foo",
NULL,
0,
NULL,
NULL,
NULL,
NULL,
NULL
};
#define INITERROR return NULL
PyMODINIT_FUNC PyInit_foo(void)
#else
#define INITERROR return
void initfoo(void)
#endif
{
#if PY_MAJOR_VERSION >= 3
PyObject *module = PyModule_Create(&moduledef);
#else
PyObject *module = Py_InitModule("extension", NULL);
#endif
if (module == NULL)
INITERROR;
#if PY_MAJOR_VERSION >= 3
return module;
#endif
}
"""
),
'setup.cfg'
:
DALS
(
"""
[build]
build-base = foo_build
"""
),
}
build_files
(
files
)
code
,
output
=
environment
.
run_setup_py
(
cmd
=
[
'build'
],
data_stream
=
(
0
,
2
),
)
assert
code
==
0
,
'
\
n
STDOUT:
\
n
%s
\
n
STDERR:
\
n
%s'
%
output
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