From bed7b76524e398c16416ef992b7217bb733209e0 Mon Sep 17 00:00:00 2001 From: mosfet80 Date: Sat, 4 Mar 2023 19:36:18 +0100 Subject: [PATCH] remove Python2 code --- src/3rdParty/lazy_loader/lazy_loader.py | 1 - src/Gui/FreeCADGuiInit.py | 8 ++------ src/Gui/PythonDebugger.cpp | 15 ++------------- src/Mod/AddonManager/Addon.py | 2 -- .../addonmanager_workers_startup.py | 5 ----- src/Mod/AddonManager/package_details.py | 10 ---------- src/Mod/AddonManager/package_list.py | 7 ------- src/Mod/Arch/ArchNesting.py | 1 - src/Mod/Arch/ArchSchedule.py | 1 - src/Mod/Arch/exportIFC.py | 2 -- src/Mod/Arch/exportIFCStructuralTools.py | 2 -- src/Mod/Arch/import3DS.py | 1 - src/Mod/Arch/importIFC.py | 1 - src/Mod/Arch/importIFCmulticore.py | 2 -- src/Mod/Arch/importSH3D.py | 1 - src/Mod/Arch/importSHP.py | 2 -- src/Mod/Fem/feminout/importCcxDatResults.py | 7 +------ src/Mod/Fem/feminout/importCcxFrdResults.py | 7 +------ src/Mod/Fem/feminout/importFenicsMesh.py | 7 +------ src/Mod/Fem/feminout/importInpMesh.py | 7 +------ src/Mod/Fem/feminout/importPyMesh.py | 7 +------ src/Mod/Fem/feminout/importVTKResults.py | 7 +------ src/Mod/Fem/feminout/importYamlJsonMesh.py | 7 +------ src/Mod/Fem/feminout/importZ88Mesh.py | 7 +------ src/Mod/Fem/feminout/importZ88O2Results.py | 7 +------ .../Path/Path/Base/Generator/threadmilling.py | 2 -- src/Mod/Path/Path/Dressup/Gui/Dogbone.py | 1 - src/Mod/Path/Path/Dressup/Gui/Dragknife.py | 1 - src/Mod/Path/Path/Dressup/Gui/LeadInOut.py | 1 - src/Mod/Path/Path/Main/Gui/Sanity.py | 1 - src/Mod/Path/Path/Op/Drilling.py | 1 - src/Mod/Path/Path/Op/MillFace.py | 1 - src/Mod/Path/Path/Op/Probe.py | 1 - src/Mod/Path/Path/Op/Slot.py | 2 -- src/Mod/Path/Path/Op/Surface.py | 2 -- src/Mod/Path/Path/Op/SurfaceSupport.py | 1 - src/Mod/Path/Path/Op/ThreadMilling.py | 1 - src/Mod/Path/Path/Op/Waterline.py | 1 - src/Mod/Path/Path/Post/Command.py | 1 - .../Post/scripts/KineticNCBeamicon2_post.py | 1 - .../Path/Path/Post/scripts/centroid_post.py | 1 - src/Mod/Path/Path/Post/scripts/dumper_post.py | 1 - src/Mod/Path/Path/Post/scripts/dxf_post.py | 2 +- .../Path/Post/scripts/dynapath_4060_post.py | 1 - .../Path/Path/Post/scripts/dynapath_post.py | 2 +- src/Mod/Path/Path/Post/scripts/example_post.py | 1 - src/Mod/Path/Path/Post/scripts/fanuc_post.py | 2 +- src/Mod/Path/Path/Post/scripts/jtech_post.py | 1 - .../Path/Path/Post/scripts/linuxcnc_post.py | 1 - .../Path/Path/Post/scripts/mach3_mach4_post.py | 2 +- src/Mod/Path/Path/Post/scripts/opensbp_post.py | 1 - src/Mod/Path/Path/Post/scripts/opensbp_pre.py | 2 +- .../Post/scripts/refactored_centroid_post.py | 1 - .../Path/Post/scripts/refactored_grbl_post.py | 1 - .../Post/scripts/refactored_linuxcnc_post.py | 1 - .../scripts/refactored_mach3_mach4_post.py | 2 +- .../Path/Post/scripts/refactored_test_post.py | 1 - .../Path/Path/Post/scripts/smoothie_post.py | 1 - src/Mod/Path/Path/Post/scripts/uccnc_post.py | 2 +- .../Path/PathPythonGui/simple_edit_panel.py | 1 - src/Mod/Spreadsheet/importXLSX.py | 1 - src/Mod/TechDraw/TDTest/DLeaderRText.py | 2 +- src/Mod/TechDraw/TDTest/DrawHatchTest.py | 1 - .../TechDraw/TDTest/DrawViewAnnotationTest.py | 2 +- src/Mod/TechDraw/TDTest/DrawViewDetailTest.py | 2 +- src/Mod/TechDraw/TDTest/DrawViewImageTest.py | 2 +- src/Mod/TechDraw/TDTest/DrawViewPartTest.py | 2 +- src/Mod/TechDraw/TDTest/DrawViewSymbolTest.py | 1 - src/Mod/TechDraw/TDTest/TDPyTest.py | 1 - .../TechDraw/TDTest/TechDrawTestUtilities.py | 1 - src/Mod/Test/TestPythonSyntax.py | 2 -- src/Tools/MakeMacBundleRelocatable.py | 4 +--- src/Tools/generateBase/__exec_new.py | 4 ---- src/Tools/generateBase/__exec_old.py | 5 ----- src/Tools/generateBase/generateDS.py | 1 - src/Tools/generateBase/generateModel_Module.py | 1 - src/Tools/generateBase/generateTools.py | 18 +----------------- .../generateTemplates/templateClassPyExport.py | 8 +------- src/Tools/updatets.py | 1 - 79 files changed, 28 insertions(+), 200 deletions(-) delete mode 100644 src/Tools/generateBase/__exec_new.py delete mode 100644 src/Tools/generateBase/__exec_old.py diff --git a/src/3rdParty/lazy_loader/lazy_loader.py b/src/3rdParty/lazy_loader/lazy_loader.py index 2a443fc30c..f6d71dfe17 100644 --- a/src/3rdParty/lazy_loader/lazy_loader.py +++ b/src/3rdParty/lazy_loader/lazy_loader.py @@ -17,7 +17,6 @@ from __future__ import absolute_import from __future__ import division -from __future__ import print_function import importlib import types diff --git a/src/Gui/FreeCADGuiInit.py b/src/Gui/FreeCADGuiInit.py index 7969a76d7c..9077af52dc 100644 --- a/src/Gui/FreeCADGuiInit.py +++ b/src/Gui/FreeCADGuiInit.py @@ -120,12 +120,8 @@ class NoneWorkbench ( Workbench ): def InitApplications(): import sys,os,traceback - try: - # Python3 - import io as cStringIO - except ImportError: - # Python2 - import cStringIO + import io as cStringIO + # Searching modules dirs +++++++++++++++++++++++++++++++++++++++++++++++++++ # (additional module paths are already cached) ModDirs = FreeCAD.__ModDirs__ diff --git a/src/Gui/PythonDebugger.cpp b/src/Gui/PythonDebugger.cpp index b45f071fb5..9d065196e8 100644 --- a/src/Gui/PythonDebugger.cpp +++ b/src/Gui/PythonDebugger.cpp @@ -574,7 +574,7 @@ static PyCodeObject* PyFrame_GetCode(PyFrameObject *frame) // http://www.koders.com/cpp/fidBA6CD8A0FE5F41F1464D74733D9A711DA257D20B.aspx?s=PyEval_SetTrace // http://code.google.com/p/idapython/source/browse/trunk/python.cpp // http://www.koders.com/cpp/fid191F7B13CF73133935A7A2E18B7BF43ACC6D1784.aspx?s=PyEval_SetTrace -// http://stuff.mit.edu/afs/sipb/project/python/src/python2.2-2.2.2/Modules/_hotshot.c + int PythonDebugger::tracer_callback(PyObject *obj, PyFrameObject *frame, int what, PyObject * /*arg*/) { auto self = static_cast(obj); @@ -582,10 +582,6 @@ int PythonDebugger::tracer_callback(PyObject *obj, PyFrameObject *frame, int wha if (dbg->d->trystop) PyErr_SetInterrupt(); QCoreApplication::processEvents(); - //int no; - - //no = frame->f_tstate->recursion_depth; - //std::string funcname = PyString_AsString(frame->f_code->co_name); PyCodeObject* code = PyFrame_GetCode(frame); QString file = QString::fromUtf8(PyUnicode_AsUTF8(code->co_filename)); Py_DECREF(code); @@ -599,18 +595,11 @@ int PythonDebugger::tracer_callback(PyObject *obj, PyFrameObject *frame, int wha return 0; case PyTrace_LINE: { - //PyObject *str; - //str = PyObject_Str(frame->f_code->co_filename); - //no = frame->f_lineno; PyCodeObject* f_code = PyFrame_GetCode(frame); int f_lasti = PyFrame_GetLineNumber(frame); int line = PyCode_Addr2Line(f_code, f_lasti); Py_DECREF(f_code); - //if (str) { - // Base::Console().Message("PROFILING: %s:%d\n", PyString_AsString(str), frame->f_lineno); - // Py_DECREF(str); - //} - // For testing only + if (!dbg->d->trystop) { Breakpoint bp = dbg->getBreakpoint(file); if (bp.checkLine(line)) { diff --git a/src/Mod/AddonManager/Addon.py b/src/Mod/AddonManager/Addon.py index 9421d74624..83fd2c8f8d 100644 --- a/src/Mod/AddonManager/Addon.py +++ b/src/Mod/AddonManager/Addon.py @@ -153,7 +153,6 @@ class Addon: self.display_name = self.name self.url = url.strip() self.branch = branch.strip() - self.python2 = False self.obsolete = False self.rejected = False self.repo_type = Addon.Kind.WORKBENCH @@ -277,7 +276,6 @@ class Addon: "description": self.description, "cached_icon_filename": self.get_cached_icon_filename(), "best_icon_relative_path": self.get_best_icon_relative_path(), - "python2": self.python2, "obsolete": self.obsolete, "rejected": self.rejected, "requires": list(self.requires), diff --git a/src/Mod/AddonManager/addonmanager_workers_startup.py b/src/Mod/AddonManager/addonmanager_workers_startup.py index 230787db7c..5c52a62bfc 100644 --- a/src/Mod/AddonManager/addonmanager_workers_startup.py +++ b/src/Mod/AddonManager/addonmanager_workers_startup.py @@ -67,9 +67,6 @@ class CreateAddonListWorker(QtCore.QThread): # These addons will print an additional message informing the user self.obsolete = [] - # These addons will print an additional message informing the user Python2 only - self.py2only = [] - self.package_names = [] self.moddir = os.path.join(FreeCAD.getUserAppDataDir(), "Mod") self.current_thread = None @@ -242,8 +239,6 @@ class CreateAddonListWorker(QtCore.QThread): repo.updated_timestamp = os.path.getmtime(md_file) repo.verify_url_and_branch(url, branch) - if name in self.py2only: - repo.python2 = True if name in self.mod_reject_list: repo.rejected = True if name in self.obsolete: diff --git a/src/Mod/AddonManager/package_details.py b/src/Mod/AddonManager/package_details.py index 361ccb4b20..70fb2663ac 100644 --- a/src/Mod/AddonManager/package_details.py +++ b/src/Mod/AddonManager/package_details.py @@ -347,16 +347,6 @@ class PackageDetails(QtWidgets.QWidget): self.ui.labelWarningInfo.setStyleSheet( "color:" + utils.warning_color_string() ) - elif repo.python2: - self.ui.labelWarningInfo.show() - self.ui.labelWarningInfo.setText( - "

