提交 093a388b authored 作者: Frederic Bastien's avatar Frederic Bastien

Use the Fallback version number also when importing Theano.

上级 8e371199
...@@ -37,7 +37,7 @@ Update the year in the ``Theano/LICENSE.txt`` file too, if necessary. ...@@ -37,7 +37,7 @@ Update the year in the ``Theano/LICENSE.txt`` file too, if necessary.
``NEWS.txt`` usually contains the name and date of the release, change them ``NEWS.txt`` usually contains the name and date of the release, change them
too. too.
Update the fallback version in ``setup.py``. Update the fallback version in ``theano/version.py``.
Update the code and the documentation for the theano flags Update the code and the documentation for the theano flags
``warn.ignore_bug_before`` to accept the new version. You must modify the ``warn.ignore_bug_before`` to accept the new version. You must modify the
......
...@@ -16,8 +16,6 @@ except ImportError: ...@@ -16,8 +16,6 @@ except ImportError:
import versioneer import versioneer
FALLBACK_VERSION="0.10.0beta3+unknown"
CLASSIFIERS = """\ CLASSIFIERS = """\
Development Status :: 4 - Beta Development Status :: 4 - Beta
Intended Audience :: Education Intended Audience :: Education
...@@ -74,6 +72,16 @@ def find_packages(where='.', exclude=()): ...@@ -74,6 +72,16 @@ def find_packages(where='.', exclude=()):
version_data = versioneer.get_versions() version_data = versioneer.get_versions()
if version_data['error'] is not None: if version_data['error'] is not None:
# Get the fallback version
# We can't import theano.version as it isn't yet installed, so parse it.
fname = os.path.join(os.path.split(__file__)[0], "theano", "version.py")
with open(fname, "r") as f:
lines = f.readlines()
lines = [l for l in lines if l.startswith("FALLBACK_VERSION")]
assert len(lines) == 1
FALLBACK_VERSION = lines[0].split("=")[1].strip().strip('""')
version_data['version'] = FALLBACK_VERSION version_data['version'] = FALLBACK_VERSION
......
...@@ -245,7 +245,3 @@ def sparse_grad(var): ...@@ -245,7 +245,3 @@ def sparse_grad(var):
__import__('theano.tensor.shared_randomstreams') __import__('theano.tensor.shared_randomstreams')
from ._version import get_versions
__version__ = get_versions()['version']
del get_versions
...@@ -2,23 +2,27 @@ from __future__ import absolute_import, print_function, division ...@@ -2,23 +2,27 @@ from __future__ import absolute_import, print_function, division
from theano._version import get_versions from theano._version import get_versions
FALLBACK_VERSION = "0.10.0beta3+unknown"
info = get_versions() info = get_versions()
if info['error'] is not None:
info['version'] = FALLBACK_VERSION
full_version = info['version'] full_version = info['version']
git_revision = info['full-revisionid'] git_revision = info['full-revisionid']
del info, get_versions del info, get_versions
short_version = full_version.split('+')[0] short_version = full_version.split('+')[0]
# This tries to catch a tag like beta2, rc1, ... # This tries to catch a tag like beta2, rc1, ...
try: try:
int(short_version.split('.')[2]) int(short_version.split('.')[2])
release = True release = True
except (ValueError, IndexError): except ValueError:
# IndexError can happen with the version:
# 0+untagged.2896.g0560a7f for example
release = False release = False
if release: if release and info['error'] is None:
version = short_version version = short_version
else: else:
version = full_version version = full_version
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论