Update to py3

This commit is contained in:
geckguy
2023-06-10 21:11:09 +05:30
parent b978f4d4f5
commit 205f6b47eb
3 changed files with 39 additions and 9 deletions
+1 -2
View File
@@ -1,4 +1,3 @@
#
# This source file is part of appleseed.
# Visit https://appleseedhq.net/ for additional information and resources.
@@ -33,7 +32,7 @@
# in that case just load the normal appleseed.python module.
try:
from _appleseedpythonbuiltin import *
except:
except ImportError:
from sys import hexversion as appleseed_python_hexversion
if appleseed_python_hexversion < 0x030000F0:
+5 -7
View File
@@ -33,7 +33,7 @@
# in that case just load the normal appleseed.python module.
try:
from _appleseedpythonbuiltin import *
except:
except ImportError:
from sys import hexversion as appleseed_python_hexversion
if appleseed_python_hexversion < 0x030000F0:
@@ -44,9 +44,8 @@ except:
from ._appleseedpython3 import *
class ConsoleLogTarget(ILogTarget):
def __init__(self, stream):
ILogTarget.__init__(self)
super().__init__()
self.__stream = stream
def write(self, category, file, line, header, message):
@@ -56,9 +55,8 @@ class ConsoleLogTarget(ILogTarget):
class FileLogTarget(ILogTarget):
def __init__(self):
ILogTarget.__init__(self)
super().__init__()
self.__file = None
def open(self, filename):
@@ -73,10 +71,10 @@ class FileLogTarget(ILogTarget):
self.__file = None
def is_open(self):
return self.__file != None
return self.__file is not None
def write(self, category, file, line, header, message):
if self.is_open():
lines = message.split('\n')
for line in lines:
self.__file.write(header + line + '\n')
self.__file.write(header + line + '\n')
+33
View File
@@ -1,3 +1,36 @@
# This source file is part of appleseed.
# Visit https://appleseedhq.net/ for additional information and resources.
#
# This software is released under the MIT license.
#
# Copyright (c) 2012-2013 Esteban Tovagliari, Jupiter Jazz Limited
# Copyright (c) 2014-2018 Esteban Tovagliari, The appleseedhq Organization
#
# 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.
#
# The appleseed.python module built into appleseed.studio
# is called _appleseedpythonbuiltin. Try to load it first.
# If that fails it means that we are not in appleseed.studio;
# in that case just load the normal appleseed.python module.
import os
import sys
import logging