Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion cmds/cmd_menuconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,20 @@ def build_kconfig_frontends(rtt_root):
kconfig_dir = os.path.join(rtt_root, 'tools', 'kconfig-frontends')
os.system('scons -C ' + kconfig_dir)

def get_rtt_root():
rtt_root = os.getenv("RTT_ROOT")
if rtt_root is None:
bsp_root = Import("bsp_root")
with open(os.path.join(bsp_root, 'Kconfig')) as kconfig:
lines = kconfig.readlines()
for i in range(len(lines)):
if "config RTT_DIR" in lines[i]:
break
rtt_root = lines[i + 3].strip().split(" ")[1].strip('"')
if not os.path.isabs(rtt_root):
rtt_root = os.path.join(bsp_root, rtt_root)
return rtt_root

def is_pkg_special_config(config_str):
"""judge if it's CONFIG_PKG_XX_PATH or CONFIG_PKG_XX_VER"""

Expand Down Expand Up @@ -139,7 +153,6 @@ def mk_rtconfig(filename):
def cmd(args):
env_root = Import('env_root')
os.environ['PKGS_ROOT'] = Import("pkgs_root")
rtt_root = Import('rtt_root')
if platform.system() == "Windows":
os_version = platform.platform(True).split('-')[2][:3]
kconfig_win7_path = os.path.join(
Expand All @@ -161,6 +174,9 @@ def cmd(args):

return False

if platform.system() != "Windows":
rtt_root = get_rtt_root()

fn = '.config'

if os.path.isfile(fn):
Expand Down
9 changes: 0 additions & 9 deletions env.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,24 +100,15 @@ def get_bsp_root():

return bsp_root

def get_rtt_root(bsp_root):
rtt_root = os.getenv("RTT_ROOT")
if rtt_root is None:
rtt_root = os.path.join(bsp_root, '..', '..')
return rtt_root


def export_environment_variable():
script_root = os.path.split(os.path.realpath(__file__))[0]
sys.path = sys.path + [os.path.join(script_root)]
bsp_root = get_bsp_root()
rtt_root = get_rtt_root(bsp_root)
env_root = get_env_root()
pkgs_root = get_package_root(env_root)

Export('env_root')
Export('bsp_root')
Export('rtt_root')
Export('pkgs_root')


Expand Down