[tools] fix the SDK path issue in env script.
This commit is contained in:
parent
b9f4daa97a
commit
53b894c46c
|
@ -41,13 +41,22 @@ def GetPkgPath():
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def GetSDKPackagePath():
|
||||||
def GetSDKPath(name):
|
|
||||||
env = GetEnvPath()
|
env = GetEnvPath()
|
||||||
|
|
||||||
if env:
|
if env:
|
||||||
# read packages.json under env/tools/packages
|
return os.path.join(env, "tools", "scripts", "packages")
|
||||||
with open(os.path.join(env, 'tools', 'packages', 'pkgs.json'), 'r', encoding='utf-8') as f:
|
|
||||||
|
return None
|
||||||
|
|
||||||
|
# get SDK path based on name
|
||||||
|
# for example, GetSDKPath('arm-none-eabi') = '.env/tools/scripts/packages/arm-none-eabi-gcc-v10.3'
|
||||||
|
def GetSDKPath(name):
|
||||||
|
sdk_pkgs = GetSDKPackagePath()
|
||||||
|
|
||||||
|
if sdk_pkgs:
|
||||||
|
# read packages.json under env/tools/scripts/packages
|
||||||
|
with open(os.path.join(sdk_pkgs, 'pkgs.json'), 'r', encoding='utf-8') as f:
|
||||||
# packages_json = f.read()
|
# packages_json = f.read()
|
||||||
packages = json.load(f)
|
packages = json.load(f)
|
||||||
|
|
||||||
|
@ -59,12 +68,11 @@ def GetSDKPath(name):
|
||||||
package = json.load(f)
|
package = json.load(f)
|
||||||
|
|
||||||
if package['name'] == name:
|
if package['name'] == name:
|
||||||
return os.path.join(env, 'tools', 'packages', package['name'] + '-' + item['ver'])
|
return os.path.join(sdk_pkgs, package['name'] + '-' + item['ver'])
|
||||||
|
|
||||||
# not found named package
|
# not found named package
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def help_info():
|
def help_info():
|
||||||
print(
|
print(
|
||||||
"**********************************************************************************\n"
|
"**********************************************************************************\n"
|
||||||
|
|
Loading…
Reference in New Issue