PYTHON ?= python
-VERSION = $(shell cat VERSION)
-TAGVER = $(shell cat VERSION | sed -e "s/\([0-9\.]*\).*/\1/")
+VERSION = $(shell sed -ne 's/__version__\s*=\s*"\(.*\)"/\1/p ' mic/__init__.py)
+TAGVER = $(shell echo $(VERSION) | sed -e "s/\([0-9\.]*\).*/\1/")
PKGNAME = mic
+#
+# Copyright (c) 2013 Intel, Inc.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation; version 2 of the License
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc., 59
+# Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
import os, sys
+__version__ = "0.21"
+
cur_path = os.path.dirname(__file__) or '.'
sys.path.insert(0, cur_path + '/3rdparty')
MOD_NAME = 'mic'
-version_path = 'VERSION'
-if not os.path.isfile(version_path):
- print 'No VERSION file in topdir, abort'
- sys.exit(1)
-
try:
- # first line should be the version number
- version = open(version_path).readline().strip()
- if not version:
- print 'VERSION file is invalid, abort'
- sys.exit(1)
-
- ver_file = open('%s/__version__.py' % MOD_NAME, 'w')
- ver_file.write("VERSION = \"%s\"\n" % version)
- ver_file.close()
-except IOError:
- print 'WARNING: Cannot write version number file'
+ import mic
+ version = mic.__version__
+except (ImportError, AttributeError):
+ version = "dev"
# --install-layout is recognized after 2.5
if sys.version_info[:2] > (2, 5):
# Temple Place - Suite 330, Boston, MA 02111-1307, USA.
import os, sys, errno
-from mic import msger, creator
+from mic import msger, creator, __version__ as VERSION
from mic.utils import cmdln, misc, errors
from mic.conf import configmgr
from mic.plugin import pluginmgr
-from mic.__version__ import VERSION
def optparser_setup(func):