Entry point to run python on cmd line and from scripts
This commit is contained in:
parent
0f63d1bfa7
commit
b78612aebd
12
__main__.py
12
__main__.py
@ -20,6 +20,16 @@ def remote_control(args):
|
|||||||
main(args)
|
main(args)
|
||||||
|
|
||||||
|
|
||||||
|
def runpy(args):
|
||||||
|
exec(' '.join(args[1:]))
|
||||||
|
|
||||||
|
|
||||||
|
def launch(args):
|
||||||
|
import runpy
|
||||||
|
sys.argv = args[1:]
|
||||||
|
runpy.run_path(args[1], run_name='__main__')
|
||||||
|
|
||||||
|
|
||||||
def namespaced(args):
|
def namespaced(args):
|
||||||
func = namespaced_entry_points[args[1]]
|
func = namespaced_entry_points[args[1]]
|
||||||
func(args[1:])
|
func(args[1:])
|
||||||
@ -29,6 +39,8 @@ entry_points = {
|
|||||||
# These two are here for backwards compat
|
# These two are here for backwards compat
|
||||||
'icat': icat,
|
'icat': icat,
|
||||||
'list-fonts': list_fonts,
|
'list-fonts': list_fonts,
|
||||||
|
'runpy': runpy,
|
||||||
|
'launch': launch,
|
||||||
|
|
||||||
'@': remote_control,
|
'@': remote_control,
|
||||||
'+': namespaced,
|
'+': namespaced,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user