Renaming files in :copy?

Adriaan de Groot <[email protected]> Sat, 4 Feb 2006 01:04:08 +0100
Newsgroups gmane.comp.tools.aap.devel
Message-ID <[email protected]>
--nextPart20075708.z76Xc35tVk
Content-Type: multipart/mixed;
  boundary="Boundary-01=_49+4D6ta/x6APBF"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

--Boundary-01=_49+4D6ta/x6APBF
Content-Type: text/plain;
  charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

I have a source file foo.png and I want to copy it (on installation) to=20
location bar/blurfl.png and _rename_ it in the process (to blurfl.png, as y=
ou=20
can see). I don't see how this can be done with :copy, nor in the install=20
targets.=20

You may ask: why not just rename to blurfl in the source and be done with i=
t?=20
Well, there's various historic reasons,and compatibility with another build=
=20
system is one of them - for KDE icons, in particular, we use=20
theme-size-type-iconname, which gets installed to=20
theme/sizexsize/type/iconname . This is a mess, I know, but that's how it i=
s.=20
I have a python function in the KDE module to map one to the other (did I=20
mention that type needs to be munged to work? as well as theme?), but no wa=
y=20
to use this mapping in the regular install targets.

The attached patch adds an {installfile} attribute analogous to the=20
{installdir} attribute, which overrides the basename of the file to install=
=2E=20
Using {installdir} and {installfile} you can install a file to any location=
=20
you need.

Does this sound reasonable? If so, I'll write docs for it too.


=2D-=20
These are your friends - Adem
    GPG: FEA2 A3FE Adriaan de Groot

--Boundary-01=_49+4D6ta/x6APBF
Content-Type: text/x-diff;
  charset="us-ascii";
  name="aap.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="aap.patch"

Index: aap/RecPython.py
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=2D-- aap/RecPython.py	(revision 224)
+++ aap/RecPython.py	(working copy)
@@ -1154,7 +1154,10 @@
         elif item.get("keepdir"):
             destloc =3D os.path.join(destloc, os.path.dirname(name))
=20
=2D        destname =3D os.path.join(destloc, os.path.basename(name))
+	if item.get("installname"):
+            destname =3D os.path.join(destloc, item.get("installname"))
+	else:
+            destname =3D os.path.join(destloc, os.path.basename(name))
         scheme, mach, path =3D url_split3(destname)
=20
         if uninstall:

--Boundary-01=_49+4D6ta/x6APBF--

--nextPart20075708.z76Xc35tVk
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (FreeBSD)

iD8DBQBD4+95dqzuAf6io/4RAmu7AKCfwPapV55DXAlQyX54VhOdqLJiDACgh1LI
fMjR+aF0jMJQojjquOHWD3Q=
=IAuK
-----END PGP SIGNATURE-----

--nextPart20075708.z76Xc35tVk--


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642