Distutils and binaries without compilation

Mark English Mark.English at liffe.com
Tue Sep 21 11:45:19 CEST 2004

The short version of this question is how do you include binaries in a
distribution without including their source ?

The long version follows...
I have a Python package I want to distribute internally to my company
which makes use of pure python modules and C-extensions (.pyd files)
under Windows (and hopefully one day Unix too). The build for the
extensions is large and arduous so I do not want to include the source.
I would rather just include the compiled binaries so that when the user
installs the package they are written into the relevant location and the
whole thing is ready to go.

My structure is something like:

	setup.py #Hard at work getting this to go

At the moment my setup script boils down to this call:
setup (name="Start",
	 packages= ["Start",

I run it as:
>>> python setup.py bdist

And end up with a zip file containing all the .py (and.pyc) files in the
correct structure but no .pyd files. I would rather not have to list
each Extension individually. I could probably include the .pyd files as
data files using glob, but this seems ugly. I've also tried adding a:
ext_modules=[Extension("Start.CompiledCExtensions", [""])] but Extension
objects really want some source to build.

If I use py2exe to compile a script which depends on this package, it
pulls in all the relevant parts just like I want, but of course I end up
with an executable rather than a "module distribution", and presumably
this would also be useless for Unix builds. I'm guessing there's some
easy way to do this which I haven't found yet, so I'd be grateful for
any insight.


The information contained in this e-mail is confidential and solely 
for the intended addressee(s). Unauthorised reproduction, disclosure, 
modification, and/or distribution of this email may be unlawful. If you 
have received this email in error, please notify the sender immediately 
and delete it from your system. The views expressed in this message 
do not necessarily reflect those of LIFFE Holdings Plc or any of its subsidiary companies.

More information about the Python-list mailing list