Development of an internal social media platform with personalised dashboards for students
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

launch.py 787B

1234567891011121314151617181920212223242526272829303132333435
  1. """
  2. Launch the Python script on the command line after
  3. setuptools is bootstrapped via import.
  4. """
  5. # Note that setuptools gets imported implicitly by the
  6. # invocation of this script using python -m setuptools.launch
  7. import tokenize
  8. import sys
  9. def run():
  10. """
  11. Run the script in sys.argv[1] as if it had
  12. been invoked naturally.
  13. """
  14. __builtins__
  15. script_name = sys.argv[1]
  16. namespace = dict(
  17. __file__=script_name,
  18. __name__='__main__',
  19. __doc__=None,
  20. )
  21. sys.argv[:] = sys.argv[1:]
  22. open_ = getattr(tokenize, 'open', open)
  23. script = open_(script_name).read()
  24. norm_script = script.replace('\\r\\n', '\\n')
  25. code = compile(norm_script, script_name, 'exec')
  26. exec(code, namespace)
  27. if __name__ == '__main__':
  28. run()