Mercurial python packages need a

Tags: python

I released sdistmaker last Thursday (see your own pypi).

The original tha.sdistmaker code was in my former employee’s subversion repository. I now renamed it to sdistmaker and put it into my bitbucket account), which means I now use mercurial (hg) for it instead of subversion.

Setuptools automatically picks up all files in your python package that you put into subversion, so also files like TODO.txt. But mercurial isn’t recognized (unless you install mercurial support from hg.setuptools).

Oopsie, this meant that my TODO.txt wasn’t automatically included in the source distribution as I switched from subversion to mercurial. And my reads TODO.txt for the long description, so refused to run: sdistmaker was uninstallable…

Luckily my brother Maurits (thanks!) noticed it and pushed out a new release that fixed it temporarily.

How to really fix it: a Setuptools/distutils/distribute picks up a lot of things by default. The, the python files in your package, a README, C source files that you build, etc. But not the rest of the .txt files, for instance. The full mechanism is described in . What I did was add a right next to my

include *.txt
recursive-include sdistmaker *.txt *.py

The first line includes the TODO.txt, CREDITS.txt and so in the package root. The second line looks inside the sdistmaker/ directory and recursively includes everything ending in .txt and .py.

Tadaah, now you get a proper release with mercurial (or git or bazaar), too. Without needing to install setuptools add-ons on every machine where you make releases. logo

About me

My name is Reinout van Rees and I work a lot with Python (programming language) and Django (website framework). I live in The Netherlands and I'm happily married to Annie van Rees-Kooiman.

Weblog feeds

Most of my website content is in my weblog. You can keep up to date by subscribing to the automatic feeds (for instance with Google reader):