Mercurial > repos > shellac > sam_consensus_v3
comparison env/lib/python3.9/site-packages/setuptools/launch.py @ 0:4f3585e2f14b draft default tip
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
| author | shellac |
|---|---|
| date | Mon, 22 Mar 2021 18:12:50 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:4f3585e2f14b |
|---|---|
| 1 """ | |
| 2 Launch the Python script on the command line after | |
| 3 setuptools is bootstrapped via import. | |
| 4 """ | |
| 5 | |
| 6 # Note that setuptools gets imported implicitly by the | |
| 7 # invocation of this script using python -m setuptools.launch | |
| 8 | |
| 9 import tokenize | |
| 10 import sys | |
| 11 | |
| 12 | |
| 13 def run(): | |
| 14 """ | |
| 15 Run the script in sys.argv[1] as if it had | |
| 16 been invoked naturally. | |
| 17 """ | |
| 18 __builtins__ | |
| 19 script_name = sys.argv[1] | |
| 20 namespace = dict( | |
| 21 __file__=script_name, | |
| 22 __name__='__main__', | |
| 23 __doc__=None, | |
| 24 ) | |
| 25 sys.argv[:] = sys.argv[1:] | |
| 26 | |
| 27 open_ = getattr(tokenize, 'open', open) | |
| 28 with open_(script_name) as fid: | |
| 29 script = fid.read() | |
| 30 norm_script = script.replace('\\r\\n', '\\n') | |
| 31 code = compile(norm_script, script_name, 'exec') | |
| 32 exec(code, namespace) | |
| 33 | |
| 34 | |
| 35 if __name__ == '__main__': | |
| 36 run() |
