File: run_script.py

package info (click to toggle)
breezy 3.3.21-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 40,760 kB
  • sloc: python: 279,676; ansic: 1,093; makefile: 367; sh: 284; lisp: 107
file content (16 lines) | stat: -rw-r--r-- 728 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# A utility that executes a script from our %PYTHON%\Scripts directory.
# Example usage:
# 'python run_script.py cog.py arg1 arg2'
# which will locate %PYTHON_HOME%/Scripts/cog.py and execute it with the args.
# This is only necessary for Windows, and only when the build process is
# executed via a cygwin/*nix based make utility, which doesn't honor the
# PATHEXT environment variable.
import os
import sys

if __name__ == "__main__":
    # clobber me, new sys.argv[0] is the script to run.
    del sys.argv[0]
    assert not os.path.isabs(sys.argv[0]), "If you know the FQ path, just use it!"
    sys.argv[0] = os.path.join(sys.prefix, "Scripts", sys.argv[0])
    exec(compile(open(sys.argv[0]).read(), sys.argv[0], "exec"))