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
cd0278de
Commit
cd0278de
authored
Sep 14, 2018
by
Bernat Gabor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests exposing the issues with sdist_directory not being --dist-dir
parent
d3979148
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
1 deletion
+35
-1
setuptools/tests/test_build_meta.py
setuptools/tests/test_build_meta.py
+35
-1
No files found.
setuptools/tests/test_build_meta.py
View file @
cd0278de
from
__future__
import
unicode_literals
from
__future__
import
unicode_literals
import
os
import
os
import
shutil
import
pytest
import
pytest
...
@@ -9,7 +10,6 @@ from .textwrap import DALS
...
@@ -9,7 +10,6 @@ from .textwrap import DALS
__metaclass__
=
type
__metaclass__
=
type
futures
=
pytest
.
importorskip
(
'concurrent.futures'
)
futures
=
pytest
.
importorskip
(
'concurrent.futures'
)
importlib
=
pytest
.
importorskip
(
'importlib'
)
importlib
=
pytest
.
importorskip
(
'importlib'
)
...
@@ -23,12 +23,14 @@ class BuildBackendBase:
...
@@ -23,12 +23,14 @@ class BuildBackendBase:
class
BuildBackend
(
BuildBackendBase
):
class
BuildBackend
(
BuildBackendBase
):
"""PEP 517 Build Backend"""
"""PEP 517 Build Backend"""
def
__init__
(
self
,
*
args
,
**
kwargs
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
(
BuildBackend
,
self
).
__init__
(
*
args
,
**
kwargs
)
super
(
BuildBackend
,
self
).
__init__
(
*
args
,
**
kwargs
)
self
.
pool
=
futures
.
ProcessPoolExecutor
()
self
.
pool
=
futures
.
ProcessPoolExecutor
()
def
__getattr__
(
self
,
name
):
def
__getattr__
(
self
,
name
):
"""Handles aribrary function invocations on the build backend."""
"""Handles aribrary function invocations on the build backend."""
def
method
(
*
args
,
**
kw
):
def
method
(
*
args
,
**
kw
):
root
=
os
.
path
.
abspath
(
self
.
cwd
)
root
=
os
.
path
.
abspath
(
self
.
cwd
)
caller
=
BuildBackendCaller
(
root
,
self
.
env
,
self
.
backend_name
)
caller
=
BuildBackendCaller
(
root
,
self
.
env
,
self
.
backend_name
)
...
@@ -51,6 +53,7 @@ defns = [
...
@@ -51,6 +53,7 @@ defns = [
'setup.py'
:
DALS
(
"""
'setup.py'
:
DALS
(
"""
__import__('setuptools').setup(
__import__('setuptools').setup(
name='foo',
name='foo',
version='0.0.0',
py_modules=['hello'],
py_modules=['hello'],
setup_requires=['six'],
setup_requires=['six'],
)
)
...
@@ -65,6 +68,7 @@ defns = [
...
@@ -65,6 +68,7 @@ defns = [
assert __name__ == '__main__'
assert __name__ == '__main__'
__import__('setuptools').setup(
__import__('setuptools').setup(
name='foo',
name='foo',
version='0.0.0',
py_modules=['hello'],
py_modules=['hello'],
setup_requires=['six'],
setup_requires=['six'],
)
)
...
@@ -82,6 +86,7 @@ defns = [
...
@@ -82,6 +86,7 @@ defns = [
assert variable
assert variable
__import__('setuptools').setup(
__import__('setuptools').setup(
name='foo',
name='foo',
version='0.0.0',
py_modules=['hello'],
py_modules=['hello'],
setup_requires=['six'],
setup_requires=['six'],
)
)
...
@@ -146,3 +151,32 @@ def test_prepare_metadata_for_build_wheel_with_str(build_backend):
...
@@ -146,3 +151,32 @@ def test_prepare_metadata_for_build_wheel_with_str(build_backend):
dist_info
=
build_backend
.
prepare_metadata_for_build_wheel
(
dist_dir
)
dist_info
=
build_backend
.
prepare_metadata_for_build_wheel
(
dist_dir
)
assert
os
.
path
.
isfile
(
os
.
path
.
join
(
dist_dir
,
dist_info
,
'METADATA'
))
assert
os
.
path
.
isfile
(
os
.
path
.
join
(
dist_dir
,
dist_info
,
'METADATA'
))
def
test_build_sdist_explicit_dist
(
build_backend
):
# explicitly specifying the dist folder should work
# the folder sdist_directory and the ``--dist-dir`` can be the same
dist_dir
=
os
.
path
.
abspath
(
'dist'
)
sdist_name
=
build_backend
.
build_sdist
(
dist_dir
)
assert
os
.
path
.
isfile
(
os
.
path
.
join
(
dist_dir
,
sdist_name
))
def
test_build_sdist_version_change
(
build_backend
):
sdist_into_directory
=
os
.
path
.
abspath
(
"out_sdist"
)
os
.
makedirs
(
sdist_into_directory
)
sdist_name
=
build_backend
.
build_sdist
(
sdist_into_directory
)
assert
os
.
path
.
isfile
(
os
.
path
.
join
(
sdist_into_directory
,
sdist_name
))
# if the setup.py changes subsequent call of the build meta should still succeed, given the
# sdist_directory the frontend specifies is empty
with
open
(
os
.
path
.
abspath
(
"setup.py"
),
'rt'
)
as
file_handler
:
content
=
file_handler
.
read
()
with
open
(
os
.
path
.
abspath
(
"setup.py"
),
'wt'
)
as
file_handler
:
file_handler
.
write
(
content
.
replace
(
"version='0.0.0'"
,
"version='0.0.1'"
))
shutil
.
rmtree
(
sdist_into_directory
)
os
.
makedirs
(
sdist_into_directory
)
sdist_name
=
build_backend
.
build_sdist
(
"out_sdist"
)
assert
os
.
path
.
isfile
(
os
.
path
.
join
(
os
.
path
.
abspath
(
"out_sdist"
),
sdist_name
))
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