fix run error:name 'file' is not defined 79/279779/2
authorbiao716.wang <biao716.wang@samsung.com>
Wed, 17 Aug 2022 12:30:10 +0000 (21:30 +0900)
committerbiao716.wang <biao716.wang@samsung.com>
Wed, 17 Aug 2022 13:23:39 +0000 (22:23 +0900)
About correct python interpreter, now we use python3 interpreter directly without correct anymore.
Change-Id: Ic3ae325727fb98d4ab60f0e7022863eb684d6cba
Signed-off-by: biao716.wang <biao716.wang@samsung.com>
mic/rt_util.py

index 43b15de1b964850a341c24602033e9d44b0e981a..61b9353e5d1bc56cf5e5682fd431badccd62e919 100644 (file)
@@ -196,7 +196,7 @@ def get_mic_libpath():
 def sync_mic(bootstrap, binpth = '/usr/bin/mic',
              libpth='/usr/lib',
              plugin='/usr/lib/mic/plugins',
-             pylib = '/usr/lib/python2.7/site-packages',
+             pylib = '/usr/lib/python3/site-packages',
              conf = '/etc/mic/mic.conf'):
     _path = lambda p: os.path.join(bootstrap, p.lstrip('/'))
 
@@ -224,7 +224,7 @@ def sync_mic(bootstrap, binpth = '/usr/bin/mic',
             raise errors.BootstrapError(err)
 
     # auto select backend
-    conf_str = file(_path(conf)).read()
+    conf_str = open(_path(conf)).read()
     conf_str = re.sub("pkgmgr\s*=\s*.*", "pkgmgr=auto", conf_str)
     with open(_path(conf), 'w') as wf:
         wf.write(conf_str)
@@ -232,13 +232,6 @@ def sync_mic(bootstrap, binpth = '/usr/bin/mic',
     # chmod +x /usr/bin/mic
     os.chmod(_path(binpth), 0o777)
 
-    # correct python interpreter
-    mic_cont = file(_path(binpth)).read()
-    mic_cont = "#!/usr/bin/python3\n" + mic_cont
-    with open(_path(binpth), 'w') as wf:
-        wf.write(mic_cont)
-
-
 def safecopy(src, dst, symlinks=False, ignore_ptns=()):
     if os.path.isdir(src):
         if os.path.isdir(dst):