Accessing files installed with distutils

timothy.williams at nvl.army.mil timothy.williams at nvl.army.mil
Tue Mar 8 14:32:56 CET 2005


I was wondering how to do this too. I'm trying to write a distutils
setup.py script that has some data I'd like to include.  From the
distutils docs I get

data_files specifies a sequence of (directory, files) pairs in the
following way:

setup(...
      data_files=[('bitmaps', ['bm/b1.gif', 'bm/b2.gif']),
                  ('config', ['cfg/data.cfg']),
                  ('/etc/init.d', ['init-script'])]
     )

I can use sys.prefix to find the top level where python is installed,
but this doesn't tell me specifically where site-packages is. On my
Linux box it is in

{sys.prefix}/lib/python2.3/site-packages

but on Windows, it's in

{sys.prefix}/Lib/site-packages.

Do I need to use sys.platform (along with sys.version) to check what
type of machine I'm on, or is there some better  method to get the
location of site-packages?

Thanks.




More information about the Python-list mailing list