Skip to content

Commit

Permalink
[SHOT-3309] Create 4 alias plugins for supporting python 3 #33
Browse files Browse the repository at this point in the history
Added plugins and ran the black formatter (#33)
  • Loading branch information
000paradox000 authored Feb 21, 2020
1 parent 53703f2 commit ae8fd85
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 10 deletions.
Binary file modified plugins/shotgun.plugin
Binary file not shown.
Binary file modified plugins/shotgun_legacy.plugin
Binary file not shown.
Binary file added plugins/shotgun_legacy_py2.plugin
Binary file not shown.
Binary file added plugins/shotgun_py2.plugin
Binary file not shown.
17 changes: 9 additions & 8 deletions python/tk_alias/dialog_parent.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
set of win32 functions used by Alias engine to manage toolkit UI under windows
"""
import ctypes
from ctypes import wintypes

from sgtk.platform.qt import QtCore
from sgtk.platform.qt import QtGui
Expand Down Expand Up @@ -53,16 +54,16 @@
# structures
class PROCESSENTRY32(ctypes.Structure):
_fields_ = [
("dwSize", ctypes.wintypes.DWORD),
("cntUsage", ctypes.wintypes.DWORD),
("th32ProcessID", ctypes.wintypes.DWORD),
("dwSize", wintypes.DWORD),
("cntUsage", wintypes.DWORD),
("th32ProcessID", wintypes.DWORD),
("th32DefaultHeapID", ctypes.POINTER(ctypes.c_ulong)),
("th32ModuleID", ctypes.wintypes.DWORD),
("cntThreads", ctypes.wintypes.DWORD),
("th32ParentProcessID", ctypes.wintypes.DWORD),
("th32ModuleID", wintypes.DWORD),
("cntThreads", wintypes.DWORD),
("th32ParentProcessID", wintypes.DWORD),
("pcPriClassBase", ctypes.c_long),
("dwFlags", ctypes.wintypes.DWORD),
("szExeFile", ctypes.c_wchar * ctypes.wintypes.MAX_PATH),
("dwFlags", wintypes.DWORD),
("szExeFile", ctypes.c_wchar * wintypes.MAX_PATH),
]


Expand Down
21 changes: 19 additions & 2 deletions startup.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,18 @@ class AliasLauncher(SoftwareLauncher):

# Shotgun default plugins
DEFAULT_PLUGINS = {
"shotgun.plugin": {"min_version": "2020.2"},
"shotgun_legacy.plugin": {"min_version": "2019", "max_version": "2020.1"},
"shotgun.plugin": {"min_version": "2020.2", "python_major_version": 3},
"shotgun_py2.plugin": {"min_version": "2020.2", "python_major_version": 2},
"shotgun_legacy.plugin": {
"min_version": "2019",
"max_version": "2020.1",
"python_major_version": 3,
},
"shotgun_legacy_py2.plugin": {
"min_version": "2019",
"max_version": "2020.1",
"python_major_version": 2,
},
}

# This dictionary defines a list of executable template strings for each
Expand Down Expand Up @@ -250,6 +260,7 @@ def _get_plugins_list_file(self, exec_path, code_name):
plugin_data = self.DEFAULT_PLUGINS.get(plugin_file_name)
min_version = plugin_data.get("min_version")
max_version = plugin_data.get("max_version")
python_major_version = plugin_data.get("python_major_version")

# check constraints
if min_version and release_version < min_version:
Expand All @@ -258,6 +269,9 @@ def _get_plugins_list_file(self, exec_path, code_name):
if max_version and release_version > max_version:
continue

if python_major_version != self._get_python_version():
continue

# appends found *.plugin file path in plugins.lst file
plf.write("{0}\n".format(plugin_file_path))
plugins_number += 1
Expand All @@ -271,6 +285,9 @@ def _clean_args(self, args):

return args

def _get_python_version(self):
return sys.version_info.major

def _get_release_version(self, exec_path, code_name):
alias_bindir = os.path.dirname(exec_path)
about_box_file = os.path.join(
Expand Down

0 comments on commit ae8fd85

Please sign in to comment.