diff --git a/superide/run/processor.py b/superide/run/processor.py index 117450d38225ddee5db8cb0ac9860e0bde8d762b..da5b70d35064d3226d5609e811b36857389a3a11 100644 --- a/superide/run/processor.py +++ b/superide/run/processor.py @@ -88,18 +88,18 @@ class EnvironmentProcessor: return result["returncode"] == 0 projectdir=self.project_dir - dockername=self.name + image_name=self.name if self.command: - command = Toolchain(dockername,projectdir).container_command(" ".join(self.command)) + command = Toolchain(image_name,projectdir).container_command(" ".join(self.command)) result = self.CommandRun(command) else: - build_command=Toolchain(dockername,projectdir).build() - result = self.CommandRun(build_command) - check_command=Toolchain(dockername,projectdir).check() - result = self.CommandRun(check_command) - run_command=Toolchain(dockername,projectdir).run() - result = self.CommandRun(run_command) - + build_command=Toolchain(image_name,projectdir).build() + check_command=Toolchain(image_name,projectdir).check() + run_command=Toolchain(image_name,projectdir).run() + commands= [build_command, check_command, run_command] + for comand in commands: + result = self.CommandRun(comand) + # (self.name, targets=build_targets, autoinstall=True).run return True diff --git a/superide/toolchain/__init__.py b/superide/toolchain/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..9a36a8fdf34f247433ff455441b971a730cf4064 --- /dev/null +++ b/superide/toolchain/__init__.py @@ -0,0 +1,12 @@ +# Copyright (c) Mengning Software. 2023. All rights reserved. +# +# Super IDE licensed under GNU Affero General Public License v3 (AGPL-3.0) . +# You can use this software according to the terms and conditions of the AGPL-3.0. +# You may obtain a copy of AGPL-3.0 at: +# +# https://www.gnu.org/licenses/agpl-3.0.txt +# +# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR +# PURPOSE. +# See the AGPL-3.0 for more details. diff --git a/superide/toolchain/toolchain.py b/superide/toolchain/toolchain.py index 7c4f324eab1ce68ff77576f0994f80f2c91d4b77..42798b0fb9186cf9bd6ac49b322f5787f72f9156 100644 --- a/superide/toolchain/toolchain.py +++ b/superide/toolchain/toolchain.py @@ -25,6 +25,10 @@ class Toolchain: print("Failed to get image.") def init_project(self): + # 文件夹非空则不能创建项目 + if(len(os.listdir(self.project_directory)) != 0): + print("can't init project in Non empty folder") + return False container_name = 'CopyExampleProjectDemo' source_path = '/app/ExampleProject' destination_path = self.project_directory @@ -49,6 +53,7 @@ class Toolchain: shutil.move(src_file, dst_file) clear_command = ['rm', '-rf', source_path] subprocess.run(clear_command) + return True def _get_tools(self): with open(f'{self.project_directory}/.vscode/tasks.json') as file: