distutils - how to get more flexible configuration

J

Jonathan Fine

Hello

I'm writing a package that has cgi-bin scripts, html
files and data files (templates used by cgi scripts).
I find that using distutils in the standard way
does not give me enough flexibilty, even if I use
a setup.cfg.

For example, I want certain data files to go to
markedly different locations.

However, I have come up with a solution, that looks
like it will work for me, and I'd welcome comments.

Here's the MANIFEST file
===
setup.py
myproj_cfg.py
data/wibble.txt
data/wobble.txt
===

And here's the setup.py file I've written
===
from distutils.core import setup
import myproj_cfg

data_files = [
(myproj_cfg.wibble, ['data/wibble.txt']),
(myproj_cfg.wobble, ['data/wobble.txt']),
]

setup(data_files=data_files)
===

The user is asked to create a myproj_cfg.py file,
which might look like
===
wibble = '/wibble'
wobble = '/wobble'
===

And when a distribution is created and installed
we get
===
$ python setup.py install
running install
running build
running install_data
creating /wibble
copying data/wibble.txt -> /wibble
creating /wobble
copying data/wobble.txt -> /wobble
===

This is an example of what I want. I'd welcome
your comments.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top