Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix python3 compatibility #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from tank.platform.constants import SHOTGUN_ENGINE_NAME
from tank.platform.constants import TANK_ENGINE_INIT_HOOK_NAME

from tank_vendor import six

__author__ = "Diego Garcia Huerta"
__contact__ = "https://www.linkedin.com/in/diegogh/"
Expand Down Expand Up @@ -305,7 +306,7 @@ def context_change_allowed(self):
@property
def host_info(self):
"""
:returns: A dictionary with information about the application hosting
:returns: A dictionary with information about the application hosting
his engine.

The returned dictionary is of the following form on success:
Expand Down Expand Up @@ -552,8 +553,8 @@ def post_app_init(self):

def post_context_change(self, old_context, new_context):
"""
Runs after a context change. The Harmony event watching will
be stopped and new callbacks registered containing the new context
Runs after a context change. The Harmony event watching will
be stopped and new callbacks registered containing the new context
information.

:param old_context: The context being changed away from.
Expand All @@ -572,14 +573,14 @@ def post_context_change(self, old_context, new_context):

def _run_app_instance_commands(self):
"""
Runs the series of app instance commands listed in the
Runs the series of app instance commands listed in the
'run_at_startup' setting of the environment configuration yaml file.
"""

# Build a dictionary mapping app instance names to dictionaries of
# commands they registered with the engine.
app_instance_commands = {}
for (cmd_name, value) in self.commands.iteritems():
for (cmd_name, value) in six.iteritems(self.commands):
app_instance = value["properties"].get("app")
if app_instance:
# Add entry 'command name: command function' to the command
Expand Down Expand Up @@ -609,7 +610,7 @@ def _run_app_instance_commands(self):
else:
if not setting_cmd_name:
# Run all commands of the given app instance.
for (cmd_name, command_function) in cmd_dict.iteritems():
for (cmd_name, command_function) in six.iteritems(cmd_dict):
msg = (
"%s startup running app '%s' command '%s'.",
self.name,
Expand Down
2 changes: 1 addition & 1 deletion python/tk_harmony/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
import application
from . import application
from .menu_generation import MenuGenerator
7 changes: 4 additions & 3 deletions python/tk_harmony/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from .client import QTcpSocketClient
from .utils import copy_tree, normpath, Cached

from tank_vendor import six

__author__ = "Diego Garcia Huerta"
__contact__ = "https://www.linkedin.com/in/diegogh/"
Expand Down Expand Up @@ -159,7 +160,7 @@ def new_file(self, app, context):
fields["extension"] = "xstage"

ctx_fields = context.as_template_fields(work_template, validate=True)
fields = dict(chain(fields.iteritems(), ctx_fields.iteritems()))
fields = dict(chain(six.iteritems(fields), six.iteritems(ctx_fields)))

destination_path = None
# very cheap way to get the next available version
Expand Down Expand Up @@ -209,10 +210,10 @@ def save_project_as(self, target_file, source_file=None, open_project=True):
source_file = self.get_current_project_path()

source_folder, source_filename = os.path.split(source_file)
source_filename_file, source_filename_ext = os.path.splitext(source_filename)
source_filename_file, _ = os.path.splitext(source_filename)

target_folder, target_filename = os.path.split(target_file)
target_filename_file, target_filename_ext = os.path.splitext(target_filename)
target_filename_file, _ = os.path.splitext(target_filename)

# we need to ignore all the other versions within the
# folder of this WIP version except for the ones that
Expand Down
Loading