-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build_meta.build_sdist
should work if the destination directory already contains a tar.gz
#1749
Comments
@benoit-pierre Do you have a reproducer? I tried using my original reproducer but using |
With an updated version? I suspect it works fine when re-creating the exact same source dist. |
Also, I don't know how |
Yeah:
Yeah. I suppose the best reproducer would be an |
This fail as expected for the sdist case: setuptools/tests/test_build_meta.py | 33 ++++++++++++++++++---------------
1 file changed, 18 insertions(+), 15 deletions(-)
diff --git i/setuptools/tests/test_build_meta.py w/setuptools/tests/test_build_meta.py
index 7612ebd7..38886268 100644
--- i/setuptools/tests/test_build_meta.py
+++ w/setuptools/tests/test_build_meta.py
@@ -157,9 +157,10 @@ def test_build_wheel(self, build_backend):
assert os.path.isfile(os.path.join(dist_dir, wheel_name))
- def test_build_wheel_with_existing_wheel_file_present(self, tmpdir_cwd):
- # Building a wheel should still succeed if there's already a wheel
- # in the wheel directory
+ @pytest.mark.parametrize('build_type', ('wheel', 'sdist'))
+ def test_build_with_existing_file_present(self, build_type, tmpdir_cwd):
+ # Building a sdist/wheel should still succeed if there's
+ # already a sdist/wheel in the destination directory.
files = {
'setup.py': "from setuptools import setup\nsetup()",
'VERSION': "0.0.1",
@@ -177,28 +178,30 @@ def test_build_wheel_with_existing_wheel_file_present(self, tmpdir_cwd):
build_files(files)
- dist_dir = os.path.abspath('pip-wheel-preexisting')
+ dist_dir = os.path.abspath('preexisting-' + build_type)
os.makedirs(dist_dir)
- # make first wheel
build_backend = self.get_build_backend()
- wheel_one = build_backend.build_wheel(dist_dir)
+ build_method = getattr(build_backend, 'build_' + build_type)
+
+ # build a first sdist/wheel
+ first_result = build_method(dist_dir)
# change version
with open("VERSION", "wt") as version_file:
version_file.write("0.0.2")
- # make *second* wheel
- wheel_two = self.get_build_backend().build_wheel(dist_dir)
+ # build a *second* sdist/wheel
+ second_result = build_method(dist_dir)
- assert os.path.isfile(os.path.join(dist_dir, wheel_one))
- assert wheel_one != wheel_two
+ assert os.path.isfile(os.path.join(dist_dir, first_result))
+ assert first_result != second_result
- # and if rebuilding the same wheel?
- open(os.path.join(dist_dir, wheel_two), 'w').close()
- wheel_three = self.get_build_backend().build_wheel(dist_dir)
- assert wheel_three == wheel_two
- assert os.path.getsize(os.path.join(dist_dir, wheel_three)) > 0
+ # and if rebuilding the exact same sdist/wheel?
+ open(os.path.join(dist_dir, second_result), 'w').close()
+ third_result = build_method(dist_dir)
+ assert third_result == second_result
+ assert os.path.getsize(os.path.join(dist_dir, third_result)) > 0
def test_build_sdist(self, build_backend):
dist_dir = os.path.abspath('pip-sdist') |
@pganssle it looks like this should be closed. |
The issue is similar to #1671, see #1745 for how the issue can be resolved.
The text was updated successfully, but these errors were encountered: