Skip to content

Commit 0f6c9a3

Browse files
committed
Add support for plugin packages in Windows
1 parent ed22851 commit 0f6c9a3

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

cogs/plugins.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,21 @@ async def load_plugin(self, username, repo, plugin_name):
109109
if "requirements.txt" in os.listdir(dirname):
110110
# Install PIP requirements
111111
try:
112-
await self.bot.loop.run_in_executor(
113-
None,
114-
self._asubprocess_run,
115-
f"python3 -m pip install -U -r {dirname}/"
116-
"requirements.txt --user -q -q",
117-
)
118-
# -q -q (quiet)
119-
# so there's no terminal output unless there's an error
112+
if os.name == "nt": # Windows
113+
await self.bot.loop.run_in_executor(
114+
None,
115+
self._asubprocess_run,
116+
f"pip install -r {dirname}/requirements.txt",
117+
)
118+
else:
119+
await self.bot.loop.run_in_executor(
120+
None,
121+
self._asubprocess_run,
122+
f"python3 -m pip install -U -r {dirname}/"
123+
"requirements.txt --user -q -q",
124+
)
125+
# -q -q (quiet)
126+
# so there's no terminal output unless there's an error
120127
except subprocess.CalledProcessError as exc:
121128
err = exc.stderr.decode("utf8").strip()
122129

0 commit comments

Comments
 (0)