Produce .pyc without execution

Adrian Eyre a.eyre at optichrome.com
Mon Nov 1 04:50:39 EST 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:

install-data-hook:
	@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.com>
Optichrome Computer Solutions Ltd
Maybury Road, Woking, Surrey, GU21 5HX, UK
Tel: +44 1483 740 233  Fax: +44 1483 760 644
http://www.optichrome.com 
--------------------------------------------





More information about the Python-list mailing list