Skip to content

Commit

Permalink
feat: make sure cli works without pip install
Browse files Browse the repository at this point in the history
source from CCBR/CHAMPAGNE#180
  • Loading branch information
kelly-sovacool committed Aug 2, 2024
1 parent a0116d4 commit e4df1f1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bin/redirect
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ elif [[ $ISFRCE == true ]];then
export PATH="/mnt/projects/CCBR-Pipelines/bin:$PATH"
fi

${TOOLDIR}/src/renee/__main__.py "$@" || true
${TOOLDIR}/main.py "$@" || true
16 changes: 16 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env python
import os
import re
import sys

# add script directory to the path to allow champagne CLI to work out-of-the-box
# without the need to install it via pip first
SCRIPT_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "src", "renee")
sys.path.append(SCRIPT_DIR)
from src.renee.__main__ import main

if (
__name__ == "__main__"
): # this block is adapted from the executable file created by `pip install`
sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0])
sys.exit(main())

0 comments on commit e4df1f1

Please sign in to comment.