Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I ignore symlinks in setuptools MANIFEST.in?

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.

like image 236
foobarbecue Avatar asked Oct 18 '13 22:10

foobarbecue


People also ask

What is the use of setuptools?

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 .

What is MANIFEST in used for?

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.

What does python Sdist do?

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.

What is the command used for building a source distribution?

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.


1 Answers

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.

like image 97
MattL Avatar answered Sep 24 '22 23:09

MattL