Ricardo Wurmus <[email protected]> skribis: > Ludovic Courtès <[email protected]> writes:
[...] >>> From cfda70fdd6448980df9ba4c22894198366a2846d Mon Sep 17 00:00:00 2001 >>> From: Ricardo Wurmus <[email protected]> >>> Date: Thu, 25 Feb 2016 09:46:01 +0100 >>> Subject: [PATCH 3/3] gnu: Add gtklick. >>> >>> * gnu/packages/music.scm (gtklick): New variable. >> >> [...] >> >>> + (modify-phases %standard-phases >>> + (add-before 'build 'add-sitedirs >>> + ;; .pth files are not automatically interpreted unless the >>> + ;; directories containing them are added as "sites". The >>> directories >>> + ;; are then added to those in the PYTHONPATH. This is required >>> for >>> + ;; the operation of pygtk. >> >> Strangely, other users of pygtk don’t do that, no? What’s special here? > > Some do (and I don’t know why). I lifted this phase from “solfege”, > which also won’t run without this. OK, fair enough. Eventually we’ll have to see if we can factorize this. >>> + (lambda _ >>> + (substitute* "gtklick/gtklick.py" >>> + (("import pygtk") >>> + "import pygtk, site, sys >>> +for path in [path for path in sys.path if 'site-packages' in path]: >>> site.addsitedir(path)")))) >> >> I guess it’s a list comprehension, but I’m a bit confused by the syntax >> and the various ‘path’. Oh well. :-) > > The Scheme equivalent is something like this: > > (for-each site.addsitedir > (filter (cut string-contains <> "site-packages") > sys.path)) > > The bracketed expression in Python is like the ‘(filter ...)’ > expression. Interesting, thanks for educating me. :-) So, OK to push! Ludo’.
