mirror of
https://github.com/josegonzalez/python-github-backup.git
synced 2025-12-06 00:28:01 +01:00
Add conditional check for git checkout in development path
Only insert development path into sys.path when running from a git checkout (when ../.git exists). This makes the script more robust by only using the development tree when available and falling back to installed package otherwise.
This commit is contained in:
@@ -4,6 +4,15 @@ import logging
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
# If we are running from a git-checkout, we can run against the development
|
||||
# tree without installing.
|
||||
if os.path.exists(os.path.join(os.path.dirname(__file__), "..", ".git")):
|
||||
sys.path.insert(
|
||||
0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
|
||||
)
|
||||
|
||||
|
||||
from github_backup.github_backup import (
|
||||
backup_account,
|
||||
backup_repositories,
|
||||
|
||||
Reference in New Issue
Block a user