Skip to content

Commit

Permalink
tools: Properly munge the patternfly font paths
Browse files Browse the repository at this point in the history
The OpenSans fonts are in our static directory and used on the
login page. These are not part of a package. In addition we don't
ship any other font formats but woff.

The patternfly.sed script munges patternfly for our use cases,
however it wasn't working with the new patternfly.

Update the script and add tests.

Closes cockpit-project#7823
  • Loading branch information
stefwalter authored and martinpitt committed Oct 6, 2017
1 parent af2e934 commit 75774b3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
4 changes: 2 additions & 2 deletions tools/patternfly.sed
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
s/src: url(.*eot[^']*');$//
s/src: url(.*eot[^'"]*['"]);$//
s/src: url.*glyphicons-halflings-regular.woff.*/src: url('fonts\/glyphicons.woff') format('woff');/
s/src: url.*fontawesome-webfont.woff.*/src: url('fonts\/fontawesome.woff?v=4.2.0') format('woff');/
s/src: url.*PatternFlyIcons-webfont.woff.*/src: url('fonts\/patternfly.woff') format('woff');/
s/src: url.*OpenSans-\([^']*\).woff.*/src: url('..\/..\/static\/fonts\/OpenSans-\1.woff') format('woff');/
s/src:.*url.*OpenSans-\([^'"]*\).woff.*/src: url('..\/..\/static\/fonts\/OpenSans-\1.woff') format('woff');/
s/url('..\/img\//url('images\//
s/url("..\/img\//url("images\//

15 changes: 14 additions & 1 deletion tools/test-static-code
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
# run static code checks like pyflakes and pep8
set -eu

echo "1..4"
echo "1..5"

builddir=$(pwd)
cd "${srcdir:-.}"
fail=0

Expand Down Expand Up @@ -80,4 +81,16 @@ else
echo "ok 4 unsafe-security-policy"
fi

#
# Bad paths or modifications in patternfly for fonts
#

if grep "\.\./fonts/OpenSans\|fonts/.*eot\|truetype" dist/*/*.css $builddir/dist/*/*.css >&2; then
echo "ERROR: invalid patternfly fonts paths found" >&2
echo "not ok 5 patternfly-font-paths"
fail=1
else
echo "ok 5 patternfly-font-paths"
fi

exit $fail

0 comments on commit 75774b3

Please sign in to comment.