Entry point to run python on cmd line and from scripts

This commit is contained in:
Kovid Goyal 2018-02-08 09:11:13 +05:30
parent 0f63d1bfa7
commit b78612aebd
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -20,6 +20,16 @@ def remote_control(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):
func = namespaced_entry_points[args[1]]
func(args[1:])
@ -29,6 +39,8 @@ entry_points = {
# These two are here for backwards compat
'icat': icat,
'list-fonts': list_fonts,
'runpy': runpy,
'launch': launch,
'@': remote_control,
'+': namespaced,