setuptools: Updating MANIFEST.in does not correctly update the package sdist creates

Originally reported by: spookylukey (Bitbucket: spookylukey, GitHub: spookylukey)


The behaviour of sdist depends on previous contents of MANIFEST.in, not just the current. This is not fixed even by running setup.py clean or setup.py clean --all (although this should not be necessary).

This is very surprising behaviour, and potentially dangerous too - if someone accidentally adds a MANIFEST.in rule that includes a file that must not be distributed and notice the problem, they would expect that removing the rule will remove the file, but it does not.

I’ve attached a bash script that demonstrates the problem.


About this issue

  • Original URL
  • State: open
  • Created 9 years ago
  • Reactions: 9
  • Comments: 20 (13 by maintainers)

Commits related to this issue

Most upvoted comments

I really think SOURCES.txt should be cleared automatically at some point. This is very surprising behavior. I’ve been trying to figure out why the changes I was making to MANIFEST.in didn’t seem to be working.

I have been hit by this same bug. My current remedy is to delete the *.egg-info directory before running setup.py sdist.

@lucacerone This issue is specific to a setup with MANIFEST.in: please first check the docs at https://packaging.python.org/guides/using-manifest-in/ and see if following those instruction you are able to obtain the desired source distribution.

The only thing that you should be aware, regarding this specific bug, is that after each change to MANIFEST.in you should delete the <package>.egg-info directory to be sure that the SOURCES.txt is regenerated appropriately.

The reason for

        rcfiles = list(walk_revctrl())
        if rcfiles:
            self.filelist.extend(rcfiles)
        elif os.path.exists(self.manifest):
            self.read_manifest()

is now clear: in the develop tree (under SCM control) the files to be installed are determined from the SCM system (walk_revctrl()); in an sdist install the files are to be determined from the existing manifest file, which was previously generated in the develop tree + setuptools_scm

This logic is broken for packages that do not use setuptools_scm, for which there is no guarantee that the current manifest file (in the development tree) is correct.

Unfortunately my PR #1014 badly brokes this intended behaviour, so that pip install of sdist packages under SCM control and include_package_data=True is not more possible, see #1016 .