From 2fc60f26453c7a212310aaa0441fdd903ea48365 Mon Sep 17 00:00:00 2001 From: panwentao Date: Fri, 29 Mar 2024 17:35:11 +0800 Subject: [PATCH] menv: Modify sed to insert data * Modify sed to insert data Signed-off-by: panwentao --- src/oebuild/app/plugins/generate/generate.py | 6 +++--- src/oebuild/app/plugins/m_env/m_env.py | 11 +++++------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/oebuild/app/plugins/generate/generate.py b/src/oebuild/app/plugins/generate/generate.py index 7968011..53d53af 100644 --- a/src/oebuild/app/plugins/generate/generate.py +++ b/src/oebuild/app/plugins/generate/generate.py @@ -608,7 +608,6 @@ wrong platform, please run `oebuild generate -l` to view support feature""") toolchain_start += "endif\n" return toolchain_start - def generate_command(self, config_path): """ generate_command to oebuild generate @@ -714,8 +713,9 @@ wrong platform, please run `oebuild generate -l` to view support feature""") logger.error(f'toolchain name not exists, toolchain list is {toolchain_list}') sys.exit(-1) build_dir = os.path.join(self.configure.build_dir(), 'toolchain') - os.chdir(os.path.dirname(build_dir)) - subprocess.run(f'rm -rf {build_dir}', shell=True, check=False) + if os.path.exists(build_dir): + os.chdir(os.path.dirname(build_dir)) + subprocess.run(f'rm -rf {build_dir}', shell=True, check=False) subprocess.run('oebuild generate -d toolchain', shell=True, check=False) subprocess.check_output(f'cp -r {cross_path} {build_dir}', shell=True) os.chdir(build_dir) diff --git a/src/oebuild/app/plugins/m_env/m_env.py b/src/oebuild/app/plugins/m_env/m_env.py index e4b381f..996286b 100644 --- a/src/oebuild/app/plugins/m_env/m_env.py +++ b/src/oebuild/app/plugins/m_env/m_env.py @@ -168,6 +168,7 @@ Please enter the correct command: oebuild menv create [-d -f] Create an environm print('The path is invalid, please check the path ') sys.exit(-1) + # pylint: disable=R0914 def execute_setup_directory(self, setup_file_path, env_name): """ Prepare the environment using the parsed SDK folder provided @@ -214,13 +215,11 @@ Please enter the correct command: oebuild menv create [-d -f] Create an environm r"sed -i '$a\mv ~/.bashrc_back ~/.bashrc -f' ~/.bashrc", shell=True) # Add prompt words + separator = "====================================================" + prompt_one = "Your environment is ready" + prompt_two = "Please proceed with the subsequent operations here" wrap = '\\n###!###\\n' - prompt_words = f''' -===================================================={wrap} -Your environment is ready{wrap} -Please proceed with the subsequent operations here{wrap} -===================================================={wrap} -''' + prompt_words = separator + wrap + prompt_one + wrap + prompt_two + wrap + separator subprocess.check_output( rf'''sed -i '$a\echo "{prompt_words}"' ~/.bashrc''', shell=True) -- Gitee