diff --git a/.gitignore b/.gitignore index ebfe07a..6bbbcf3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *.pyc */__pycache__ -poetry.lock \ No newline at end of file +poetry.lock +dist/ \ No newline at end of file diff --git a/env/__init__.py b/env/__init__.py index 541f859..c12f34c 100755 --- a/env/__init__.py +++ b/env/__init__.py @@ -1 +1 @@ -__version__ = '0.1.0' \ No newline at end of file +__version__ = '0.1.1' \ No newline at end of file diff --git a/env/main.py b/env/main.py index 987f8cc..14c44aa 100755 --- a/env/main.py +++ b/env/main.py @@ -10,6 +10,7 @@ from .pkgs.repo import Repo from .utils.KTemplate import Kconfigfile from .utils.settings import config +from shutil import rmtree app = typer.Typer(help='RT-Thread Command line tool') @@ -64,6 +65,7 @@ def init(): bold=True) except Exception as e: typer.secho(e, fg=typer.colors.RED, bold=True) + rmtree(config.ENV_DIR) exit(0) @app.callback() diff --git a/env/pkgs/command.py b/env/pkgs/command.py index f7585fd..45fcc42 100755 --- a/env/pkgs/command.py +++ b/env/pkgs/command.py @@ -53,8 +53,7 @@ def update(force: bool = typer.Option(False, help='Whether to force an update')) # print(pkgs.update_info) # pkgs.update() package_update(force_update=force) + typer.secho('==============================> Package update complete', fg=typer.colors.GREEN, bold=True) except Exception as e: typer.secho(e, fg=typer.colors.RED, bold=True) exit(0) - - typer.secho('==============================> Package update complete', fg=typer.colors.GREEN, bold=True) diff --git a/env/pkgs/repo.py b/env/pkgs/repo.py index 99ec7b8..8c64c29 100755 --- a/env/pkgs/repo.py +++ b/env/pkgs/repo.py @@ -19,10 +19,10 @@ def __exit__(self, exc_type, exc_value, traceback): def clone(self): print(self.repo_dir) - return subprocess.run(f'git clone {self.index_repo} {self.repo_dir}', shell=True) + return subprocess.run(f'git clone {self.index_repo} {self.repo_dir}', shell=True, check=True) def fetch(self, force=False) -> None: print(self.repo_dir) ret = subprocess.run(f'git -C {self.repo_dir} fetch --all', shell=True) if force: - subprocess.run(f'git -C {self.repo_dir} reset --hard origin/master', shell=True) \ No newline at end of file + subprocess.run(f'git -C {self.repo_dir} reset --hard origin/master', shell=True, check=True) \ No newline at end of file diff --git a/env/utils/kconfig.py b/env/utils/kconfig.py old mode 100755 new mode 100644 diff --git a/pyproject.toml b/pyproject.toml index e26a597..f7eea1e 100755 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "env" -version = "0.1.0" +version = "0.1.1" description = "Command line tool to assist RT-Thread development" authors = ["shinu "] readme = "README.md" diff --git a/tests/test_env.py b/tests/test_env.py index 34ff2ae..edeb41d 100755 --- a/tests/test_env.py +++ b/tests/test_env.py @@ -1,5 +1,9 @@ from env import __version__ +from env.main import app +from typer.testing import CliRunner + +runner = CliRunner() def test_version(): - assert __version__ == '0.1.0' + assert __version__ == '0.1.1'