Produce .pyc without execution

Adrian Eyre a.eyre at
Mon Nov 1 10:50:39 CET 1999

> However, I could not decently propose this scheme for integration in
> Automake, and that makes it a bit unsatisfactory.  It would be nicer,
> for example, if `src/*.py' files were recompiled into the `src/' build
> hierarchy from the `src/' distribution hierarchy, and then installed
> from there. But `compileall' wants to install compiled files next to
> sources in the same directory, which is a bit inconvenient.  Any simple
> solution?

This is the default behaviour for Python, and without modifying its source
the .pyc will always be created in the same dir as the source. Can't you
add something like:

	@echo 'import compileall; compileall.compile_dir("$(pkgdatadir)")' \
	| $(PYTHON); \
	for pyc in $(pkgdatadir)/*.pyc; do mv $$pyc somewhere_else/; done

Adrian Eyre <mailto:a.eyre at>
Optichrome Computer Solutions Ltd
Maybury Road, Woking, Surrey, GU21 5HX, UK
Tel: +44 1483 740 233  Fax: +44 1483 760 644 

More information about the Python-list mailing list