11

When creating a source distribution using python's setuptools (python setup.py sdist), I am using a MANIFEST.in file containing the line:

recursive-include mypackage

because I want to include some non-module files inside the mypackage directory. However, there are also symbolic links under the mypackage directory whose targets I do not want included in my source distribution. Is there a way to specify "ignore symlinks" inside the MANIFEST.in ?

I know... I probably shouldn't have those symlinks there.

foobarbecue
  • 6,780
  • 4
  • 28
  • 54
  • Maybe you can exclude them by running a function turning a `MANIFEST_template.in` into `MANIFEST.in` at the start of your `setup.py`? Scanning for symlinks with the info from [this post](http://stackoverflow.com/questions/17889368/if-path-is-symlink-to-another-path). Would be nice if there's such an option, though. – greschd Apr 21 '15 at 09:43
  • 2
    To the best of my knowledge, using `recursive-include mypackage` to include everything in your package should be avoided. This can pick up lots of things you really don't want included in your distributions. You should list specific files if they are few and special, or otherwise include them by extension or other file name pattern, e.g. `recursive-include mypackage *.mydataformat`. – taleinat Apr 21 '15 at 23:09
  • 1
    If you know the symlinks you can explicitly add `exclude`s after `recursive-include` in `MANIFEST.in` – directives are evaluated in order. – fpbhb Apr 25 '15 at 21:32

1 Answers1

3

Distutils does not offer any special handling of symlinks. You can look through the distutils code and see that the processing of the MANIFEST.in file is doing simple pattern matching, using os.listdir recursively, without any special handling for symlinks.

MattL
  • 1,132
  • 10
  • 23
  • 3
    You might want to edit this answer to make it clear that this means "no" to my original question -- distutils can't be told to ignore symlinks because under the hood it's not aware of them. – foobarbecue Apr 29 '15 at 21:45