Install data problems
Adriaan de Groot <adridg-FlD2LfDziEhmR6Xm/[email protected]>
| Newsgroups | gmane.comp.tools.aap.devel |
|---|---|
| Message-ID | <[email protected]> |
The addition of scopes has made INSTALL_DATA a little less easy to use than it
used to be: instead of writing INSTALL_DATA += whatever, you need to write
_top.INSTALL_DATA, in order to ensure that a parent toplevel recipe (if any)
gets the files. In addition, because you need to specify paths relative to
the toplevel recipe, you always need $TOPDIR, so a typical line would read:
_top.INSTALL_DATA += $TOPDIR/$*datafiles
instead of
INSTALL_DATA += $datafiles
A far cry, indeed, in terms of usability. But, power has its price, so let's
leave this.
In addition, the use of $TOPDIR makes {keepdir} as an attribute kind of
useless: if there is a parent recipe, you probably don't want $TOPDIR
included in the installed path. The same goes for headers: if there's a
parent recipe, you don't want to involve $TOPDIR, but might still want to
install a specific header in include/sys, as opposed to just include/.
What to do?
One approach would be to not use INSTALL_DATA at all, and have recipes add
dependencies for install-dat instead, something like this:
install-data : $datafiles
@for i in str2list(datafiles):
@install_files(dest,i) # If "files" is taken literally, can skip the for
loop
while that's workable, to be sure, it seems more clumsy than it needs to be. I
like the INSTALL_DATA approach myself, mostly because it looks shorter than
the dependency approach.
The attached patch adds a new {installdir} attribute for installing files. You
can set it to the relative path (relative to the relevant $...DIR) where you
want the file to be installed. For instance
INSTALL_HEADER += $TOPDIR/time.h { installdir=sys }
will install time.h in $INCLUDEDIR/sys/time.h.
--
pub 1024D/FEA2A3FE 2002-06-18 Adriaan de Groot <[email protected]>
Key fingerprint = 934E 31AA 80A7 723F 54F9 50ED 76AC EE01 FEA2 A3FE
aap-installdir.diff
(text/x-diff, 747 B)
--- RecPython.py.orig Mon Aug 11 23:42:20 2003
+++ RecPython.py Tue Aug 12 00:19:41 2003
@@ -772,8 +772,14 @@
destloc = dest
# with {keepdir} append the directory of the source.
- if item.get("keepdir"):
- destloc = os.path.join(destloc, os.path.dirname(name))
+ if item.get("installdir"):
+ destloc = os.path.join(destloc, item.get("installdir"))
+ if item.get("keepdir"):
+ msg_warning(recdict, _('"%s" sets both "keepdir" and "installdir"')
+ % name )
+ else:
+ if item.get("keepdir"):
+ destloc = os.path.join(destloc, os.path.dirname(name))
destname = os.path.join(destloc, os.path.basename(name))
scheme, mach, path = url_split3(destname)