Skip to content

Commit 1bad563

Browse files
author
Eric Wheeler
committed
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.
1 parent 773ccec commit 1bad563

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

bin/github-backup

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@ import logging
44
import os
55
import sys
66

7+
8+
# If we are running from a git-checkout, we can run against the development
9+
# tree without installing.
10+
if os.path.exists(os.path.join(os.path.dirname(__file__), "..", ".git")):
11+
sys.path.insert(
12+
0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
13+
)
14+
15+
716
from github_backup.github_backup import (
817
backup_account,
918
backup_repositories,

0 commit comments

Comments
 (0)