Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--master-dir '{tmp}' while interpolating #1040

Closed
simoncozens opened this issue Sep 20, 2023 · 5 comments
Closed

--master-dir '{tmp}' while interpolating #1040

simoncozens opened this issue Sep 20, 2023 · 5 comments

Comments

@simoncozens
Copy link
Contributor

For ninja reasons I need to generate instance UFOs separately and in parallel, so I am doing the equivalent of

$ fontmake -i "Noto Sans Hebrew ExtraLight" -o ufo -g NotoSansHebrew.glyphs --instance-dir instance_ufos/ &
$ fontmake -i "Noto Sans Hebrew Light" -o ufo -g NotoSansHebrew.glyphs --instance-dir instance_ufos/ &
$ fontmake -i "Noto Sans Hebrew Regular" -o ufo -g NotoSansHebrew.glyphs --instance-dir instance_ufos/ &
...

(Yes, it would be more efficient to only run fontmake -i once, because otherwise you're redundantly generating all the master UFOs each time. I know.)

However, even running two fontmake -o ufo -i in parallel leads to a race:

$ fontmake -i "Noto Sans Hebrew ExtraLight" -o ufo -g NotoSansHebrew.glyphs --instance-dir instance_ufos/ &; fontmake -i "Noto Sans Hebrew Light" -o ufo -g NotoSansHebrew.glyphs --instance-dir instance_ufos/
[1] 50969
INFO:fontmake.font_project:Building master UFOs and designspace from Glyphs source
INFO:fontmake.font_project:Building master UFOs and designspace from Glyphs source
INFO:glyphsLib.parser:Parsing .glyphs file
INFO:glyphsLib.parser:Parsing .glyphs file
fontmake: Error: In 'master_ufo/NotoSansHebrew-Light.ufo': Writing UFO source failed: [Errno 2] No such file or directory: 'kafrafe-hb.glif'

This is obviously happening because both processes are trying to write to the master_ufo directory at the same time.

I know, I thought; there's an option to allow temporary master_ufo directory. Yet:

$ fontmake -i "Noto Sans Hebrew Condensed Thin" --master-dir '{tmp}' -o ufo -g NotoSansHebrew.glyphs --instance-dir instance_ufos/

fontmake: error: Can't use temporary master directory with 'ufo' output

This error is understandable when the masters are the target of the operation; but it's less useful when the instance UFOs are the target. However, overriding the check when args["interpolate"] is true causes even stranger issues:

fontmake: Error: In 'NotoSansHebrew.glyphs' -> '../../../../../../var/folders/jp/4p0m9zvx2l739tdpflm38kv40000gn/T/master_dir_eoi2bbvr/NotoSansHebrew.designspace': Generating fonts from Designspace failed: [Errno 13] Permission denied: '/var/folders/jp/4p0m9zvx2l739tdpflm38kv40000gn/T/master_dir_eoi2bbvr/../../../../../../Users'
@simoncozens
Copy link
Contributor Author

I'm not entirely clear why fontmake -i needs to write master UFOs to disk anyway.

@anthrotype
Copy link
Member

wait I thought I had removed the need to write master UFOs to disk with #1020... have I not?

@anthrotype
Copy link
Member

can you try to use --output-dir instead of --instance-dir?

@anthrotype
Copy link
Member

anthrotype commented Sep 20, 2023

# only save *master* UFOs when explicitly requested: i.e. outputs contain
# 'ufo' and the -i/--interpolate option was not passed (that's for *instances*)
# or a --master-dir was set
save_ufos = "ufo" in output and (not interpolate or master_dir is not None)

# let --output-dir override the instance UFO directory
if output_dir is not None:
instance_dir = output_dir

@simoncozens
Copy link
Contributor Author

You're right; with a new fontmake it works fine. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants