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.
Setuptools is a collection of enhancements to the Python distutils that allow developers to more easily build and distribute Python packages, especially ones that have dependencies on other packages. Packages built and distributed using setuptools look to the user like ordinary Python packages based on the distutils .
The MANIFEST.in file contains commands that allow you to discover and manipulate lists of files. There are many commands that can be used with different objectives, but you should try to not make your MANIFEST.in file too fine grained.
The sdist command processes this template and generates a manifest based on its instructions and what it finds in the filesystem. If you prefer to roll your own manifest file, the format is simple: one filename per line, regular files (or symlinks to them) only.
To build a source distribution, use the command line to navigate to the directory containing setup.py, and run the command python setup.py sdist.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With