annotate CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/lib/python3.8/site-packages/setuptools/launch.py @ 69:33d812a61356

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 17:55:14 -0400
parents
children
rev   line source
jpayne@69 1 """
jpayne@69 2 Launch the Python script on the command line after
jpayne@69 3 setuptools is bootstrapped via import.
jpayne@69 4 """
jpayne@69 5
jpayne@69 6 # Note that setuptools gets imported implicitly by the
jpayne@69 7 # invocation of this script using python -m setuptools.launch
jpayne@69 8
jpayne@69 9 import sys
jpayne@69 10 import tokenize
jpayne@69 11
jpayne@69 12
jpayne@69 13 def run():
jpayne@69 14 """
jpayne@69 15 Run the script in sys.argv[1] as if it had
jpayne@69 16 been invoked naturally.
jpayne@69 17 """
jpayne@69 18 __builtins__
jpayne@69 19 script_name = sys.argv[1]
jpayne@69 20 namespace = dict(
jpayne@69 21 __file__=script_name,
jpayne@69 22 __name__='__main__',
jpayne@69 23 __doc__=None,
jpayne@69 24 )
jpayne@69 25 sys.argv[:] = sys.argv[1:]
jpayne@69 26
jpayne@69 27 open_ = getattr(tokenize, 'open', open)
jpayne@69 28 with open_(script_name) as fid:
jpayne@69 29 script = fid.read()
jpayne@69 30 norm_script = script.replace('\\r\\n', '\\n')
jpayne@69 31 code = compile(norm_script, script_name, 'exec')
jpayne@69 32 exec(code, namespace)
jpayne@69 33
jpayne@69 34
jpayne@69 35 if __name__ == '__main__':
jpayne@69 36 run()