return True
return (os.stat("/").st_ino != 2)
+# check python version in mic-bootstrap
+def mic_py2_in_mic_bootstrap(binpth_in_micbootstrap):
+ #Check /usr/bin/mic file in mic bootstrap, if there is #!/usr/bin/python2 -tt, mean it is python2.x version.
+ #For python2.x version, the first line of /usr/bin/mic in mic-bootstrap is: #!/bin/python -tt
+ #For python3.x version, the first line of /usr/bin/mic in mic-bootstrap is: #!/bin/python3 -tt
+ with open(binpth_in_micbootstrap, 'r') as mic_bin:
+ first_line = mic_bin.readline()
+
+ msger.debug("first line of /usr/bin/mic in mic bootstrap: %s" % first_line)
+ if (first_line.find('python3') == -1):
+ return True
+ return False
+
def bootstrap_mic(argv=None):
def mychroot():
os.chroot(rootdir)
rootdir = os.path.join(rootdir, "bootstrap")
bsenv.dirsetup(rootdir)
- if cropts['use_mic_in_bootstrap']:
+ #when mic in mic-bootstrap is py3, use mic version in mic-bootstrap.
+ if cropts['use_mic_in_bootstrap'] | (mic_py2_in_mic_bootstrap(os.path.join(rootdir, '/usr/bin/mic'.lstrip('/'))) == False):
msger.info("No copy host mic")
else:
msger.info("Copy host mic to bootstrap")