Skip to content

Commit 3892b71

Browse files
authored
Fix package installation with pip3 (#80)
* Add support for pip3
1 parent e3a14c1 commit 3892b71

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

ctfcli/cli/plugins.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
import shutil
33
import subprocess
44

5+
import click
6+
57
from ctfcli.utils.plugins import get_plugin_dir
68

79

@@ -11,8 +13,19 @@ def install(self, url):
1113
get_plugin_dir(), os.path.basename(url).rsplit(".", maxsplit=1)[0]
1214
)
1315
subprocess.call(["git", "clone", url, local_dir])
16+
17+
pip = shutil.which("pip")
18+
pip3 = shutil.which("pip3")
19+
20+
if pip is None and pip3 is None:
21+
click.secho(f"Neither pip nor pip3 was found, is it in the PATH?", fg="red")
22+
return
23+
24+
if pip is None:
25+
pip = pip3
26+
1427
subprocess.call(
15-
["pip", "install", "-r", os.path.join(local_dir, "requirements.txt")]
28+
[pip, "install", "-r", os.path.join(local_dir, "requirements.txt")]
1629
)
1730

1831
def uninstall(self, plugin_name):

0 commit comments

Comments
 (0)