Beispiel #1
0
def updateFontVersion(font, dummy, isVF):
    if dummy:
        version = "1.0"
        buildtag = "src"
        now = datetime(2016, 1, 1, 0, 0, 0, 0)
    else:
        version = getVersion()
        buildtag = getGitHash()
        now = datetime.utcnow()
    versionMajor, versionMinor = [int(num) for num in version.split(".")]
    font.info.version = version
    font.info.versionMajor = versionMajor
    font.info.versionMinor = versionMinor
    font.info.woffMajorVersion = versionMajor
    font.info.woffMinorVersion = versionMinor
    font.info.year = now.year
    font.info.openTypeNameVersion = "Version %d.%03d;git-%s" % (
        versionMajor, versionMinor, buildtag)
    psFamily = re.sub(r'\s', '', font.info.familyName)
    if isVF:
        font.info.openTypeNameUniqueID = "%s:VF:%d:%s" % (psFamily, now.year,
                                                          buildtag)
    else:
        psStyle = re.sub(r'\s', '', font.info.styleName)
        font.info.openTypeNameUniqueID = "%s-%s:%d:%s" % (psFamily, psStyle,
                                                          now.year, buildtag)
    font.info.openTypeHeadCreated = now.strftime("%Y/%m/%d %H:%M:%S")
Beispiel #2
0
def main():
    version = getVersion()
    regex = re.compile(r'(url\("[^"]+?v=)([^"]+)("\))')
    cssFileName = pjoin(BASEDIR, 'docs', 'inter-ui.css')

    s = ''
    with open(cssFileName, 'r') as f:
        s = f.read()

    s = regex.sub(lambda m: '%s%s%s' % (m.group(1), version, m.group(3)), s)

    with open(cssFileName, 'w') as f:
        f.write(s)
Beispiel #3
0
def update_version(ufo):
    version = getVersion()
    buildtag, buildtagErrs = getGitHash()
    now = datetime.utcnow()
    if buildtag == "" or len(buildtagErrs) > 0:
        buildtag = "src"
        print("warning: getGitHash() failed: %r" % buildtagErrs,
              file=sys.stderr)
    versionMajor, versionMinor = [int(num) for num in version.split(".")]
    ufo.info.versionMajor = versionMajor
    ufo.info.versionMinor = versionMinor
    ufo.info.year = now.year
    ufo.info.openTypeNameVersion = "Version %d.%03d;git-%s" % (
        versionMajor, versionMinor, buildtag)
    psFamily = re.sub(r'\s', '', ufo.info.familyName)
    psStyle = re.sub(r'\s', '', ufo.info.styleName)
    ufo.info.openTypeNameUniqueID = "%s-%s:%d:%s" % (psFamily, psStyle,
                                                     now.year, buildtag)
    ufo.info.openTypeHeadCreated = now.strftime("%Y/%m/%d %H:%M:%S")
Beispiel #4
0
#!/usr/bin/env python
# encoding: utf8
#
# Updates the "?v=x" in files:
# - docs/inter.css
# - docs/inter-ui.css
# - docs/_includes/preload-font-files.html
#
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="[^"]+?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: