MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / GetSDKPath

Function GetSDKPath

tools/env_utility.py:54–84  ·  view source on GitHub ↗
(name)

Source from the content-addressed store, hash-verified

52# get SDK path based on name
53# for example, GetSDKPath('arm-none-eabi') = '.env/tools/scripts/packages/arm-none-eabi-gcc-v10.3'
54def GetSDKPath(name):
55 sdk_pkgs = GetSDKPackagePath()
56
57 if sdk_pkgs:
58 # read env/tools/scripts/sdk_cfg.json for curstomized SDK path
59 if os.path.exists(os.path.join(sdk_pkgs, '..', 'sdk_cfg.json')):
60 with open(os.path.join(sdk_pkgs, '..', 'sdk_cfg.json'), 'r', encoding='utf-8') as f:
61 sdk_cfg = json.load(f)
62 for item in sdk_cfg:
63 if item['name'] == name:
64 sdk = os.path.join(sdk_pkgs, item['path'])
65 return sdk
66
67 # read packages.json under env/tools/scripts/packages
68 with open(os.path.join(sdk_pkgs, 'pkgs.json'), 'r', encoding='utf-8') as f:
69 # packages_json = f.read()
70 packages = json.load(f)
71
72 for item in packages:
73 package_path = os.path.join(GetEnvPath(), 'packages', item['path'], 'package.json')
74 # read package['path']/package.json under env/packages
75 with open(package_path, 'r', encoding='utf-8') as f:
76 # package_json = f.read()
77 package = json.load(f)
78
79 if package['name'] == name:
80 sdk = os.path.join(sdk_pkgs, package['name'] + '-' + item['ver'])
81 return sdk
82
83 # not found named package
84 return None
85
86def help_info():
87 print(

Callers

nothing calls this directly

Calls 4

GetSDKPackagePathFunction · 0.85
GetEnvPathFunction · 0.85
openFunction · 0.50
joinMethod · 0.45

Tested by

no test coverage detected