Browse Source

scripts: add `script_init` mod

The MMGen Project 11 months ago
parent
commit
64d7434f59
3 changed files with 6 additions and 2 deletions
  1. 1 2
      scripts/compute-file-chksum.py
  2. 1 0
      scripts/create-token.py
  3. 4 0
      scripts/script_init.py

+ 1 - 2
scripts/compute-file-chksum.py

@@ -1,9 +1,8 @@
 #!/usr/bin/env python3
 
 import sys,os
-repo_root = os.path.split(os.path.abspath(os.path.dirname(sys.argv[0])))[0]
-sys.path = [repo_root] + sys.path
 
+import script_init
 from mmgen.cfg import Config
 from mmgen.util import msg,Msg,make_chksum_6
 from mmgen.fileutil import get_lines_from_file

+ 1 - 0
scripts/create-token.py

@@ -24,6 +24,7 @@ import sys,json,re
 from subprocess import run,PIPE
 from collections import namedtuple
 
+import script_init
 from mmgen.cfg import Config
 from mmgen.util import Msg,msg,rmsg,ymsg,die
 

+ 4 - 0
scripts/script_init.py

@@ -0,0 +1,4 @@
+#!/usr/bin/env python3
+import sys
+from pathlib import PurePath
+sys.path[0] = str(PurePath(*PurePath(__file__).parts[:-2]))