mirror of
https://github.com/rsms/inter.git
synced 2024-11-28 22:13:40 +03:00
0796076659
- UPM is adjusted to 2048 - Additional opsz VF axis (multi master) added which will eventually replace the separate Display family - New tooling that uses fontmake instead of Inter's own fontbuild toolchain. (The old toolchain is still supported, i.e. `make -f Makefile_v1.make ...`)
33 lines
935 B
Python
33 lines
935 B
Python
# Updates "?v=x" in files
|
|
import os, sys, re
|
|
from os.path import dirname, basename, abspath, relpath, join as pjoin
|
|
sys.path.append(abspath(pjoin(dirname(__file__), 'tools')))
|
|
from common import BASEDIR, getVersion
|
|
|
|
version = getVersion()
|
|
|
|
def updateCSSFile(filename):
|
|
regex = re.compile(r'(url\("[^"]+?v=)([^"]+)("\))')
|
|
with open(filename, 'r') as f:
|
|
s = f.read()
|
|
s = regex.sub(lambda m: '%s%s%s' % (m.group(1), version, m.group(3)), s)
|
|
with open(filename, 'w') as f:
|
|
f.write(s)
|
|
|
|
|
|
def updateHTMLFile(filename):
|
|
regex = re.compile(r'((?:href|src)="[^"]+?v=)([^"]+)(")')
|
|
with open(filename, 'r') as f:
|
|
s = f.read()
|
|
s = regex.sub(lambda m: '%s%s%s' % (m.group(1), version, m.group(3)), s)
|
|
with open(filename, 'w') as f:
|
|
f.write(s)
|
|
|
|
for fn in sys.argv[1:]:
|
|
if fn.endswith(".css"):
|
|
updateCSSFile(fn)
|
|
elif fn.endswith(".html"):
|
|
updateHTMLFile(fn)
|
|
else:
|
|
raise "Unexpected file type %r" % fn
|