Fix recursive call on Windows

For some reason sys.argv[0] may contain path to the python wrapper
(hererocks-script.py) or just "hererocks". Use inspect.getsourcefile
to get hererocks file location instead.
This commit is contained in:
Peter Melnichenko 2017-01-09 12:35:40 +03:00
parent 6840fa3eb9
commit 09ea6dd2e4

View File

@ -6,6 +6,7 @@ from __future__ import print_function
import argparse
import hashlib
import inspect
import json
import os
import platform
@ -1645,7 +1646,7 @@ def setup_vs_and_rerun(vs_version, arch):
argv_name = os.path.join(temp_dir, "argv")
setup_output_name = os.path.join(temp_dir, "setup_out")
script_arg = '"{}"'.format(sys.argv[0])
script_arg = '"{}"'.format(inspect.getsourcefile(main))
if sys.executable:
script_arg = '"{}" {}'.format(sys.executable, script_arg)