Skip to content

Commit

Permalink
[fixbug]:Fix bugs in init and update
Browse files Browse the repository at this point in the history
  • Loading branch information
wugensheng-code committed Jun 8, 2022
1 parent 0468601 commit 8557fc6
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.pyc
*/__pycache__
poetry.lock
poetry.lock
dist/
2 changes: 1 addition & 1 deletion env/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.1.0'
__version__ = '0.1.1'
2 changes: 2 additions & 0 deletions env/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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()
Expand Down
3 changes: 1 addition & 2 deletions env/pkgs/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
4 changes: 2 additions & 2 deletions env/pkgs/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
subprocess.run(f'git -C {self.repo_dir} reset --hard origin/master', shell=True, check=True)
Empty file modified env/utils/kconfig.py
100755 → 100644
Empty file.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"]
readme = "README.md"
Expand Down
6 changes: 5 additions & 1 deletion tests/test_env.py
Original file line number Diff line number Diff line change
@@ -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'

0 comments on commit 8557fc6

Please sign in to comment.