Skip to content

Commit 086e8c2

Browse files
committed
Modify path to support direct invocation
1 parent c5b0445 commit 086e8c2

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

codeql_bundle/cli.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
# Add the parent directory to the path if this module is run directly (i.e. not imported)
2+
# This is necessary to support both the Poetry script invocation and the direct invocation.
3+
if not __package__ and __name__ == "__main__":
4+
import sys
5+
from pathlib import Path
6+
7+
sys.path.append(str(Path(__file__).parent.parent))
8+
__package__ = Path(__file__).parent.name
9+
110
import click
211
from pathlib import Path
312
from codeql_bundle.helpers.codeql import CodeQLException

0 commit comments

Comments
 (0)