mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 08:24:53 +01:00
moved slack module
This commit is contained in:
parent
db31a6aea9
commit
615f9145e1
108 changed files with 1 additions and 0 deletions
34
openpype/modules/slack/launch_hooks/pre_python2_vendor.py
Normal file
34
openpype/modules/slack/launch_hooks/pre_python2_vendor.py
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
import os
|
||||
from openpype.lib import PreLaunchHook
|
||||
from openpype_modules.slack import SLACK_MODULE_DIR
|
||||
|
||||
|
||||
class PrePython2Support(PreLaunchHook):
|
||||
"""Add python slack api module for Python 2 to PYTHONPATH.
|
||||
|
||||
Path to vendor modules is added to the beginning of PYTHONPATH.
|
||||
"""
|
||||
|
||||
def execute(self):
|
||||
if not self.application.use_python_2:
|
||||
return
|
||||
|
||||
self.log.info("Adding Slack Python 2 packages to PYTHONPATH.")
|
||||
|
||||
# Prepare vendor dir path
|
||||
python_2_vendor = os.path.join(SLACK_MODULE_DIR, "python2_vendor")
|
||||
|
||||
# Add Python 2 modules
|
||||
python_paths = [
|
||||
# `python-ftrack-api`
|
||||
os.path.join(python_2_vendor, "python-slack-sdk-1", "slackclient"),
|
||||
os.path.join(python_2_vendor, "python-slack-sdk-1")
|
||||
]
|
||||
self.log.info("python_paths {}".format(python_paths))
|
||||
# Load PYTHONPATH from current launch context
|
||||
python_path = self.launch_context.env.get("PYTHONPATH")
|
||||
if python_path:
|
||||
python_paths.append(python_path)
|
||||
|
||||
# Set new PYTHONPATH to launch context environments
|
||||
self.launch_context.env["PYTHONPATH"] = os.pathsep.join(python_paths)
|
||||
Loading…
Add table
Add a link
Reference in a new issue