aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--changelog.d/1625.change.rst1
-rw-r--r--setuptools/build_meta.py2
-rw-r--r--setuptools/tests/test_build_meta.py19
3 files changed, 21 insertions, 1 deletions
diff --git a/changelog.d/1625.change.rst b/changelog.d/1625.change.rst
new file mode 100644
index 00000000..9125ac0c
--- /dev/null
+++ b/changelog.d/1625.change.rst
@@ -0,0 +1 @@
+In PEP 517 build_meta builder, ensure that sdists are built as gztar per the spec.
diff --git a/setuptools/build_meta.py b/setuptools/build_meta.py
index 02de4427..c883d92f 100644
--- a/setuptools/build_meta.py
+++ b/setuptools/build_meta.py
@@ -175,7 +175,7 @@ def build_wheel(wheel_directory, config_settings=None,
def build_sdist(sdist_directory, config_settings=None):
config_settings = _fix_config(config_settings)
sdist_directory = os.path.abspath(sdist_directory)
- sys.argv = sys.argv[:1] + ['sdist'] + \
+ sys.argv = sys.argv[:1] + ['sdist', '--formats', 'gztar'] + \
config_settings["--global-option"] + \
["--dist-dir", sdist_directory]
_run_setup()
diff --git a/setuptools/tests/test_build_meta.py b/setuptools/tests/test_build_meta.py
index a472d3eb..82b44c89 100644
--- a/setuptools/tests/test_build_meta.py
+++ b/setuptools/tests/test_build_meta.py
@@ -217,3 +217,22 @@ def test_build_sdist_setup_py_manifest_excluded(tmpdir_cwd):
targz_path = build_sdist("temp")
with tarfile.open(os.path.join("temp", targz_path)) as tar:
assert not any('setup.py' in name for name in tar.getnames())
+
+
+def test_build_sdist_builds_targz_even_if_zip_indicated(tmpdir_cwd):
+ files = {
+ 'setup.py': DALS("""
+ __import__('setuptools').setup(
+ name='foo',
+ version='0.0.0',
+ py_modules=['hello']
+ )"""),
+ 'hello.py': '',
+ 'setup.cfg': DALS("""
+ [sdist]
+ formats=zip
+ """)
+ }
+
+ build_files(files)
+ build_sdist("temp")