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

Request: ability to use system-packaged Fontawesome if found? #25

Open
mattdm opened this issue Dec 17, 2021 · 3 comments
Open

Request: ability to use system-packaged Fontawesome if found? #25

mattdm opened this issue Dec 17, 2021 · 3 comments

Comments

@mattdm
Copy link

mattdm commented Dec 17, 2021

In Fedora, we have FontAwesome as an included package, and our packaging guidelines require bundled fonts to be ... debundled.

I've patched this in to my package build scripts (see https://mattdm.org/misc/fedora/pywaffle/python-pywaffle.spec), but it would be ideal if the library just noticed and used those. I guess this could be a "build time" thing, but I'm thinking maybe if

/usr/share/fonts/fontawesome5-free-fonts/Font Awesome 5 Free-Regular-400.otf
/usr/share/fonts/fontawesome5-free-fonts/Font Awesome 5 Free-Solid-900.otf
/usr/share/fonts/fontawesome5-brands-fonts/Font Awesome 5 Brands-Regular-400.otf

are installed, those could be automatically used -- with the mappings created at runtime from /usr/share/fontawesome5/metadata/icons.json.

That'd also benefit people who install via pip or whatever.

What do you think?

@gyli
Copy link
Owner

gyli commented Dec 18, 2021

A major concern I have is the package is unlikely to be packaged and distributed for specific systems or system versions, in order to remain simple. So I don't see a way I can debundle the fonts for Fedora users only. If the package will ship with fonts anyways, it would be meaningless to use the system's fonts and generate mapping on it.

I am also thinking if it is feasible to create dedicated dependencies for Fedora. By checking PEP-508, I don't find an environment marker that can return Linux distro name.

Do you have any idea how it can be debundled for Fedora, or do you have any other Python packages as an example?

@mattdm
Copy link
Author

mattdm commented Dec 18, 2021

What I'm currently doing:

  1. Patch pywaffle/fontawesome/__init__.py to look at the system paths
  2. Patch pywaffle/scripts/get_fontawesome.py to load the JSON from the local file in its Fedora location rather than a web URL (also removing requests, as that's not needed)
  3. Run that script to regenerate pywaffle/fontawesome_mapping.py so it matches what's available in the local font.
  4. Package that up into an RPM.

This is fine, but it means people will get a different experience if they install from pypi. Let me check with our python packaging experts and see what they think we should do.

@gyli
Copy link
Owner

gyli commented Dec 18, 2021

Yeah, please let me know if I can package it in a different way, and ideally we can make it smaller for Fedora users.

FYI, I moved pywaffle/scripts/get_fontawesome.py to scripts/get_fontawesome.py to avoid confusion, as it's not included in the package, but only for development.

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

No branches or pull requests

2 participants