Path: blob/main/test/lib/python3.9/site-packages/setuptools/launch.py
4798 views
"""1Launch the Python script on the command line after2setuptools is bootstrapped via import.3"""45# Note that setuptools gets imported implicitly by the6# invocation of this script using python -m setuptools.launch78import tokenize9import sys101112def run():13"""14Run the script in sys.argv[1] as if it had15been invoked naturally.16"""17__builtins__18script_name = sys.argv[1]19namespace = dict(20__file__=script_name,21__name__='__main__',22__doc__=None,23)24sys.argv[:] = sys.argv[1:]2526open_ = getattr(tokenize, 'open', open)27with open_(script_name) as fid:28script = fid.read()29norm_script = script.replace('\\r\\n', '\\n')30code = compile(norm_script, script_name, 'exec')31exec(code, namespace)323334if __name__ == '__main__':35run()363738