Skip to content

Commit 0d3dd8f

Browse files
committed
fix: publish script
1 parent bcac7a5 commit 0d3dd8f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

scripts/publish.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,23 @@
1+
import contextlib
12
import os
23
import subprocess
34
import sys
45
from pathlib import Path
56
from typing import Any
67

8+
if __name__ == "__main__" and __package__ is None or __package__ == "":
9+
file = Path(__file__).resolve()
10+
parent, top = file.parent, file.parents[1]
11+
12+
if str(top) not in sys.path:
13+
sys.path.append(str(top))
14+
15+
with contextlib.suppress(ValueError):
16+
sys.path.remove(str(parent))
17+
18+
__package__ = "scripts"
19+
20+
721
from scripts.tools import get_version
822

923

0 commit comments

Comments
 (0)