@@ -0,0 +1,23 @@
|
||||
"""Run build Python with the exported Modulus package ahead of the bootstrap."""
|
||||
|
||||
import pathlib
|
||||
import runpy
|
||||
import sys
|
||||
|
||||
def main():
|
||||
root, *arguments = sys.argv[1:]
|
||||
sys.path[:0] = [str(pathlib.Path(root).resolve()), str(pathlib.Path.cwd())]
|
||||
if not arguments:
|
||||
raise SystemExit('expected -m MODULE, -c CODE, or a Python script')
|
||||
if arguments[0] == '-m' and len(arguments) >= 2:
|
||||
sys.argv = arguments[1:]
|
||||
runpy.run_module(arguments[1], run_name='__main__', alter_sys=True)
|
||||
elif arguments[0] == '-c' and len(arguments) >= 2:
|
||||
sys.argv = ['-c', *arguments[2:]]
|
||||
exec(compile(arguments[1], '<string>', 'exec'), {'__name__': '__main__'})
|
||||
else:
|
||||
sys.argv = arguments
|
||||
runpy.run_path(arguments[0], run_name='__main__')
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user