X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=buildscripts%2Fmass-link.py;h=113495512d8c7394d0356efd05cc7f5694b4be3d;hb=eb452cb7c7e6c35b8d60700fca2f9de69822a4a9;hp=61ea81e2db40a5f24036ab3117c3614be2294e3e;hpb=7a85defdf1fc9147c8d5713dc86d8e2af2adc075;p=lilypond.git diff --git a/buildscripts/mass-link.py b/buildscripts/mass-link.py index 61ea81e2db..113495512d 100644 --- a/buildscripts/mass-link.py +++ b/buildscripts/mass-link.py @@ -5,20 +5,23 @@ # # create hard or symbolic links to SOURCEDIR/FILES in DESTDIR # -# if --prepend-suffix is specified, link to foo.bar will be called fooSUFFIX.bar -# shell-wildcard expansion is performed on FILES. - -print "mass_link.py" +# If --prepend-suffix is specified, link to foo.bar will be called fooSUFFIX.bar. +# Shell wildcards expansion is performed on FILES. import sys import os import glob import getopt +print "mass-link.py" + optlist, args = getopt.getopt (sys.argv[1:], '', ['prepend-suffix=']) link_type, source_dir, dest_dir = args[0:3] files = args[3:] +source_dir = os.path.normpath (source_dir) +dest_dir = os.path.normpath (dest_dir) + prepended_suffix = '' for x in optlist: if x[0] == '--prepend-suffix': @@ -46,7 +49,12 @@ sourcefiles = [] for pattern in files: sourcefiles += (glob.glob (os.path.join (source_dir, pattern))) -destfiles = map (lambda f: os.path.join (dest_dir, insert_suffix (os.path.basename (f))), sourcefiles) +def relative_path (f): + if source_dir == '.': + return f + return f[len (source_dir) + 1:] + +destfiles = map (lambda f: os.path.join (dest_dir, insert_suffix (relative_path (f))), sourcefiles) def force_link (src,dest): if os.path.exists (dest):