init: remove dependency on spack.version

- no longer require `spack_version` to be a Version (it isn't used that
  way anyway)

- use a simple tuple `spack_version_info` with major, minor, patch
  versions

- generate `spack_version` from the tuple
This commit is contained in:
Todd Gamblin 2018-04-26 16:15:37 -07:00 committed by scheibelp
parent 678639749c
commit bc9f5f084f
3 changed files with 8 additions and 16 deletions

View file

@ -192,9 +192,9 @@ def setup(sphinx):
# built documents.
#
# The short X.Y version.
version = str(spack.spack_version.up_to(2))
version = '.'.join(str(s) for s in spack.spack_version_info[:2])
# The full version, including alpha/beta/rc tags.
release = str(spack.spack_version.up_to(2))
release = spack.spack_version
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.

View file

@ -25,19 +25,11 @@
##############################################################################
import sys
#-----------------------------------------------------------------------------
# Initialize various data structures & objects at the core of Spack.
#
# TODO: move all of these imports out of __init__ to avoid importing the whole
# TODO: world on Spack startup. There are some design changes that need to be
# TODO: made to enable this (decoupling Spec, repo, DB, and store state).
#
# TODO: Spack probably needs some kind of object to manage this state so that
# TODO: this stuff doesn't have to be at module scope.
# -----------------------------------------------------------------------------
# Version information
from spack.version import Version
spack_version = Version("0.11.2")
#: major, minor, patch version for Spack, in a tuple
spack_version_info = (0, 11, 2)
#: String containing Spack version joined with .'s
spack_version = '.'.join(str(v) for v in spack_version_info)
# Set up the default packages database.

View file

@ -30,4 +30,4 @@
def test_python():
out = python('-c', 'import spack; print(spack.spack_version)')
assert out.strip() == str(spack.spack_version)
assert out.strip() == spack.spack_version