[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
substitute datadir in python script
From: |
Bastien Dalla Piazza |
Subject: |
substitute datadir in python script |
Date: |
Sat, 07 Mar 2009 13:51:32 +0100 |
Hi all,
I'm developing an application with mixed C++ and python.
I wonder how to do the following:
let's assume "alib.la" is a python extention library installed in
$(pyexecdir) which depends on the prefix given by the user.
Up to now, I was substituting the absolute directories path at install
time using "sed" on my scripts source files, so adding to Makefile.am:
ascript.py: ascript_src.py
sed -e
"s#sys.append('pyexecdir')#sys.append('$(pyexecdir)')#g;s#datadir#
$(datadir)/@PACKAGE@/#g" ascript_src.py > ascript.py
substituting "pyexecdir" in order to allow "import alib" in the
installed scripts and "datadir" to allow access to the installed data
files (like images).
This solution feels a bit clumsy because I need the file names
"ascript_src.py" and "ascript.py" to deferenciate the original and the
substituted files.
I think I need an equivalent in python of the "config.h" header file,
but where to install it? Or is there a standard way to achieve the
substitutions?
Thanks!
- substitute datadir in python script,
Bastien Dalla Piazza <=