[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Path expansion in lilypond-book (and others)
From: |
Chris Ritson |
Subject: |
Path expansion in lilypond-book (and others) |
Date: |
Fri, 26 Jul 2013 21:55:43 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
> From: Martin Tarenskeen
> Date: Fri, 22 Feb 2013 12:40:58 +0100 (CET)
>
> <snip>
> ERROR: In procedure primitive-load-path:
> ERROR: Unable to find file "lily.scm" in load path
The clue to this is in a later posting from Robert Eckl. lilypond-book is
using a construct
os.path.abspath(os.path.dirname(sys.argv[0]))
to locate itself and then to find the lilypond share directory from there.
On my system (now fedora 19) /bin is a symbolic link to /usr/bin, but there
is no equivalent link for /share. /bin is (rightly from the old days of Unix
Edition 6) before /usr/bin in my PATH. This leads to an invalid name for
lily.scm.
I think the right thing to do will be to add os.path.realpath to expand any
symbolic links giving the following patch:-
*** lilypond-book.orig 2013-07-26 22:29:10.369168798 +0100
--- lilypond-book 2013-07-26 22:28:30.423492984 +0100
***************
*** 71,77 ****
sys.path.insert (0, os.path.join (d, 'python'))
# dynamic relocation, for GUB binaries.
! bindir = os.path.abspath (os.path.dirname (sys.argv[0]))
for p in ['share', 'lib']:
datadir = os.path.abspath (bindir + '/../%s/lilypond/current/python/' % p)
sys.path.insert (0, datadir)
--- 71,77 ----
sys.path.insert (0, os.path.join (d, 'python'))
# dynamic relocation, for GUB binaries.
! bindir = os.path.abspath (os.path.dirname (os.path.realpath (sys.argv[0])))
for p in ['share', 'lib']:
datadir = os.path.abspath (bindir + '/../%s/lilypond/current/python/' % p)
sys.path.insert (0, datadir)
There appear to be similar issues in other places as well:-
/usr/bin/abc2ly:bindir = os.path.abspath (os.path.dirname (sys.argv[0]))
/usr/bin/convert-ly:bindir = os.path.abspath (os.path.dirname (sys.argv[0]))
/usr/bin/etf2ly:bindir = os.path.abspath (os.path.dirname (sys.argv[0]))
/usr/bin/lilymidi:bindir = os.path.abspath (os.path.dirname (sys.argv[0]))
/usr/bin/lilypond-book:bindir = os.path.abspath (os.path.dirname
(os.path.realpath (sys.argv[0])))
/usr/bin/lilysong:bindir = os.path.abspath (os.path.dirname (sys.argv[0]))
/usr/bin/midi2ly:bindir = os.path.abspath (os.path.dirname (sys.argv[0]))
/usr/bin/musicxml2ly:bindir = os.path.abspath (os.path.dirname (sys.argv[0]))
Can this be turned into a bug suggestion, please?
Chris Ritson
- Path expansion in lilypond-book (and others),
Chris Ritson <=