From 40d400e1d153dcac42f483f26408ee7ee413459d Mon Sep 17 00:00:00 2001 From: Carlos Villavicencio Date: Tue, 7 Jan 2025 08:24:55 -0500 Subject: [PATCH 1/3] Remove Python 2 traces --- python/shotgun_desktop/errors.py | 2 +- python/shotgun_desktop/paths.py | 2 +- python/shotgun_desktop/startup.py | 13 ------------- python/shotgun_desktop/upgrade_startup.py | 15 +-------------- software_credits | 22 ---------------------- 5 files changed, 3 insertions(+), 51 deletions(-) diff --git a/python/shotgun_desktop/errors.py b/python/shotgun_desktop/errors.py index a3fcccb9..14cc1791 100644 --- a/python/shotgun_desktop/errors.py +++ b/python/shotgun_desktop/errors.py @@ -138,7 +138,7 @@ def __init__(self, reason, toolkit_path): class EngineNotCompatibleWithDesktop16(ShotgunDesktopError): def __init__(self, app_version): - super(EngineNotCompatibleWithDesktop16, self).__init__( + super().__init__( "Your version of tk-desktop is not compatible with this PTR desktop app {}.\n" "\n" "Please upgrade your site configuration's tk-desktop to v2.5.9+ or " diff --git a/python/shotgun_desktop/paths.py b/python/shotgun_desktop/paths.py index e50e01c3..7abe5686 100644 --- a/python/shotgun_desktop/paths.py +++ b/python/shotgun_desktop/paths.py @@ -10,7 +10,7 @@ import os import sys -from tank_vendor.six.moves.urllib import parse +from urllib import parse import pprint import sgtk diff --git a/python/shotgun_desktop/startup.py b/python/shotgun_desktop/startup.py index e2511088..87016494 100644 --- a/python/shotgun_desktop/startup.py +++ b/python/shotgun_desktop/startup.py @@ -8,8 +8,6 @@ # agreement to the Shotgun Pipeline Toolkit Source Code License. All rights # not expressly granted therein are reserved by Shotgun Software Inc. -from __future__ import absolute_import - import os import sys import time @@ -552,17 +550,6 @@ def __start_engine_in_zero_config(app, app_bootstrap, splash, user): mgr = sgtk.bootstrap.ToolkitManager(user) - # If 'SHOTGUN_PYTHON_VERSION' environment variable has been set, but at this point - # we are running in Python 3 we should warn the user that this will have no - # effect as there is no Python 2 version available. - if str(os.environ.get("SHOTGUN_PYTHON_VERSION")) == "2" and sys.version_info[0] > 2: - DesktopMessageBox.critical( - "Flow Production Tracking Warning", - "{constant} will have no effect because there's not Python 2 available version.\n".format( - constant="SHOTGUN_PYTHON_VERSION" - ), - ) - # Allows to take over the site config to use with Desktop without impacting the projects # configurations. mgr.base_configuration = os.environ.get( diff --git a/python/shotgun_desktop/upgrade_startup.py b/python/shotgun_desktop/upgrade_startup.py index 3124aae8..6e220e15 100644 --- a/python/shotgun_desktop/upgrade_startup.py +++ b/python/shotgun_desktop/upgrade_startup.py @@ -34,8 +34,7 @@ def _supports_get_from_location_and_paths(sgtk): def _out_of_date_check(latest_descriptor, current_desc): """ - Check if the version is out of date, this prevents an upgrade of the startup logic - in the event that it detects PTR desktop app is running on Python 2. + Check if the version is out of date. :param latest_descriptor:`sgtk.descriptor.FrameworkDescriptor` instance with the latest startup descriptor. :param current_desc:`sgtk.descriptor.FrameworkDescriptor` instance with the current startup descriptor. @@ -44,18 +43,6 @@ def _out_of_date_check(latest_descriptor, current_desc): appstore. False otherwise. """ - # If we're running in Python 2 and if the bundled framework exists on disk, - # returns False to avoid upgrade the startup logic. - if sys.version_info[0] < 3 and os.path.exists(current_desc.get_path()): - logger.debug( - "Using Python version '%s'" - % ".".join(str(i) for i in sys.version_info[0:3]) - ) - logger.debug( - "Desktop startup is Currently running version %s" - % current_desc.get_version(), - ) - return False return latest_descriptor.get_version() != current_desc.get_version() diff --git a/software_credits b/software_credits index e0a7e6fb..a179d3a5 100644 --- a/software_credits +++ b/software_credits @@ -541,25 +541,3 @@ SOFTWARE. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - -=== six (https://pypi.org/project/six/) ============================ - -Copyright (c) 2010-2019 Benjamin Peterson - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. From adf925c4ce4145ecc7e8bf998fa1f183d05f94d1 Mon Sep 17 00:00:00 2001 From: Carlos Villavicencio Date: Tue, 7 Jan 2025 11:44:36 -0500 Subject: [PATCH 2/3] Reverts some stuff --- python/shotgun_desktop/upgrade_startup.py | 12 ++++++++++++ software_credits | 21 +++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/python/shotgun_desktop/upgrade_startup.py b/python/shotgun_desktop/upgrade_startup.py index 6e220e15..19bf0e69 100644 --- a/python/shotgun_desktop/upgrade_startup.py +++ b/python/shotgun_desktop/upgrade_startup.py @@ -43,6 +43,18 @@ def _out_of_date_check(latest_descriptor, current_desc): appstore. False otherwise. """ + # If we're running in Python 2 and if the bundled framework exists on disk, + # returns False to avoid upgrade the startup logic. + if sys.version_info[0] < 3 and os.path.exists(current_desc.get_path()): + logger.debug( + "Using Python version '%s'" + % ".".join(str(i) for i in sys.version_info[0:3]) + ) + logger.debug( + "Desktop startup is Currently running version %s" + % current_desc.get_version(), + ) + return False return latest_descriptor.get_version() != current_desc.get_version() diff --git a/software_credits b/software_credits index a179d3a5..67eb2e0e 100644 --- a/software_credits +++ b/software_credits @@ -541,3 +541,24 @@ SOFTWARE. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +=== six (https://pypi.org/project/six/) ============================ + +Copyright (c) 2010-2019 Benjamin Peterson + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. From 795d48867ad7b2048187caba6bc35a47caddc0fd Mon Sep 17 00:00:00 2001 From: Carlos Villavicencio Date: Tue, 7 Jan 2025 11:48:01 -0500 Subject: [PATCH 3/3] Revert some stuff --- python/shotgun_desktop/upgrade_startup.py | 3 ++- software_credits | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/python/shotgun_desktop/upgrade_startup.py b/python/shotgun_desktop/upgrade_startup.py index 19bf0e69..3124aae8 100644 --- a/python/shotgun_desktop/upgrade_startup.py +++ b/python/shotgun_desktop/upgrade_startup.py @@ -34,7 +34,8 @@ def _supports_get_from_location_and_paths(sgtk): def _out_of_date_check(latest_descriptor, current_desc): """ - Check if the version is out of date. + Check if the version is out of date, this prevents an upgrade of the startup logic + in the event that it detects PTR desktop app is running on Python 2. :param latest_descriptor:`sgtk.descriptor.FrameworkDescriptor` instance with the latest startup descriptor. :param current_desc:`sgtk.descriptor.FrameworkDescriptor` instance with the current startup descriptor. diff --git a/software_credits b/software_credits index 67eb2e0e..e0a7e6fb 100644 --- a/software_credits +++ b/software_credits @@ -542,6 +542,7 @@ SOFTWARE. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + === six (https://pypi.org/project/six/) ============================ Copyright (c) 2010-2019 Benjamin Peterson