Account Options

  1. Sign in
Google Groups Home
« Groups Home
A solution to distutils' habit of installing data_files inconsistantly
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Lonnie Princehouse  
View profile  
 More options Apr 14 2004, 5:27 pm
Newsgroups: comp.lang.python
From: fn...@u.washington.edu (Lonnie Princehouse)
Date: 14 Apr 2004 14:27:00 -0700
Subject: A solution to distutils' habit of installing data_files inconsistantly
I've just spent an hour or so being frustrated at the way distutils
installs data files, and a quick search of c.l.py shows that I'm not
the first.  For posterity, here's an easy (albeit limited) solution.

The Problem:
    Distutils installs data files by default in sys.prefix or
sys.exec_prefix, and the installation location is not always
consistant between Win32 and Unix.  This means that you have to
duplicate distutils' logic in order to find out where your package's
data files got installed :(
    What you really want is to have your data files in the same place
as your Python code, so that you can find them easily.

The Solution:
   More complicated packages like PyXML and OpenGLContext address this
by subclassing distutils.command.install_data and/or
distutils.command.install, and then using the cmdclass argument to
setup() to override distutils' built in command handlers.  This is
overkill if you only have a few data files and you just want them to
go into the same directories as your Python code.  Here's an easier
way.  Do this before you call setup():

from distutils.command.install import INSTALL_SCHEMES

for scheme in INSTALL_SCHEMES.values():
    scheme['data'] = scheme['purelib']

Alternately, that should read 'platlib' instead of 'purelib' if your
data files are platform specific.

This sets the default data directory to the default pure python
directory, lib/site-packages in most cases.

-ljp


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »