-
-
Notifications
You must be signed in to change notification settings - Fork 627
Refactor build scripting to support Python 3 only builds, pinned build dependency versions, optional system installed build dependencies #416
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
Changes from 32 commits
8490024
384f3fa
fe6e6ba
e3c0e97
1700e78
74d359e
0eb8a96
176a14a
bda185c
da20882
7de5d65
10c5444
aff9f86
4d8a9a1
953c35b
14b1912
dd71f61
353455d
0da551b
c0f9b0c
f1c3c53
8b05246
63c6f05
83eac63
2b1d273
843e689
1028b7e
842a21f
4c48555
e20d786
0a01f04
96a35cb
ee180fb
8b7feda
d6df277
1dd3664
b1ebe12
bc6a683
2a46cad
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,65 @@ | ||
all: build | ||
|
||
archives: | ||
postbuild_processing/archive_prep/archiver.sh | ||
./build-archives.sh | ||
|
||
build: ttf webfonts | ||
|
||
build-with-dependencies: source/*.ufo | ||
./build-ttf.sh --install-dependencies | ||
./build-woff.sh --install-dependencies | ||
./build-woff2.sh --install-dependencies | ||
./build-subsets.sh | ||
build-with-dependencies: compile-local-dep ttf webfonts | ||
|
||
build-system: ttf-system webfonts-system | ||
|
||
build-local-ttfa: | ||
tools/scripts/install/ttfautohint-build.sh | ||
|
||
build-local-sfnt2woffzopfli: | ||
tools/scripts/install/sfnt2woff-zopfli-build.sh | ||
|
||
build-local-woff2: | ||
tools/scripts/install/woff2-compress-build.sh | ||
|
||
compile-local-dep: build-local-ttfa build-local-sfnt2woffzopfli build-local-woff2 | ||
|
||
css: | ||
tools/scripts/css/css-build.sh | ||
|
||
lint: shellcheck ufolint | ||
|
||
shellcheck: build-ttf.sh build-woff.sh build-woff2.sh build-subsets.sh tools/scripts/install/ttfautohint-build.sh postbuild_processing/archive_prep/archiver.sh tools/scripts/css/css-build.sh | ||
pipenv: | ||
./build-pipenv.sh | ||
|
||
shellcheck: *.sh tools/scripts/css/*.sh tools/scripts/install/*.sh | ||
$@ $^ | ||
|
||
subsets: source/*.ufo | ||
subsets: pipenv | ||
./build-subsets.sh | ||
|
||
ttf: | ||
subsets-system: | ||
./build-subsets.sh --system | ||
|
||
ttf: pipenv | ||
./build-ttf.sh | ||
|
||
ttf-system: | ||
./build-ttf.sh --system | ||
|
||
ufolint: source/*.ufo | ||
$@ $^ | ||
|
||
webfonts: | ||
./build-woff.sh | ||
./build-woff2.sh | ||
./build-subsets.sh | ||
webfonts: woff woff2 subsets | ||
|
||
woff: | ||
webfonts-system: woff-system woff2-system subsets-system | ||
|
||
woff: pipenv | ||
./build-woff.sh | ||
|
||
woff2: | ||
woff-system: | ||
./build-woff.sh --system | ||
|
||
woff2: pipenv | ||
./build-woff2.sh | ||
|
||
woff2-system: | ||
./build-woff2.sh --system | ||
|
||
.PHONY: all archives build build-with-dependencies build-local-ttfa build-local-sfnt2woffzopfli build-local-woff2 build-system compile-local-dep css lint pipenv shellcheck subsets subsets-system ttf ttf-system ufolint webfonts webfonts-system woff woff-system woff2 woff2-system |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[[source]] | ||
|
||
url = "https://pypi.python.org/simple" | ||
verify_ssl = true | ||
name = "pypi" | ||
|
||
|
||
[packages] | ||
|
||
fonttools = "*" | ||
fontmake = "*" | ||
|
||
|
||
[dev-packages] | ||
|
||
|
||
|
||
[requires] | ||
|
||
python_version = "3.6" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/bin/sh | ||
|
||
# ///////////////////////////////////////////////////////////////// | ||
# | ||
# build-pipenv.sh | ||
# A shell script that creates a virtualenv for Hack font builds | ||
# Copyright 2018 Christopher Simpkins | ||
# MIT License | ||
# | ||
# Usage: ./build-pipenv.sh | ||
# | ||
# ///////////////////////////////////////////////////////////////// | ||
|
||
BUILD_PYTHON_VERSION="3.6" | ||
|
||
if ! which pipenv | ||
then | ||
echo "Unable to detect a pipenv install. Please install with 'pip install pipenv' then repeat your build attempt." 1>&2 | ||
exit 1 | ||
fi | ||
|
||
# install fontTools and fontmake build dependencies with pipenv | ||
pipenv install --python $BUILD_PYTHON_VERSION --ignore-pipfile fontmake fontTools | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if you checked in the Pipfile (which already states the top-level dependencies), why do you need to duplicate them here on the command line? Shouldn't There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Believe that you are correct. We should be able to simply do this now that I have defined the venv in my development repo with the above command:
My understanding is that without the I will test in a cloned repo so that I can replicate what a user's development repo will see when they go through the build. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hm.. what's the point of you checking in the Pipfile.lock if you're going to ignore it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah, ok
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
correct. Because the abstract Pipfile is what generates the concrete Pipfile.lock (a bit like setup.py vs requirements.txt) If you did There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes, believe that this is correct Cosimo. Docs state that it is a goal of the project to use current versions of packages when possible for safety (security patch releases) reasons. You can default to Pipfile.lock specified pinned installs with the above flag as I understand it. Updated the shell script with your suggestion here and it is working as intended. It eliminates forced rebuilds of the entire venv with each font compile. Thanks for catching this! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will be interested to see how this works once system Py3 bumps to Py3.7 on my development machine. The intended behavior is for |
||
|
||
# test for fontmake install in venv | ||
if ! pipenv run fontmake --version | ||
then | ||
echo "Unable to detect fontmake install with pipenv. Please repeat your build attempt." 1>&2 | ||
exit 1 | ||
fi | ||
|
||
# test for fontTools install in venv | ||
if ! pipenv run python -c "import fontTools" | ||
then | ||
echo "Unable to detect fontTools install with pipenv. Please repeat your build attempt." 1>&2 | ||
exit 1 | ||
fi | ||
|
||
# print environment used for build to std output stream | ||
|
||
echo "=================================" | ||
echo " PYTHON BUILD ENVIRONMENT" | ||
echo "=================================" | ||
echo " " | ||
echo "Python interpreter version:" | ||
pipenv run python --version | ||
echo " " | ||
pipenv graph | ||
|
||
echo " " | ||
echo "=================================" | ||
echo " " | ||
echo "=================================" | ||
echo " " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you don't need to specify fonttools in addition to fontmake, because the former is a dependency of the latter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Safe to depend on the fact that this will always be the case? We have local Python scripts that depend on fontTools and will not pull it in with a pip install. pipenv simply ignores it since it was pulled in with fontmake.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, if you've scripts that directly depend on fonttools then it makes sense to have it there.