Want to create python source distribution by running python setup.py sdist from a directory outside of the one I want to package up. Can't seem to find a way to do this. I have a script that generates a setup.py and MANIFEST.in dynamically, and I'd like to tell python to use those files to create an sdist of the source in a different directory "over there".
What I'm doing is creating a script that lets a user create an sdist w/o any setup.py etc. They just say "package up this directory and everything under it". So I generate a setup.py and MANIFEST.in (with recursive-include * to grab all files) in a python tempfile.mkdtemp directory (in an unrelated file path like /tmp/whatever) that I can clean up afterwards...but I can't seem to use those to package their directory. I don't want to create those files in their source dir.
You can use setuptools's,
--dist-dir=DIR/-d DIRoption to specify where the otherwise default dist/-folder is made. In other words, this changes the output directory.E.g.:
If you are using
distutils.core: Instead of usingfrom distutils.core import setupyou can usefrom setuptools import setup.In order to define where the source directories come from, I think you can add the directory to
sys.pathand thensetup()will discover the content files automatically: