def get_mic_libpath():
return os.getenv("MIC_LIBRARY_PATH", "/usr/lib/mic")
+# 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
+
# the hard code path is prepared for bootstrap
def sync_mic(bootstrap, binpth = '/usr/bin/mic',
libpth='/usr/lib',
'pylib': get_mic_modpath(),
'conf': '/etc/mic/mic.conf',
}
+ print("True or False: %s\n" % mic_py2_in_mic_bootstrap(_path(binpth)))
+ if (mic_py2_in_mic_bootstrap(_path(binpth))):
+ mic_py2_path = get_mic_libpath() + '/mic_py2'
+ pylib = '/usr/lib/python2.7/site-packages'
+
+ micpaths = {
+ 'binpth': mic_py2_path + get_mic_binpath(),
+ 'libpth': mic_py2_path + get_mic_libpath(),
+ 'plugin': mic_py2_path + plugin,
+ 'pylib': mic_py2_path + '/usr/lib/python2.7/dist-packages/mic',
+ 'conf': mic_py2_path + '/etc/mic/mic.conf',
+ }
if not os.path.exists(_path(pylib)):
pyptn = '/usr/lib/python3.*/site-packages'
+ if (mic_py2_in_mic_bootstrap(_path(binpth))):
+ pyptn = '/usr/lib/python?.?/site-packages'
pylibs = glob.glob(_path(pyptn))
if pylibs:
pylib = pylibs[0].replace(bootstrap, '')
# chmod +x /usr/bin/mic
os.chmod(_path(binpth), 0o777)
+
def safecopy(src, dst, symlinks=False, ignore_ptns=()):
if os.path.isdir(src):
if os.path.isdir(dst):