Skip to content

Commit

Permalink
Improve wording about new install method
Browse files Browse the repository at this point in the history
Display informative message when users forget to install the `extra` needed for the vendor-specific profile they're trying to run
(issue fonttools#4292)
  • Loading branch information
felipesanches committed Oct 10, 2023
1 parent 9036a55 commit ee1f654
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 18 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ A more detailed list of changes is available in the corresponding milestones for
### Release notes
- This release adds support for marking checks as **experimental**, which will make them not affect the process exit code and so will allow such checks to result in a FAIL without breaking continuous integration builds. This will give time for users to report problems on the implementation of new checks. If after some time nobody complains, then those new checks will more safely be made effective by removing their `experimental` tag.

- **Bugfix:** Display informative message when users forget to install the `extra` needed for the vendor-specific profile they're trying to run (issue #4292)

### New checks
#### Addded to the Google Fonts Profile
- **EXPERIMENTAL - [com.google.fonts/check/metadata/empty_designer]:** Any font published on Google Fonts must credit one or several authors, foundry and/or individuals. (issue #3961)
Expand Down
14 changes: 7 additions & 7 deletions Lib/fontbakery/profiles/googlefonts.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
)
from fontbakery.utils import exit_with_install_instructions

try:
from axisregistry import build_filename
except ImportError:
exit_with_install_instructions("googlefonts")

profile_imports = (
(".", ("googlefonts_conditions", "universal", "outline", "shaping", "ufo_sources")),
)
Expand Down Expand Up @@ -254,13 +259,8 @@
)
def com_google_fonts_check_canonical_filename(ttFont):
"""Checking file is named canonically."""
try:
from axisregistry import build_filename

current_filename = os.path.basename(ttFont.reader.file.name)
expected_filename = build_filename(ttFont)
except ImportError:
exit_with_install_instructions("googlefonts")
current_filename = os.path.basename(ttFont.reader.file.name)
expected_filename = build_filename(ttFont)

if current_filename != expected_filename:
yield FAIL, Message(
Expand Down
13 changes: 6 additions & 7 deletions Lib/fontbakery/profiles/shaping.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
from fontbakery.section import Section
from fontbakery.utils import exit_with_install_instructions

try:
from vharfbuzz import Vharfbuzz
except ImportError:
exit_with_install_instructions("shaping")

shaping_basedir = Path("qa", "shaping_tests")

Expand Down Expand Up @@ -152,13 +156,8 @@ def get_shaping_parameters(test, configuration):
def run_a_set_of_shaping_tests(
config, ttFont, run_a_test, test_filter, generate_report, preparation=None
):
try:
from vharfbuzz import Vharfbuzz

filename = Path(ttFont.reader.file.name)
vharfbuzz = Vharfbuzz(filename)
except ImportError:
exit_with_install_instructions("shaping")
filename = Path(ttFont.reader.file.name)
vharfbuzz = Vharfbuzz(filename)

shaping_file_found = False
ran_a_test = False
Expand Down
10 changes: 6 additions & 4 deletions Lib/fontbakery/profiles/ufo_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
from fontbakery.fonts_profile import profile_factory
from fontbakery.utils import exit_with_install_instructions

try:
import defcon
except ImportError:
exit_with_install_instructions("ufo-sources")


profile = profile_factory(default_section=Section("UFO Sources"))

Expand All @@ -26,13 +31,10 @@
@condition
def ufo_font(ufo):
from fontTools.ufoLib.errors import UFOLibError
import defcon

try:
import defcon

return defcon.Font(ufo)
except ImportError:
exit_with_install_instructions("ufo-sources")
except UFOLibError:
return None

Expand Down

0 comments on commit ee1f654

Please sign in to comment.