Use try
instead of if
in setup.py
This commit is contained in:
parent
6e7e94dd8e
commit
fe0fb6fba1
8
setup.py
8
setup.py
@ -24,7 +24,6 @@ import re
|
||||
import sys
|
||||
import runpy
|
||||
import subprocess
|
||||
from distutils.spawn import find_executable
|
||||
|
||||
from setuptools import find_packages, setup
|
||||
|
||||
@ -32,16 +31,17 @@ os.chdir(os.path.split(os.path.abspath(__file__))[0])
|
||||
|
||||
PKG = "hy"
|
||||
VERSIONFILE = os.path.join(PKG, "version.py")
|
||||
if os.path.exists('.git') and find_executable('git'):
|
||||
try:
|
||||
__version__ = (subprocess.check_output
|
||||
(["git", "describe", "--tags", "--dirty"])
|
||||
.decode('ASCII').strip()
|
||||
.replace('-', '+', 1).replace('-', '.'))
|
||||
with open(VERSIONFILE, "wt") as o:
|
||||
o.write("__version__ = {!r}\n".format(__version__))
|
||||
elif os.path.exists(VERSIONFILE):
|
||||
except (subprocess.CalledProcessError, OSError):
|
||||
if os.path.exists(VERSIONFILE):
|
||||
__version__ = runpy.run_path(VERSIONFILE)['__version__']
|
||||
else:
|
||||
else:
|
||||
__version__ = "unknown"
|
||||
|
||||
long_description = """Hy is a Python <--> Lisp layer. It helps
|
||||
|
Loading…
Reference in New Issue
Block a user