diff options
| author | user@node5.net <user@node5.net> | 2026-06-07 19:57:22 +0200 |
|---|---|---|
| committer | user@node5.net <user@node5.net> | 2026-06-07 19:57:22 +0200 |
| commit | 68036b25ffbf70b98673ea0031ca389aa9083dd4 (patch) | |
| tree | 218ac677f4819c93ae30baf8c4b173bf9ff605d0 /src | |
| parent | ee15f9fba18f6ab1180217f9bf19288f145b83c3 (diff) | |
git clone simplify setup
Diffstat (limited to 'src')
| -rw-r--r-- | src/blog_node5_net.py | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/blog_node5_net.py b/src/blog_node5_net.py index 5db8d7a..6509bc2 100644 --- a/src/blog_node5_net.py +++ b/src/blog_node5_net.py @@ -58,16 +58,11 @@ articles_repo_url = os.environ["ARTICLES_REPO_URL"] if "ARTICLES_REPO_URL" in os logger.debug(f'articles_path: {articles_path}') logger.debug(f'site_files_path: {site_files_path}') +# Clone repo, if folder empty pathlib.Path(articles_path).mkdir(parents=True, exist_ok=True) if pathlib.Path(articles_path).exists() and not any(pathlib.Path(articles_path).iterdir()): logger.info(f"Articles path {articles_path} is empty, cloning {articles_repo_url} into {articles_path}") - try: - subprocess.run(["git", "clone", articles_repo_url, articles_path], check=True, stderr=subprocess.PIPE, text=True) - except subprocess.CalledProcessError as e: - # Cleanup partially created files on failure - if path.exists() and not any(path.iterdir()): - shutil.rmtree(path, ignore_errors=True) - raise RuntimeError(f"git clone failed: {e.stderr.strip()}") from e + subprocess.run(["git", "clone", articles_repo_url, articles_path], check=True) article_generator = article.ArticleGenerator(articles_path) |
