diff --git a/script/maintenance/format_file_to_commit.py b/script/maintenance/format_file_to_commit.py index 30d72d1..27862a5 100755 --- a/script/maintenance/format_file_to_commit.py +++ b/script/maintenance/format_file_to_commit.py @@ -16,13 +16,17 @@ def execute_shell(cmd): def get_modified_files(): lst_cmd_git_status = ["git", "status", "--porcelain"] - lst_cmd_git_status_repo = [ - ".venv.erplibre/bin/repo", - "forall", - "-p", - "-c", - "git status -s", - ] + path_repo_bin = ".venv.erplibre/bin/repo" + if os.path.exists(path_repo_bin): + lst_cmd_git_status_repo = [ + path_repo_bin, + "forall", + "-p", + "-c", + "git status -s", + ] + else: + lst_cmd_git_status_repo = [] try: print(" ".join(lst_cmd_git_status)) result = subprocess.run( @@ -35,15 +39,18 @@ def get_modified_files(): lst_lines = [(".", lines_local)] - print(" ".join(lst_cmd_git_status_repo)) + if lst_cmd_git_status_repo: + print(" ".join(lst_cmd_git_status_repo)) - result = subprocess.run( - lst_cmd_git_status_repo, - capture_output=True, - text=True, - check=True, - ) - lines_project = result.stdout.strip().split("\n\n") + result = subprocess.run( + lst_cmd_git_status_repo, + capture_output=True, + text=True, + check=True, + ) + lines_project = result.stdout.strip().split("\n\n") + else: + lines_project = [] if os.path.isfile(".odoo-version"): with open(".odoo-version") as txt: