Skip to content

Commit 266262c

Browse files
committed
move metarget version to single file VERSION
1 parent 53b0a7a commit 266262c

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

VERSION

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.9.1

config.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import platform
22

33

4-
# metarget version
5-
VERSION = '0.3'
64
# default CNI plugin
75
DEFAULT_CNI_PLUGIN = 'flannel'
86
# default kata runtime type

metarget

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import os
99
import sys
1010

1111
import utils.system as system_func
12+
import utils.util as util
1213
import utils.color_print as color_print
1314
import cmds.gadget
1415
import cmds.cnv
@@ -47,7 +48,7 @@ def main():
4748
'-v',
4849
'--version',
4950
action='version',
50-
version='metarget {ver}'.format(ver=config.VERSION))
51+
version='metarget {ver}'.format(ver=util.get_metarget_version()))
5152

5253
parser.set_defaults(func=lambda x: parser.print_help())
5354
# add subparsers

utils/util.py

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
"""
2+
Trivial utilities
3+
"""
4+
5+
6+
def get_metarget_version():
7+
try:
8+
with open("VERSION", "r") as f:
9+
return f.read().strip()
10+
except FileNotFoundError:
11+
return "unknown"

0 commit comments

Comments
 (0)