single sourcing the package version (#3220)

This commit is contained in:
xutianming
2018-11-05 05:53:55 +08:00
committed by Philipp Moritz
parent 369cb833fe
commit fb6ac28b44
2 changed files with 14 additions and 4 deletions
+13 -2
View File
@@ -3,6 +3,7 @@ from __future__ import division
from __future__ import print_function
import os
import re
import shutil
import subprocess
import sys
@@ -118,10 +119,20 @@ class BinaryDistribution(Distribution):
return True
def find_version(*filepath):
# Extract version information from filepath
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, *filepath)) as fp:
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
fp.read(), re.M)
if version_match:
return version_match.group(1)
raise RuntimeError("Unable to find version string.")
setup(
name="ray",
# The version string is also in __init__.py. TODO(pcm): Fix this.
version="0.5.3",
version=find_version("ray", "__init__.py"),
description=("A system for parallel and distributed Python that unifies "
"the ML ecosystem."),
long_description=open("../README.rst").read(),