From aeda1925d8ed4224dc618a6a04f86419634032fa Mon Sep 17 00:00:00 2001 From: Igor Viarheichyk Date: Mon, 15 Aug 2016 15:43:57 -0700 Subject: [PATCH] Added --version command-line switch. Added version tracking. Version can be displayed using --version command-line switch. Changed wording in a message that shows missing mapping of unicode characters to glyphs. --- fontreport/fontreport.py | 6 +++++- fontreport/version.py | 1 + setup.py | 5 ++++- 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 fontreport/version.py diff --git a/fontreport/fontreport.py b/fontreport/fontreport.py index 8bb3a3d..eb102f8 100644 --- a/fontreport/fontreport.py +++ b/fontreport/fontreport.py @@ -32,6 +32,7 @@ import unicodedata from fontTools.misc.py23 import * from fontTools.ttLib import TTFont +import version class Glyph(object): @@ -272,7 +273,7 @@ def XetexBody(self): if unicodedata.category(unichr(x))[0] != 'C']) if gaps: data += ('\\rowcolor{missing}\\multicolumn{3}{|c|}' - '{\\small %d codepoints not mapped} \\\\\n') % (gaps) + '{\\small %d visible characters not mapped to glyphs} \\\\\n') % (gaps) prevcode = code data += ('\\texttt{%04X} & {\\customfont\\symbol{%d}} &' '{\\small %s}\\\\\n') % (code, code, uniname) @@ -589,6 +590,9 @@ def main(): outfile = argv[2] elif len(argv) == 2: infile = argv[1] + if infile in ('--version', '-v'): + print('FontReport version %s' % version.__version__) + sys.exit(0) outfile = None else: print('Usage: %s infile [outfile]' % argv[0]) diff --git a/fontreport/version.py b/fontreport/version.py new file mode 100644 index 0000000..439eb0c --- /dev/null +++ b/fontreport/version.py @@ -0,0 +1 @@ +__version__ = '1.1' diff --git a/setup.py b/setup.py index 786ab91..4306836 100644 --- a/setup.py +++ b/setup.py @@ -15,10 +15,13 @@ from setuptools import setup +ns={} +with open('fontreport/version.py') as f: + exec(f.read(), ns) setup( name='fontreport', - version='1.0', + version=ns['__version__'], packages=['fontreport'], package_data = {'fontreport': ['*.json']}, entry_points = {