" - + translate("AddonsInstaller", "WARNING: This addon is Python 2 Only") - + "

" - ) - self.ui.labelWarningInfo.setStyleSheet( - "color:" + utils.warning_color_string() - ) elif required_version: self.ui.labelWarningInfo.show() self.ui.labelWarningInfo.setText( diff --git a/src/Mod/AddonManager/package_list.py b/src/Mod/AddonManager/package_list.py index 19a9449ce6..f133150ede 100644 --- a/src/Mod/AddonManager/package_list.py +++ b/src/Mod/AddonManager/package_list.py @@ -615,13 +615,6 @@ class PackageListFilter(QtCore.QSortFilterProxyModel): if data.status() != Addon.Status.UPDATE_AVAILABLE: return False - # If it's not installed, check to see if it's Py2 only - if ( - data.status() == Addon.Status.NOT_INSTALLED - and self.hide_py2 - and data.python2 - ): - return False # If it's not installed, check to see if it's marked obsolete if ( diff --git a/src/Mod/Arch/ArchNesting.py b/src/Mod/Arch/ArchNesting.py index a9eff2a0e7..25c3dcd86f 100644 --- a/src/Mod/Arch/ArchNesting.py +++ b/src/Mod/Arch/ArchNesting.py @@ -21,7 +21,6 @@ #*************************************************************************** -from __future__ import print_function import FreeCAD, Part, DraftGeomUtils, WorkingPlane, DraftVecUtils, math from datetime import datetime diff --git a/src/Mod/Arch/ArchSchedule.py b/src/Mod/Arch/ArchSchedule.py index 46429d3fad..2a4e6446b4 100644 --- a/src/Mod/Arch/ArchSchedule.py +++ b/src/Mod/Arch/ArchSchedule.py @@ -20,7 +20,6 @@ #* * #*************************************************************************** -from __future__ import print_function import FreeCAD if FreeCAD.GuiUp: import FreeCADGui diff --git a/src/Mod/Arch/exportIFC.py b/src/Mod/Arch/exportIFC.py index 8b087bc4db..d18f65caca 100644 --- a/src/Mod/Arch/exportIFC.py +++ b/src/Mod/Arch/exportIFC.py @@ -28,8 +28,6 @@ Internally it uses IfcOpenShell, which must be installed before using. # # This module provides tools to export IFC files. -from __future__ import print_function - import os import time import tempfile diff --git a/src/Mod/Arch/exportIFCStructuralTools.py b/src/Mod/Arch/exportIFCStructuralTools.py index 70f89facd0..dbf5e7fd30 100644 --- a/src/Mod/Arch/exportIFCStructuralTools.py +++ b/src/Mod/Arch/exportIFCStructuralTools.py @@ -19,8 +19,6 @@ # * * # *************************************************************************** -from __future__ import print_function - __title__ = "FreeCAD structural IFC export tools" __author__ = "Yorik van Havre" diff --git a/src/Mod/Arch/import3DS.py b/src/Mod/Arch/import3DS.py index 11d1a0c6fb..50884c9ab4 100644 --- a/src/Mod/Arch/import3DS.py +++ b/src/Mod/Arch/import3DS.py @@ -19,7 +19,6 @@ #* * #*************************************************************************** -from __future__ import print_function import os,FreeCAD,Mesh __title__ = "FreeCAD 3DS importer" diff --git a/src/Mod/Arch/importIFC.py b/src/Mod/Arch/importIFC.py index 62580db3d8..e2811c5689 100644 --- a/src/Mod/Arch/importIFC.py +++ b/src/Mod/Arch/importIFC.py @@ -28,7 +28,6 @@ Internally it uses IfcOpenShell, which must be installed before using. # # This module provides tools to import IFC files. -from __future__ import print_function import os import math diff --git a/src/Mod/Arch/importIFCmulticore.py b/src/Mod/Arch/importIFCmulticore.py index 1af9717b18..619d69f3b8 100644 --- a/src/Mod/Arch/importIFCmulticore.py +++ b/src/Mod/Arch/importIFCmulticore.py @@ -20,8 +20,6 @@ # *************************************************************************** """FreeCAD IFC importer - Multicore version""" -from __future__ import print_function - import sys import time import os diff --git a/src/Mod/Arch/importSH3D.py b/src/Mod/Arch/importSH3D.py index d6d70e5c54..891a2cd0db 100644 --- a/src/Mod/Arch/importSH3D.py +++ b/src/Mod/Arch/importSH3D.py @@ -19,7 +19,6 @@ #* * #*************************************************************************** -from __future__ import print_function __title__ = "FreeCAD SweetHome3D Importer" __author__ = "Yorik van Havre" __url__ = "https://www.freecadweb.org" diff --git a/src/Mod/Arch/importSHP.py b/src/Mod/Arch/importSHP.py index fea08d4362..d851f8aed8 100644 --- a/src/Mod/Arch/importSHP.py +++ b/src/Mod/Arch/importSHP.py @@ -20,8 +20,6 @@ #* * #*************************************************************************** -from __future__ import print_function - import os import FreeCAD translate = FreeCAD.Qt.translate diff --git a/src/Mod/Fem/feminout/importCcxDatResults.py b/src/Mod/Fem/feminout/importCcxDatResults.py index dfe3ec2ecf..db632691cc 100644 --- a/src/Mod/Fem/feminout/importCcxDatResults.py +++ b/src/Mod/Fem/feminout/importCcxDatResults.py @@ -40,12 +40,7 @@ EIGENVALUE_OUTPUT_SECTION = " E I G E N V A L U E O U T P U T" # ********* generic FreeCAD import and export methods ********* -if open.__module__ == "__builtin__": - # because we'll redefine open below (Python2) - pyopen = open -elif open.__module__ == "io": - # because we'll redefine open below (Python3) - pyopen = open +pyopen = open def open( diff --git a/src/Mod/Fem/feminout/importCcxFrdResults.py b/src/Mod/Fem/feminout/importCcxFrdResults.py index f916f273e0..99e4042f6f 100644 --- a/src/Mod/Fem/feminout/importCcxFrdResults.py +++ b/src/Mod/Fem/feminout/importCcxFrdResults.py @@ -38,12 +38,7 @@ from FreeCAD import Console # ********* generic FreeCAD import and export methods ********* -if open.__module__ == "__builtin__": - # because we'll redefine open below (Python2) - pyopen = open -elif open.__module__ == "io": - # because we'll redefine open below (Python3) - pyopen = open +pyopen = open def open(filename): diff --git a/src/Mod/Fem/feminout/importFenicsMesh.py b/src/Mod/Fem/feminout/importFenicsMesh.py index bb77156b10..eb14a43b5e 100644 --- a/src/Mod/Fem/feminout/importFenicsMesh.py +++ b/src/Mod/Fem/feminout/importFenicsMesh.py @@ -46,12 +46,7 @@ if FreeCAD.GuiUp: # Template copied from importZ88Mesh.py. Thanks Bernd! # ********* generic FreeCAD import and export methods ********* -if open.__module__ == "__builtin__": - # because we'll redefine open below (Python2) - pyopen = open -elif open.__module__ == "io": - # because we'll redefine open below (Python3) - pyopen = open +pyopen = open if FreeCAD.GuiUp: class WriteXDMFTaskPanel: diff --git a/src/Mod/Fem/feminout/importInpMesh.py b/src/Mod/Fem/feminout/importInpMesh.py index 18de92f8b5..0302ccc986 100644 --- a/src/Mod/Fem/feminout/importInpMesh.py +++ b/src/Mod/Fem/feminout/importInpMesh.py @@ -38,12 +38,7 @@ from FreeCAD import Console # ********* generic FreeCAD import and export methods ********* -if open.__module__ == "__builtin__": - # because we'll redefine open below (Python2) - pyopen = open -elif open.__module__ == "io": - # because we'll redefine open below (Python3) - pyopen = open +pyopen = open def open(filename): diff --git a/src/Mod/Fem/feminout/importPyMesh.py b/src/Mod/Fem/feminout/importPyMesh.py index 454b0c9c31..c385ff1215 100644 --- a/src/Mod/Fem/feminout/importPyMesh.py +++ b/src/Mod/Fem/feminout/importPyMesh.py @@ -38,12 +38,7 @@ from femmesh import meshtools # names are fix given from FreeCAD, these methods are called from FreeCAD # they are set in FEM modules Init.py -if open.__module__ == "__builtin__": - # because we'll redefine open below (Python2) - pyopen = open -elif open.__module__ == "io": - # because we'll redefine open below (Python3) - pyopen = open +ipyopen = open # export mesh to python diff --git a/src/Mod/Fem/feminout/importVTKResults.py b/src/Mod/Fem/feminout/importVTKResults.py index f15afbe3be..94f71dd85a 100644 --- a/src/Mod/Fem/feminout/importVTKResults.py +++ b/src/Mod/Fem/feminout/importVTKResults.py @@ -39,12 +39,7 @@ import Fem # ********* generic FreeCAD import and export methods ********* -if open.__module__ == "__builtin__": - # because we'll redefine open below (Python2) - pyopen = open -elif open.__module__ == "io": - # because we'll redefine open below (Python3) - pyopen = open +pyopen = open def open( diff --git a/src/Mod/Fem/feminout/importYamlJsonMesh.py b/src/Mod/Fem/feminout/importYamlJsonMesh.py index 43820c14ac..329bbdedb1 100644 --- a/src/Mod/Fem/feminout/importYamlJsonMesh.py +++ b/src/Mod/Fem/feminout/importYamlJsonMesh.py @@ -53,12 +53,7 @@ except ImportError: # names are fix given from FreeCAD, these methods are called from FreeCAD # they are set in FEM modules Init.py -if open.__module__ == "__builtin__": - # because we'll redefine open below (Python2) - pyopen = open -elif open.__module__ == "io": - # because we'll redefine open below (Python3) - pyopen = open +pyopen = open def open( diff --git a/src/Mod/Fem/feminout/importZ88Mesh.py b/src/Mod/Fem/feminout/importZ88Mesh.py index eb184b3159..0615d89c24 100644 --- a/src/Mod/Fem/feminout/importZ88Mesh.py +++ b/src/Mod/Fem/feminout/importZ88Mesh.py @@ -41,12 +41,7 @@ from femmesh import meshtools # names are fix given from FreeCAD, these methods are called from FreeCAD # they are set in FEM modules Init.py -if open.__module__ == "__builtin__": - # because we'll redefine open below (Python2) - pyopen = open -elif open.__module__ == "io": - # because we'll redefine open below (Python3) - pyopen = open +pyopen = open def open( diff --git a/src/Mod/Fem/feminout/importZ88O2Results.py b/src/Mod/Fem/feminout/importZ88O2Results.py index 566eb3989e..e673571d68 100644 --- a/src/Mod/Fem/feminout/importZ88O2Results.py +++ b/src/Mod/Fem/feminout/importZ88O2Results.py @@ -36,12 +36,7 @@ from FreeCAD import Console # ********* generic FreeCAD import and export methods ********* -if open.__module__ == "__builtin__": - # because we'll redefine open below (Python2) - pyopen = open -elif open.__module__ == "io": - # because we'll redefine open below (Python3) - pyopen = open +pyopen = open def open( diff --git a/src/Mod/Path/Path/Base/Generator/threadmilling.py b/src/Mod/Path/Path/Base/Generator/threadmilling.py index 2fb0e7bd87..6d5043efb1 100644 --- a/src/Mod/Path/Path/Base/Generator/threadmilling.py +++ b/src/Mod/Path/Path/Base/Generator/threadmilling.py @@ -20,8 +20,6 @@ # * * # *************************************************************************** -from __future__ import print_function - import FreeCAD import Path import math diff --git a/src/Mod/Path/Path/Dressup/Gui/Dogbone.py b/src/Mod/Path/Path/Dressup/Gui/Dogbone.py index 379949faa9..71845f64c5 100644 --- a/src/Mod/Path/Path/Dressup/Gui/Dogbone.py +++ b/src/Mod/Path/Path/Dressup/Gui/Dogbone.py @@ -20,7 +20,6 @@ # * * # *************************************************************************** -from __future__ import print_function from PySide import QtCore from PySide.QtCore import QT_TRANSLATE_NOOP diff --git a/src/Mod/Path/Path/Dressup/Gui/Dragknife.py b/src/Mod/Path/Path/Dressup/Gui/Dragknife.py index 56f36b8790..a807748e24 100644 --- a/src/Mod/Path/Path/Dressup/Gui/Dragknife.py +++ b/src/Mod/Path/Path/Dressup/Gui/Dragknife.py @@ -20,7 +20,6 @@ # * * # *************************************************************************** -from __future__ import print_function import FreeCAD import Path import Path.Base.Gui.Util as PathGuiUtil diff --git a/src/Mod/Path/Path/Dressup/Gui/LeadInOut.py b/src/Mod/Path/Path/Dressup/Gui/LeadInOut.py index 9ce7e97fde..db7e5e382f 100644 --- a/src/Mod/Path/Path/Dressup/Gui/LeadInOut.py +++ b/src/Mod/Path/Path/Dressup/Gui/LeadInOut.py @@ -21,7 +21,6 @@ # * * # *************************************************************************** -from __future__ import print_function import FreeCAD import FreeCADGui diff --git a/src/Mod/Path/Path/Main/Gui/Sanity.py b/src/Mod/Path/Path/Main/Gui/Sanity.py index 0ba6da50e4..0dbbf8ae43 100644 --- a/src/Mod/Path/Path/Main/Gui/Sanity.py +++ b/src/Mod/Path/Path/Main/Gui/Sanity.py @@ -28,7 +28,6 @@ Path projects. Ideally, the user could execute these utilities from an icon to make sure tools are selected and configured and defaults have been revised """ -from __future__ import print_function from PySide import QtCore, QtGui import FreeCAD import FreeCADGui diff --git a/src/Mod/Path/Path/Op/Drilling.py b/src/Mod/Path/Path/Op/Drilling.py index 3142efb7c3..9cf906c583 100644 --- a/src/Mod/Path/Path/Op/Drilling.py +++ b/src/Mod/Path/Path/Op/Drilling.py @@ -21,7 +21,6 @@ # * * # *************************************************************************** -from __future__ import print_function import FreeCAD diff --git a/src/Mod/Path/Path/Op/MillFace.py b/src/Mod/Path/Path/Op/MillFace.py index f633492ae5..7a43393072 100644 --- a/src/Mod/Path/Path/Op/MillFace.py +++ b/src/Mod/Path/Path/Op/MillFace.py @@ -20,7 +20,6 @@ # * * # *************************************************************************** -from __future__ import print_function import FreeCAD import Path diff --git a/src/Mod/Path/Path/Op/Probe.py b/src/Mod/Path/Path/Op/Probe.py index 81ed2fdbb5..f650b5e280 100644 --- a/src/Mod/Path/Path/Op/Probe.py +++ b/src/Mod/Path/Path/Op/Probe.py @@ -20,7 +20,6 @@ # * * # *************************************************************************** -from __future__ import print_function import FreeCAD import Path diff --git a/src/Mod/Path/Path/Op/Slot.py b/src/Mod/Path/Path/Op/Slot.py index 124844d610..a29bd5d909 100644 --- a/src/Mod/Path/Path/Op/Slot.py +++ b/src/Mod/Path/Path/Op/Slot.py @@ -21,8 +21,6 @@ # *************************************************************************** -from __future__ import print_function - __title__ = "Path Slot Operation" __author__ = "russ4262 (Russell Johnson)" __url__ = "http://www.freecadweb.org" diff --git a/src/Mod/Path/Path/Op/Surface.py b/src/Mod/Path/Path/Op/Surface.py index 5b179a7064..7691f1d2a1 100644 --- a/src/Mod/Path/Path/Op/Surface.py +++ b/src/Mod/Path/Path/Op/Surface.py @@ -21,8 +21,6 @@ # *************************************************************************** -from __future__ import print_function - __title__ = "Path Surface Operation" __author__ = "sliptonic (Brad Collette)" __url__ = "https://www.freecadweb.org" diff --git a/src/Mod/Path/Path/Op/SurfaceSupport.py b/src/Mod/Path/Path/Op/SurfaceSupport.py index 79e468df61..37f98fc5f6 100644 --- a/src/Mod/Path/Path/Op/SurfaceSupport.py +++ b/src/Mod/Path/Path/Op/SurfaceSupport.py @@ -20,7 +20,6 @@ # * * # *************************************************************************** -from __future__ import print_function __title__ = "Path Surface Support Module" __author__ = "russ4262 (Russell Johnson)" diff --git a/src/Mod/Path/Path/Op/ThreadMilling.py b/src/Mod/Path/Path/Op/ThreadMilling.py index 7be49f75ac..109bdefff8 100644 --- a/src/Mod/Path/Path/Op/ThreadMilling.py +++ b/src/Mod/Path/Path/Op/ThreadMilling.py @@ -20,7 +20,6 @@ # * * # *************************************************************************** -from __future__ import print_function import FreeCAD import Path diff --git a/src/Mod/Path/Path/Op/Waterline.py b/src/Mod/Path/Path/Op/Waterline.py index 73450bc77a..61a943264d 100644 --- a/src/Mod/Path/Path/Op/Waterline.py +++ b/src/Mod/Path/Path/Op/Waterline.py @@ -21,7 +21,6 @@ # * * # *************************************************************************** -from __future__ import print_function import FreeCAD __title__ = "Path Waterline Operation" diff --git a/src/Mod/Path/Path/Post/Command.py b/src/Mod/Path/Path/Post/Command.py index c6a9c80f86..9393e7282f 100644 --- a/src/Mod/Path/Path/Post/Command.py +++ b/src/Mod/Path/Path/Post/Command.py @@ -22,7 +22,6 @@ """Post Process command that will make use of the Output File and Post Processor entries in PathJob """ -from __future__ import print_function import FreeCAD import FreeCADGui diff --git a/src/Mod/Path/Path/Post/scripts/KineticNCBeamicon2_post.py b/src/Mod/Path/Path/Post/scripts/KineticNCBeamicon2_post.py index 1248eaf37b..bde97752fb 100644 --- a/src/Mod/Path/Path/Post/scripts/KineticNCBeamicon2_post.py +++ b/src/Mod/Path/Path/Post/scripts/KineticNCBeamicon2_post.py @@ -31,7 +31,6 @@ # * * # ***************************************************************************/ -from __future__ import print_function import FreeCAD from FreeCAD import Units import Path diff --git a/src/Mod/Path/Path/Post/scripts/centroid_post.py b/src/Mod/Path/Path/Post/scripts/centroid_post.py index b61899da5f..8c26792192 100644 --- a/src/Mod/Path/Path/Post/scripts/centroid_post.py +++ b/src/Mod/Path/Path/Post/scripts/centroid_post.py @@ -23,7 +23,6 @@ # * * # *************************************************************************** -from __future__ import print_function import os import FreeCAD from FreeCAD import Units diff --git a/src/Mod/Path/Path/Post/scripts/dumper_post.py b/src/Mod/Path/Path/Post/scripts/dumper_post.py index 753c367f42..e9865aa9a1 100644 --- a/src/Mod/Path/Path/Post/scripts/dumper_post.py +++ b/src/Mod/Path/Path/Post/scripts/dumper_post.py @@ -21,7 +21,6 @@ # * * # *************************************************************************** -from __future__ import print_function TOOLTIP = """ Dumper is an extremely simple postprocessor file for the Path workbench. It is used diff --git a/src/Mod/Path/Path/Post/scripts/dxf_post.py b/src/Mod/Path/Path/Post/scripts/dxf_post.py index 3b1052ad7f..6f228c55b7 100644 --- a/src/Mod/Path/Path/Post/scripts/dxf_post.py +++ b/src/Mod/Path/Path/Post/scripts/dxf_post.py @@ -20,7 +20,7 @@ # * USA * # * * # ***************************************************************************/ -from __future__ import print_function + import FreeCAD import Part import Path diff --git a/src/Mod/Path/Path/Post/scripts/dynapath_4060_post.py b/src/Mod/Path/Path/Post/scripts/dynapath_4060_post.py index a0de64f569..3595a5453b 100644 --- a/src/Mod/Path/Path/Post/scripts/dynapath_4060_post.py +++ b/src/Mod/Path/Path/Post/scripts/dynapath_4060_post.py @@ -25,7 +25,6 @@ # * and modifications (c) luvtofish (luvtofish@gmail.com) 2022 * # *************************************************************************** -from __future__ import print_function import FreeCAD from FreeCAD import Units import Path diff --git a/src/Mod/Path/Path/Post/scripts/dynapath_post.py b/src/Mod/Path/Path/Post/scripts/dynapath_post.py index 5f1798d50a..06ef144d4d 100644 --- a/src/Mod/Path/Path/Post/scripts/dynapath_post.py +++ b/src/Mod/Path/Path/Post/scripts/dynapath_post.py @@ -30,7 +30,7 @@ # * * # *************************************************************************** -from __future__ import print_function + import FreeCAD from FreeCAD import Units import Path.Post.Utils as PostUtils diff --git a/src/Mod/Path/Path/Post/scripts/example_post.py b/src/Mod/Path/Path/Post/scripts/example_post.py index 0d4ea51423..19b001ee9e 100644 --- a/src/Mod/Path/Path/Post/scripts/example_post.py +++ b/src/Mod/Path/Path/Post/scripts/example_post.py @@ -21,7 +21,6 @@ # * * # *************************************************************************** -from __future__ import print_function TOOLTIP = """ This is an example postprocessor file for the Path workbench. It is used diff --git a/src/Mod/Path/Path/Post/scripts/fanuc_post.py b/src/Mod/Path/Path/Post/scripts/fanuc_post.py index afb7b8244f..2199a83888 100644 --- a/src/Mod/Path/Path/Post/scripts/fanuc_post.py +++ b/src/Mod/Path/Path/Post/scripts/fanuc_post.py @@ -21,7 +21,7 @@ # * USA * # * * # ***************************************************************************/ -from __future__ import print_function + import FreeCAD from FreeCAD import Units import Path diff --git a/src/Mod/Path/Path/Post/scripts/jtech_post.py b/src/Mod/Path/Path/Post/scripts/jtech_post.py index 36e5b1d498..4c95e8f50b 100644 --- a/src/Mod/Path/Path/Post/scripts/jtech_post.py +++ b/src/Mod/Path/Path/Post/scripts/jtech_post.py @@ -21,7 +21,6 @@ # * * # *************************************************************************** -from __future__ import print_function import FreeCAD from FreeCAD import Units import Path diff --git a/src/Mod/Path/Path/Post/scripts/linuxcnc_post.py b/src/Mod/Path/Path/Post/scripts/linuxcnc_post.py index d21eba1bad..534a09b830 100644 --- a/src/Mod/Path/Path/Post/scripts/linuxcnc_post.py +++ b/src/Mod/Path/Path/Post/scripts/linuxcnc_post.py @@ -21,7 +21,6 @@ # * * # *************************************************************************** -from __future__ import print_function import FreeCAD from FreeCAD import Units import Path diff --git a/src/Mod/Path/Path/Post/scripts/mach3_mach4_post.py b/src/Mod/Path/Path/Post/scripts/mach3_mach4_post.py index d4cb8ecb66..cf0b32fa38 100644 --- a/src/Mod/Path/Path/Post/scripts/mach3_mach4_post.py +++ b/src/Mod/Path/Path/Post/scripts/mach3_mach4_post.py @@ -20,7 +20,7 @@ # * USA * # * * # ***************************************************************************/ -from __future__ import print_function + import FreeCAD from FreeCAD import Units import Path diff --git a/src/Mod/Path/Path/Post/scripts/opensbp_post.py b/src/Mod/Path/Path/Post/scripts/opensbp_post.py index 3d2e2af199..caf2477dc2 100644 --- a/src/Mod/Path/Path/Post/scripts/opensbp_post.py +++ b/src/Mod/Path/Path/Post/scripts/opensbp_post.py @@ -21,7 +21,6 @@ # * * # *************************************************************************** -from __future__ import print_function import datetime import Path.Post.Utils as PostUtils diff --git a/src/Mod/Path/Path/Post/scripts/opensbp_pre.py b/src/Mod/Path/Path/Post/scripts/opensbp_pre.py index f0815d9442..a8edf5fda5 100644 --- a/src/Mod/Path/Path/Post/scripts/opensbp_pre.py +++ b/src/Mod/Path/Path/Post/scripts/opensbp_pre.py @@ -47,7 +47,7 @@ TODO Many other OpenSBP commands not handled """ -from __future__ import print_function + import FreeCAD import Path import Path.Base.Util as PathUtil diff --git a/src/Mod/Path/Path/Post/scripts/refactored_centroid_post.py b/src/Mod/Path/Path/Post/scripts/refactored_centroid_post.py index b326bdf13c..ff4cf854d5 100644 --- a/src/Mod/Path/Path/Post/scripts/refactored_centroid_post.py +++ b/src/Mod/Path/Path/Post/scripts/refactored_centroid_post.py @@ -24,7 +24,6 @@ # * * # *************************************************************************** -from __future__ import print_function import Path.Post.UtilsArguments as PostUtilsArguments import Path.Post.UtilsExport as PostUtilsExport diff --git a/src/Mod/Path/Path/Post/scripts/refactored_grbl_post.py b/src/Mod/Path/Path/Post/scripts/refactored_grbl_post.py index 3b7aefda22..50b6489cee 100644 --- a/src/Mod/Path/Path/Post/scripts/refactored_grbl_post.py +++ b/src/Mod/Path/Path/Post/scripts/refactored_grbl_post.py @@ -25,7 +25,6 @@ # * * # *************************************************************************** -from __future__ import print_function import Path.Post.UtilsArguments as PostUtilsArguments import Path.Post.UtilsExport as PostUtilsExport diff --git a/src/Mod/Path/Path/Post/scripts/refactored_linuxcnc_post.py b/src/Mod/Path/Path/Post/scripts/refactored_linuxcnc_post.py index ab7f5ceb3c..32c77ffede 100644 --- a/src/Mod/Path/Path/Post/scripts/refactored_linuxcnc_post.py +++ b/src/Mod/Path/Path/Post/scripts/refactored_linuxcnc_post.py @@ -22,7 +22,6 @@ # * * # *************************************************************************** -from __future__ import print_function import Path.Post.UtilsArguments as PostUtilsArguments import Path.Post.UtilsExport as PostUtilsExport diff --git a/src/Mod/Path/Path/Post/scripts/refactored_mach3_mach4_post.py b/src/Mod/Path/Path/Post/scripts/refactored_mach3_mach4_post.py index 841fe0ac9e..2c1afacca2 100644 --- a/src/Mod/Path/Path/Post/scripts/refactored_mach3_mach4_post.py +++ b/src/Mod/Path/Path/Post/scripts/refactored_mach3_mach4_post.py @@ -21,7 +21,7 @@ # * USA * # * * # ***************************************************************************/ -from __future__ import print_function + import Path.Post.UtilsArguments as PostUtilsArguments import Path.Post.UtilsExport as PostUtilsExport diff --git a/src/Mod/Path/Path/Post/scripts/refactored_test_post.py b/src/Mod/Path/Path/Post/scripts/refactored_test_post.py index 9f91c9ac6a..eb6b2b60e1 100644 --- a/src/Mod/Path/Path/Post/scripts/refactored_test_post.py +++ b/src/Mod/Path/Path/Post/scripts/refactored_test_post.py @@ -22,7 +22,6 @@ # * * # *************************************************************************** -from __future__ import print_function import Path.Post.UtilsArguments as PostUtilsArguments import Path.Post.UtilsExport as PostUtilsExport diff --git a/src/Mod/Path/Path/Post/scripts/smoothie_post.py b/src/Mod/Path/Path/Post/scripts/smoothie_post.py index 0429997475..00fd98cffa 100644 --- a/src/Mod/Path/Path/Post/scripts/smoothie_post.py +++ b/src/Mod/Path/Path/Post/scripts/smoothie_post.py @@ -21,7 +21,6 @@ # * * # *************************************************************************** -from __future__ import print_function import argparse import datetime diff --git a/src/Mod/Path/Path/Post/scripts/uccnc_post.py b/src/Mod/Path/Path/Post/scripts/uccnc_post.py index 3a70425294..3cc2d93484 100644 --- a/src/Mod/Path/Path/Post/scripts/uccnc_post.py +++ b/src/Mod/Path/Path/Post/scripts/uccnc_post.py @@ -29,7 +29,7 @@ # https://wiki.freecadweb.org/Path_Postprocessor_Customization # for details on post processors like this one. -from __future__ import print_function + import FreeCAD from FreeCAD import Units import Path diff --git a/src/Mod/Path/PathPythonGui/simple_edit_panel.py b/src/Mod/Path/PathPythonGui/simple_edit_panel.py index 402415d4dd..0de9345bf3 100644 --- a/src/Mod/Path/PathPythonGui/simple_edit_panel.py +++ b/src/Mod/Path/PathPythonGui/simple_edit_panel.py @@ -1,4 +1,3 @@ -from __future__ import print_function import FreeCAD import FreeCADGui diff --git a/src/Mod/Spreadsheet/importXLSX.py b/src/Mod/Spreadsheet/importXLSX.py index 4d333a91b4..6365bb0dcf 100644 --- a/src/Mod/Spreadsheet/importXLSX.py +++ b/src/Mod/Spreadsheet/importXLSX.py @@ -20,7 +20,6 @@ #* USA * #***************************************************************************/ -from __future__ import print_function __title__ = "FreeCAD Spreadsheet Workbench - XLSX importer" __author__ = "Ulrich Brammer " diff --git a/src/Mod/TechDraw/TDTest/DLeaderRText.py b/src/Mod/TechDraw/TDTest/DLeaderRText.py index 42f17554eb..43f2270827 100644 --- a/src/Mod/TechDraw/TDTest/DLeaderRText.py +++ b/src/Mod/TechDraw/TDTest/DLeaderRText.py @@ -5,7 +5,7 @@ # creates a page and a view # adds 1 leader to view1 # adds 1 RTA to leader1 -from __future__ import print_function + import FreeCAD import os diff --git a/src/Mod/TechDraw/TDTest/DrawHatchTest.py b/src/Mod/TechDraw/TDTest/DrawHatchTest.py index 9346d62b2d..801bef2686 100644 --- a/src/Mod/TechDraw/TDTest/DrawHatchTest.py +++ b/src/Mod/TechDraw/TDTest/DrawHatchTest.py @@ -1,7 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -from __future__ import print_function import FreeCAD import os diff --git a/src/Mod/TechDraw/TDTest/DrawViewAnnotationTest.py b/src/Mod/TechDraw/TDTest/DrawViewAnnotationTest.py index 7c3d1df957..06e7a48aa5 100644 --- a/src/Mod/TechDraw/TDTest/DrawViewAnnotationTest.py +++ b/src/Mod/TechDraw/TDTest/DrawViewAnnotationTest.py @@ -1,4 +1,4 @@ -from __future__ import print_function + import FreeCAD import unittest diff --git a/src/Mod/TechDraw/TDTest/DrawViewDetailTest.py b/src/Mod/TechDraw/TDTest/DrawViewDetailTest.py index 81a6c654f6..d038101722 100644 --- a/src/Mod/TechDraw/TDTest/DrawViewDetailTest.py +++ b/src/Mod/TechDraw/TDTest/DrawViewDetailTest.py @@ -3,7 +3,7 @@ # test script for DrawViewDetail # creates a page, a view and a detail view -from __future__ import print_function + import FreeCAD import unittest diff --git a/src/Mod/TechDraw/TDTest/DrawViewImageTest.py b/src/Mod/TechDraw/TDTest/DrawViewImageTest.py index a82166a49b..51fceb94c2 100644 --- a/src/Mod/TechDraw/TDTest/DrawViewImageTest.py +++ b/src/Mod/TechDraw/TDTest/DrawViewImageTest.py @@ -1,4 +1,4 @@ -from __future__ import print_function + import FreeCAD import os diff --git a/src/Mod/TechDraw/TDTest/DrawViewPartTest.py b/src/Mod/TechDraw/TDTest/DrawViewPartTest.py index 07bc482750..a7fbcd9a14 100644 --- a/src/Mod/TechDraw/TDTest/DrawViewPartTest.py +++ b/src/Mod/TechDraw/TDTest/DrawViewPartTest.py @@ -3,7 +3,7 @@ # basic test script for TechDraw module # creates a page and 1 view -from __future__ import print_function + import FreeCAD import unittest diff --git a/src/Mod/TechDraw/TDTest/DrawViewSymbolTest.py b/src/Mod/TechDraw/TDTest/DrawViewSymbolTest.py index ed172f1273..c5590bd43a 100644 --- a/src/Mod/TechDraw/TDTest/DrawViewSymbolTest.py +++ b/src/Mod/TechDraw/TDTest/DrawViewSymbolTest.py @@ -1,4 +1,3 @@ -from __future__ import print_function import FreeCAD import os diff --git a/src/Mod/TechDraw/TDTest/TDPyTest.py b/src/Mod/TechDraw/TDTest/TDPyTest.py index f9b8170e11..c1857512e9 100644 --- a/src/Mod/TechDraw/TDTest/TDPyTest.py +++ b/src/Mod/TechDraw/TDTest/TDPyTest.py @@ -3,7 +3,6 @@ # basic test script for TechDraw Py functions migrated from Drawing -from __future__ import print_function import FreeCAD import Part diff --git a/src/Mod/TechDraw/TDTest/TechDrawTestUtilities.py b/src/Mod/TechDraw/TDTest/TechDrawTestUtilities.py index 41fa866faa..ec9ba48f26 100644 --- a/src/Mod/TechDraw/TDTest/TechDrawTestUtilities.py +++ b/src/Mod/TechDraw/TDTest/TechDrawTestUtilities.py @@ -1,4 +1,3 @@ -from __future__ import print_function import FreeCAD import os diff --git a/src/Mod/Test/TestPythonSyntax.py b/src/Mod/Test/TestPythonSyntax.py index 63f4a4234b..1f9b25dc18 100644 --- a/src/Mod/Test/TestPythonSyntax.py +++ b/src/Mod/Test/TestPythonSyntax.py @@ -59,8 +59,6 @@ class PythonSyntaxTestCase(unittest.TestCase): self.whitelist += ["automotive_design.py"] self.whitelist += ["ifc2x3.py"] self.whitelist += ["ifc4.py"] - self.whitelist += ["__exec_old.py"] - def testAll(self): mod_dir = os.path.join(App.getHomePath(), "Mod") diff --git a/src/Tools/MakeMacBundleRelocatable.py b/src/Tools/MakeMacBundleRelocatable.py index 6610021189..37eb987e79 100755 --- a/src/Tools/MakeMacBundleRelocatable.py +++ b/src/Tools/MakeMacBundleRelocatable.py @@ -361,9 +361,7 @@ def main(): path = sys.argv[1] bundle_path = os.path.abspath(os.path.join(path, "Contents")) graph = DepsGraph() - dir_filter = ["MacOS", "lib", "Mod", - "lib/python2.7/site-packages", - "lib/python2.7/lib-dynload"] + dir_filter = ["MacOS", "lib", "Mod"] search_paths = [bundle_path + "/lib"] + sys.argv[2:] #change to level to logging.DEBUG for diagnostic messages diff --git a/src/Tools/generateBase/__exec_new.py b/src/Tools/generateBase/__exec_new.py deleted file mode 100644 index d6c23670d1..0000000000 --- a/src/Tools/generateBase/__exec_new.py +++ /dev/null @@ -1,4 +0,0 @@ -# remove this once python2 support has stopped - -def __exec_new__(text, globals, locals): - exec(text, globals, locals) \ No newline at end of file diff --git a/src/Tools/generateBase/__exec_old.py b/src/Tools/generateBase/__exec_old.py deleted file mode 100644 index 8e7bd1df12..0000000000 --- a/src/Tools/generateBase/__exec_old.py +++ /dev/null @@ -1,5 +0,0 @@ -# remove this file once the python2 support has stopped - - -def __exec_old__(text, globals, locals): - exec text in globals, locals # noqa: E999 a Python 3 syntax error diff --git a/src/Tools/generateBase/generateDS.py b/src/Tools/generateBase/generateDS.py index 8c2559bd16..29c4b67fe5 100644 --- a/src/Tools/generateBase/generateDS.py +++ b/src/Tools/generateBase/generateDS.py @@ -2386,7 +2386,6 @@ TEMPLATE_HEADER = """\ # WARNING! All changes made in this file will be lost! # -from __future__ import print_function # this allows py2 to print(str1,str2) correctly import sys import getopt diff --git a/src/Tools/generateBase/generateModel_Module.py b/src/Tools/generateBase/generateModel_Module.py index 8f21a3391f..1c16c344fb 100644 --- a/src/Tools/generateBase/generateModel_Module.py +++ b/src/Tools/generateBase/generateModel_Module.py @@ -7,7 +7,6 @@ # WARNING! All changes made in this file will be lost! # -from __future__ import print_function # this allows py2 to print(str1,str2) correctly import sys import getopt diff --git a/src/Tools/generateBase/generateTools.py b/src/Tools/generateBase/generateTools.py index 29955d0169..2f4b7b5433 100644 --- a/src/Tools/generateBase/generateTools.py +++ b/src/Tools/generateBase/generateTools.py @@ -2,25 +2,9 @@ # -*- coding: utf-8 -*- # (c) 2007 Jürgen Riegel -from __future__ import print_function # this allows py2 to print(str1,str2) correctly - import os -def temporary_exec(text, globals, locals): - """this function is a dirty hack to allow using the copier from - python2 and python3. Once the support of python2 has stopped - feel free to remove this function and use the std exec function - instead""" - # maybe this should be fixed by rewriting the generators. - if sys.version_info[0] < 3: - from .__exec_old import __exec_old__ - __exec_old__(text, globals, locals) - else: - from .__exec_new import __exec_new__ - __exec_new__(text, globals, locals) - - def ensureDir(path,mode=0o777): try: os.makedirs(path,mode) @@ -92,7 +76,7 @@ class copier: stat = self.preproc(stat, 'exec') stat = '%s _cb(%s,%s)' % (stat,i+1,j) # for debugging, uncomment...: print("-> Executing: {"+stat+"}") - temporary_exec(stat, self.globals, self.locals) + exec(stat, self.globals, self.locals) i=j+1 else: # normal line, just copy with substitution try: diff --git a/src/Tools/generateTemplates/templateClassPyExport.py b/src/Tools/generateTemplates/templateClassPyExport.py index 8b08d30c2a..810cfa75e2 100644 --- a/src/Tools/generateTemplates/templateClassPyExport.py +++ b/src/Tools/generateTemplates/templateClassPyExport.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # (c) 2006 Juergen Riegel -from __future__ import print_function # this allows py2 to print(str1,str2) correctly + from . import template import os,sys import generateBase.generateModel_Module @@ -14,14 +14,8 @@ class TemplateClassPyExport (template.ModelTemplate): #self.Namespace = "Base" encoding = sys.getfilesystemencoding() path = self.path - if hasattr(path,"decode"): # this is python2. Otherwise this is unicode already - path = path.decode(encoding) exportName = self.export.Name - if hasattr(exportName,"decode"): # this is python2. Otherwise this is unicode already - exportName = exportName.decode(encoding) dirname = self.dirname - if hasattr(dirname,"decode"): # this is python2. Otherwise this is unicode already - dirname = dirname.decode(encoding) print("TemplateClassPyExport",path + exportName) # Imp.cpp must not exist, neither in path nor in dirname if(not os.path.exists(path + exportName + "Imp.cpp")): diff --git a/src/Tools/updatets.py b/src/Tools/updatets.py index 796b7e2a61..c6d486dc06 100755 --- a/src/Tools/updatets.py +++ b/src/Tools/updatets.py @@ -35,7 +35,6 @@ # Add "no obsolete" flags in order to fix 'ghost strings' in Crowdin # 0.1 Initial Release -from __future__ import print_function Usage = """updatets - update all .ts files found in the source directories