building a .py files with distutils

Albert Hofkamp hat at se-46.wpa.wtb.tue.nl
Mon Apr 7 07:36:33 EDT 2003


On Sat, 5 Apr 2003 10:15:19 -0600, Jeff Epler <jepler at unpythonic.net> wrote:
> I'm writing a program which uses a generated .py file (it's generated based
> on a yapps grammar file).  I know how to generate the .py file either as a 
> shell command (python yapps.py gram.g) or as a python expression
> (yapps.generate("gram.g"))

I had a similar problem with 'building' documentation files as preparation
of creating a distribution.

I wanted to do that in setup.py (i.e. I want to automate the building
process, I have a running Python interpreter, I have setup.py, so what's
the problem?)
After a few attempts to control the building process from Python (i.e.

import ftlib,distutils,sys
build_documentation()
distutils.build_my_package(srcdir='.',tgt=['src','rpm'],version=sys.argv[1])
ftplib.ftp_result_to_website()

), I switched to having a shell-script outside distutils that did the
preparation, then it calls distutils to build the source and binary
distributions.

There are still a few problems (for example, I'd like to have distutils
take the version number as a parameter instead of a hard-coded value in
setup.py), but it works.



Albert
-- 
Unlike popular belief, the .doc format is not an open publically available format.




More information about the Python-list mailing list