[Distutils] separate software from data

David Arnold davida@pobox.com
Fri Apr 12 23:35:01 2002


-->"Mark" == Mark McEahern <marklists@mceahern.com> writes:

  Mark> Here's the short form of my question: How do people generally
  Mark> keep their Python modules and any configuration data for those
  Mark> Python modules separate?

i use the distutils/setup.py data_files option.

  Mark> I'm looking for both conventions (e.g., config goes in
  Mark> /etc/foo) and mechanics (e.g., use distutils with options x,
  Mark> y, and z).

i put static config into $(PREFIX)/etc.

here's a cutting from my setup.py

<...>
       data_files = [("info", ["doc/pe4.info"]),
                     ("doc", ["doc/pe4.pdf", "doc/pe4.html"]),
                     ("etc", ["etc/pe4_client.pem", "etc/pe4_elvin_ca.pem"]),
                     ]
<...>


  Mark> Install my module here:
  Mark>   /usr/local/lib/pythonX.Y/site-packages/

  Mark> By default, place configuration data here:
  Mark>   /etc/my-package/

normally, configuration data for /usr/local packages would go into
/usr/local/etc (ie. /usr/local is the install prefix).

  Mark> Has anybody tackled this problem or do most folks just punt on
  Mark> this issue and assume they can plop configuration information
  Mark> alongside their distributed modules without providing any easy
  Mark> way for the person who installs it to override that?

it's a problem.

where you run into distutils limits like this, at least you have the
option to sub-class the actions (i override the install class, for
example).

the biggest problem is the lack of documentation -- you really have to
just read the code.





d