Skip to content

Commit

Permalink
setup.py: don't import, parse __version__ using ast
Browse files Browse the repository at this point in the history
Use semver.org version with three digits, e.g. 0.3.0
  • Loading branch information
anthrotype committed Oct 30, 2017
1 parent b66318e commit 7d595f4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion normalization/ufonormalizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
- things that need to be improved are marked with "# TO DO"
"""

__version__ = "0.3"
__version__ = "0.3.0"
description = """
UFO Normalizer (version %s):
Expand Down
17 changes: 14 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
from setuptools import setup
from normalization.ufonormalizer import __version__
from io import open
import ast


with open('normalization/ufonormalizer.py', 'r', encoding='utf-8') as f:
for line in f:
if line.startswith(u'__version__'):
version = ast.parse(line).body[0].value.s
break
else:
raise RuntimeError("No __version__ string found!")


setup(name="ufonormalizer",
version=__version__,
version=version,
description="Example implementation of a UFO normalizer",
author="Tal Leming",
email="tal@typesupply.com",
author_email="tal@typesupply.com",
url="https://github.com/unified-font-object/ufoNormalizer",
package_dir={"": "normalization"},
py_modules=['ufonormalizer'],
Expand Down

0 comments on commit 7d595f4

Please sign in to comment.