From bc9f5f084f36ee56b707616437d33739879e4890 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Thu, 26 Apr 2018 16:15:37 -0700 Subject: 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 --- lib/spack/docs/conf.py | 4 ++-- lib/spack/spack/__init__.py | 18 +++++------------- lib/spack/spack/test/cmd/python.py | 2 +- 3 files changed, 8 insertions(+), 16 deletions(-) (limited to 'lib') diff --git a/lib/spack/docs/conf.py b/lib/spack/docs/conf.py index 18779c5d0c..c269c7ee27 100644 --- a/lib/spack/docs/conf.py +++ b/lib/spack/docs/conf.py @@ -192,9 +192,9 @@ copyright = u'2013-2018, Lawrence Livermore National Laboratory.' # 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. diff --git a/lib/spack/spack/__init__.py b/lib/spack/spack/__init__.py index 714f0e7377..002e9185de 100644 --- a/lib/spack/spack/__init__.py +++ b/lib/spack/spack/__init__.py @@ -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. diff --git a/lib/spack/spack/test/cmd/python.py b/lib/spack/spack/test/cmd/python.py index 73221d7316..380d7838ce 100644 --- a/lib/spack/spack/test/cmd/python.py +++ b/lib/spack/spack/test/cmd/python.py @@ -30,4 +30,4 @@ python = SpackCommand('python') 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 -- cgit v1.2.3-60-g2f50