Skip to content

Commit

Permalink
PR Suggestion
Browse files Browse the repository at this point in the history
Signed-off-by: ddelange <[email protected]>
  • Loading branch information
ddelange committed Jul 13, 2023
1 parent 2c382eb commit c0c7e57
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions python/packaging/frontend_sdist/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,31 +32,32 @@
disable_internal_pip = os.environ.get("NVIDIA_TENSORRT_DISABLE_INTERNAL_PIP", False)


def run_pip_command(args, call_func):
try:
return call_func([sys.executable, "-m", "pip"] + args)
except subprocess.CalledProcessError:
return call_func([os.path.join(sys.exec_prefix, "bin", "pip")] + args)


class InstallCommand(install):
def run(self):
# pip-inside-pip hack ref #3080
subprocess.check_call(
run_pip_command(
[
"{}/bin/pip".format(sys.exec_prefix),
"install",
"--extra-index-url",
nvidia_pip_index_url,
*tensorrt_submodules,
]
],
subprocess.check_call,
)

super().run()


def pip_config_list():
"""Get the current pip config (env vars, config file, etc)."""
return subprocess.check_output(
[
"{}/bin/pip".format(sys.exec_prefix),
"config",
"list",
]
).decode()
return run_pip_command(["config", "list"], subprocess.check_output).decode()


def parent_command_line():
Expand Down

0 comments on commit c0c7e57

Please sign in to comment.