Closed uliska closed 9 years ago
@PeterBjuhr @davidnalesnik @fedelibre @janek-warchol @PaulMorris
Would you mind having a look at that and test and comment? I'd be happy to have that merged soon.
@uliska looks promising! I have time to test it later today. But I have one question (sorry if the answer to this is obvious!): I've already added a font manually to the LilyPond fonts folder. Am I required to have a clean build while doing the test?
No, this actually is a good test case. If the script determines the files inside the font dir to be out-of-date (which it should always do when you run it for the first time because it doesn't find a local font catalog file) it should replace existing files with new links.
So what you could do is make a backup, just in case ...
Thanks, I'll give you a report later then!
I think something went wrong...
I think there's an obscurity on the exact LilyPond path required, but I tried this:
python install-lily-fonts.py /home/peter/lilypond-xtra/lily-fonts /home/peter/lilypond-xtra/lilypond-builds/current
The message was:
Processing dir: /home/peter/lilypond-xtra/lily-fonts
But nothing was added to that folder. And didn't notice any change in the fonts folder either.
I was running the wrong script, sorry! I'll return shortly with a new report.
Update:
It was the script in openlilylib/fonts
.
I didn't try this out, but did you use exactly this command line? I think you should use the -d option for the font directory and the -t option for the LilyPond installation directory.
Yes, now I found the right script and ran this:
python install-lily-fonts -d /home/peter/lilypond-xtra/lily-fonts -t /home/peter/lilypond-xtra/lilypond-builds/current
The fonts were added to the fonts folder. But I got this:
Some links for font Scorlatti could not be installed: /home/peter/lilypond-xtra/lily-fonts/scorlatti/otf/scorlatti-20.otf/home/peter/lilypond-xtra/lily-fonts/scorlatti/otf/scorlatti-11.otf/home/peter/lilypond-xtra/lily-fonts/scorlatti/otf/scorlatti-16.otf/home/peter/lilypond-xtra/lily-fonts/scorlatti/otf/scorlatti-26.otf/home/peter/lilypond-xtra/lily-fonts/scorlatti/otf/scorlatti-18.otf/home/peter/lilypond-xtra/lily-fonts/scorlatti/otf/scorlatti-13.otf/home/peter/lilypond-xtra/lily-fonts/scorlatti/otf/scorlatti-23.otf/home/peter/lilypond-xtra/lily-fonts/scorlatti/otf/scorlatti-14.otf/home/peter/lilypond-xtra/lily-fonts/scorlatti/svg/scorlatti-11.woff/home/peter/lilypond-xtra/lily-fonts/scorlatti/svg/scorlatti-13.svg/home/peter/lilypond-xtra/lily-fonts/scorlatti/svg/scorlatti-13.woff/home/peter/lilypond-xtra/lily-fonts/scorlatti/svg/scorlatti-14.woff/home/peter/lilypond-xtra/lily-fonts/scorlatti/svg/scorlatti-20.woff/home/peter/lilypond-xtra/lily-fonts/scorlatti/svg/scorlatti-18.svg/home/peter/lilypond-xtra/lily-fonts/scorlatti/svg/scorlatti-16.woff/home/peter/lilypond-xtra/lily-fonts/scorlatti/svg/scorlatti-14.svg/home/peter/lilypond-xtra/lily-fonts/scorlatti/svg/scorlatti-23.svg/home/peter/lilypond-xtra/lily-fonts/scorlatti/svg/scorlatti-11.svg/home/peter/lilypond-xtra/lily-fonts/scorlatti/svg/scorlatti-26.woff/home/peter/lilypond-xtra/lily-fonts/scorlatti/svg/scorlatti-20.svg/home/peter/lilypond-xtra/lily-fonts/scorlatti/svg/scorlatti-23.woff/home/peter/lilypond-xtra/lily-fonts/scorlatti/svg/scorlatti-18.woff/home/peter/lilypond-xtra/lily-fonts/scorlatti/svg/scorlatti-26.svg/home/peter/lilypond-xtra/lily-fonts/scorlatti/svg/scorlatti-16.svg
It was Scorlatti that I'd previously installed.
OK, I'll look into it.
I assume that I deliberately chose only to remove symlinks and let the script fail on removing physical files. I think this is a good idea, but could be "communicated" in a better way.
Yes, the real file are still there and no symlinks for Scorlatti.
Should I remove the files and run again or do you want to test this case some more?
Determined LilyPond font root directories:
- /home/peter/lilypond-xtra/lilypond-builds/current/out/share/lilypond/current/fonts No local catalog found. Assuming you want to create a new local repository.
I guess this is expected when running for the first time!?
Running without the -t
option you'd get a Python error:
Traceback (most recent call last): File "install-lily-fonts", line 26, in
main() File "install-lily-fonts", line 17, in main Config.read_args() File "/home/peter/lilypond-xtra/openlilylib/openlilylib/py/font-install/util/config.py", line 193, in read_args Config._lilypond_font_roots = Config._get_lilypond_font_paths(args['targets']) File "/home/peter/lilypond-xtra/openlilylib/openlilylib/py/font-install/util/config.py", line 113, in _get_lilypond_font_paths for lily in [l for l in arg_dirs]: TypeError: 'NoneType' object is not iterable
Determined LilyPond font root directories: * /home/peter/lilypond-xtra/lilypond-builds/current/out/share/lilypond/current/fonts No local catalog found. Assuming you want to create a new local repository.
I guess this is expected when running for the first time!?
Yes, this is expected. The "font catalog" is a file that is used to compare the local repository with the remote one, which can detect updated and new fonts. When this is missing it is assumed that the script is run for the first time. However, this could also indicate that the entered argument was wrong. So it could also be a good idea to ask what to do: Create new, enter another directory or abort. What do you think?
Am 17.03.2015 um 18:43 schrieb Peter Bjuhr:
Running without the |-t| option you'd get a Python error:
Traceback (most recent call last): File "install-lily-fonts", line 26, in main() File "install-lily-fonts", line 17, in main Config.read_args() File "/home/peter/lilypond-xtra/openlilylib/openlilylib/py/font-install/util/config.py", line 193, in read_args Config._lilypond_font_roots = Config._get_lilypond_font_paths(args['targets']) File "/home/peter/lilypond-xtra/openlilylib/openlilylib/py/font-install/util/config.py", line 113, in _get_lilypond_font_paths for lily in [l for l in arg_dirs]: TypeError: 'NoneType' object is not iterable
This should not be the case. Please try again, I think I've made the option required now.
Yes, it's fixed!
However, this could also indicate that the entered argument was wrong. So it could also be a good idea to ask what to do: Create new, enter another directory or abort. What do you think?
If there's any risk of creating the "font catalog" in the wrong place I think it should be carefully considered.
Am 17.03.2015 um 21:03 schrieb Peter Bjuhr:
However, this could also indicate that the entered argument was wrong. So it could also be a good idea to ask what to do: Create new, enter another directory or abort. What do you think?
If there's any risk of creating the "font catalog" in the wrong place I think it should be carefully considered.
Well, the "risk" is that an extra copy of the font archives is downloaded to the other location, so it's not "destructive". However, it's not how such a script should behave, so I'll change the behaviour.
However, there's one question to that: I have a --batch option which will be used for example on our Travis testing server. There I'll have to decide whether the given situation will overwrite or abort. What would be appropriate? If it would abort I'd need another option, e.g. -i --init to explicitly tell the script that we want to create a new local repository.
However, there's one question to that: I have a --batch option which will be used for example on our Travis testing server. There I'll have to decide whether the given situation will overwrite or abort. What would be appropriate? If it would abort I'd need another option, e.g. -i --init to explicitly tell the script that we want to create a new local repository.
But of course an init option would be no guarantee that the installation is made in the right location. Could you somehow add a check instead? For example check that the path ends with /lilypond/current/fonts
.
Am 17. März 2015 21:27:53 MEZ, schrieb Peter Bjuhr notifications@github.com:
However, there's one question to that: I have a --batch option which will be used for example on our Travis testing server. There I'll have to decide whether the given situation will overwrite or abort. What would be appropriate? If it would abort I'd need another option, e.g. -i --init to explicitly tell the script that we want to create a new local
repository.
But of course an init option would be no guarantee that the installation is made in the right location. Could you somehow add a check instead? For example check that the path ends with
/lilypond/current/fonts
.
No, the place where the actual font repo is stored is completely arbitrary and not related to any LilyPond installation (that's why we do it with the links in the first place). So an --init option just would tell the script that it is intentional that the catalog file is not found.
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.
Sorry, I got the impression that we were discussing what happens when a user enters the wrong path to LilyPond. I was unsure myself if I was suppose to go deeper in the file tree.
Am 17.03.2015 um 22:54 schrieb Peter Bjuhr:
Sorry, I got the impression that we were discussing what happens when a user enters the wrong path to LilyPond. I was unsure myself if I was suppose to go deeper in the file tree.
No, when the script doesn't find a valid LilyPond installation it aborts with the respective message. Of course we don't want to "install" links into invalid locations.
I've now changed the behaviour when the font catalog file or the directory given with -d
is not present.
I don't assume anymore automatically that the repository should be created from scratch.
If the option -i --init
is present the directory/catalog will implicitly be created. If not the user is asked if he wants to create it.
One general comment : I think this will not easily work on Windows. Or in other words: it will take some considerable knowledge to make this happen
This means we should not take too much time to figure out what to do with it. If it runs reasonably stable on Linux and Mac we should merge it.
Yes, the real file are still there and no symlinks for Scorlatti. Should I remove the files and run again or do you want to test this case some more?
@uliska have you thought more about what should happen in my situation with font files already present? At first glance I think it would be good if the files were removed and replaced by links, but I have not the full overview of this.
Well, I have for now changed the error message so now it indicates that existing physical copies may be the reason. That way you can decide to manually remove the copies and rerun the script. But yes, it would probably be good to suggest the user if he wants to replace the files with the links.
This question would probably have to be made for each font (set) in each LilyPond installation. And as this might become quite tedious the answer should probably contain a switch to "remember" the decision.
@PeterBjuhr I've now modified the behaviour with regard to existing physical font copies:
Could you please test that against your remaining Scorlatti fonts?
I ran the script again, but nothing happened. Maybe the LilyPond fonts folder isn't checked when the external folder is in place!?
Should I go back one step?
I think the script simply compares the names of the font "files" in the Lily folder with that of the font "repository". If they're the same it is considered up-to-date (repo<->installation), and when the remote one isn't newer nothing will be done. What you can do (just for testing purposes) is add an empty file in the font folder whose name starts with the font name (-> scorlatti-NNN.NNN). This should trigger the process of clearing and recreating the links in the Lily font directory.
Yes, now it's working nicely! Thanks.
I'm merging this now without having updated the README.
The reason for this is that I'll immediately move this script/program to its own, new repository. I think this should be available without requiring openLilyLib
. Not only for LilyPond users who shouldn't be enforced to have it, but also for maintainers of IDEs who might want to use it, and users of lilyglyphs
who might not even be LilyPond users.
Script to manage a local font catalog, keep it in sync with http://fonts.openlilylib.org and update an arbitrary number of local LilyPond installations by adding links to the actual font files inside the LilyPond installation(s).
For more information on the concept and usage of the script please refer to the README.md file and/or the help with
python py/font-install/install-lily-fonts --help