diff --git a/setup.py b/setup.py index a64cb7b..75a61c3 100755 --- a/setup.py +++ b/setup.py @@ -22,6 +22,7 @@ import os import re import sys +import runpy import subprocess from setuptools import find_packages, setup @@ -37,8 +38,11 @@ try: .replace('-', '+', 1).replace('-', '.')) with open(VERSIONFILE, "wt") as o: o.write("__version__ = {!r}\n".format(__version__)) -except subprocess.CalledProcessError: - __version__ = "unknown" +except (subprocess.CalledProcessError, OSError): + if os.path.exists(VERSIONFILE): + __version__ = runpy.run_path(VERSIONFILE)['__version__'] + else: + __version__ = "unknown" long_description = """Hy is a Python <--> Lisp layer. It helps make things work nicer, and lets Python and the Hy lisp variant play