main.py: add fqmod param; add test/misc/opts.py launcher
This commit is contained in:
parent
211b71431d
commit
5c419c802b
2 changed files with 10 additions and 2 deletions
|
|
@ -22,7 +22,7 @@ main: Script launcher for the MMGen Project
|
|||
|
||||
import sys,os
|
||||
|
||||
def launch(*, mod=None, func=None, package='mmgen'):
|
||||
def launch(*, mod=None, func=None, fqmod=None, package='mmgen'):
|
||||
|
||||
if sys.platform == 'linux' and sys.stdin.isatty():
|
||||
import termios,atexit
|
||||
|
|
@ -31,7 +31,7 @@ def launch(*, mod=None, func=None, package='mmgen'):
|
|||
atexit.register(lambda: termios.tcsetattr(fd,termios.TCSADRAIN,old))
|
||||
|
||||
try:
|
||||
__import__(f'{package}.main_{mod}') if mod else func()
|
||||
__import__(f'{package}.main_{mod}') if mod else func() if func else __import__(fqmod)
|
||||
except KeyboardInterrupt:
|
||||
from .color import yellow
|
||||
sys.stderr.write(yellow('\nUser interrupt\n'))
|
||||
|
|
|
|||
8
test/misc/opts.py
Executable file
8
test/misc/opts.py
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
from mmgen.main import launch
|
||||
import sys
|
||||
|
||||
sys.path.insert(0,'test')
|
||||
|
||||
launch(fqmod='misc.opts_main')
|
||||
Loading…
Add table
Add a link
Reference in a new issue