mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
Add lib folder to pkg_resources's working set (#3843)
This commit is contained in:
parent
f2f3ac7d42
commit
65395185c3
@ -7,6 +7,7 @@ import json
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import pip
|
import pip
|
||||||
|
import pkg_resources
|
||||||
import platform
|
import platform
|
||||||
import shutil
|
import shutil
|
||||||
import signal
|
import signal
|
||||||
@ -346,6 +347,14 @@ async def run_bot(red: Red, cli_flags: Namespace) -> None:
|
|||||||
LIB_PATH.mkdir(parents=True, exist_ok=True)
|
LIB_PATH.mkdir(parents=True, exist_ok=True)
|
||||||
if str(LIB_PATH) not in sys.path:
|
if str(LIB_PATH) not in sys.path:
|
||||||
sys.path.append(str(LIB_PATH))
|
sys.path.append(str(LIB_PATH))
|
||||||
|
|
||||||
|
# "It's important to note that the global `working_set` object is initialized from
|
||||||
|
# `sys.path` when `pkg_resources` is first imported, but is only updated if you do
|
||||||
|
# all future `sys.path` manipulation via `pkg_resources` APIs. If you manually modify
|
||||||
|
# `sys.path`, you must invoke the appropriate methods on the `working_set` instance
|
||||||
|
# to keep it in sync."
|
||||||
|
# Source: https://setuptools.readthedocs.io/en/latest/pkg_resources.html#workingset-objects
|
||||||
|
pkg_resources.working_set.add_entry(str(LIB_PATH))
|
||||||
sys.meta_path.insert(0, SharedLibImportWarner())
|
sys.meta_path.insert(0, SharedLibImportWarner())
|
||||||
|
|
||||||
if cli_flags.token:
|
if cli_flags.token:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user