remove Python2 code
This commit is contained in:
-1
@@ -17,7 +17,6 @@
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
|
||||
import importlib
|
||||
import types
|
||||
|
||||
@@ -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__
|
||||
|
||||
@@ -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<PythonDebuggerPy*>(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)) {
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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(
|
||||
"<h1>"
|
||||
+ translate("AddonsInstaller", "WARNING: This addon is Python 2 Only")
|
||||
+ "</h1>"
|
||||
)
|
||||
self.ui.labelWarningInfo.setStyleSheet(
|
||||
"color:" + utils.warning_color_string()
|
||||
)
|
||||
elif required_version:
|
||||
self.ui.labelWarningInfo.show()
|
||||
self.ui.labelWarningInfo.setText(
|
||||
|
||||
@@ -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 (
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#***************************************************************************
|
||||
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import FreeCAD, Part, DraftGeomUtils, WorkingPlane, DraftVecUtils, math
|
||||
from datetime import datetime
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#* *
|
||||
#***************************************************************************
|
||||
|
||||
from __future__ import print_function
|
||||
import FreeCAD
|
||||
if FreeCAD.GuiUp:
|
||||
import FreeCADGui
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
__title__ = "FreeCAD structural IFC export tools"
|
||||
__author__ = "Yorik van Havre"
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#* *
|
||||
#***************************************************************************
|
||||
|
||||
from __future__ import print_function
|
||||
import os,FreeCAD,Mesh
|
||||
|
||||
__title__ = "FreeCAD 3DS importer"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -20,8 +20,6 @@
|
||||
# ***************************************************************************
|
||||
"""FreeCAD IFC importer - Multicore version"""
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import sys
|
||||
import time
|
||||
import os
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#* *
|
||||
#***************************************************************************
|
||||
|
||||
from __future__ import print_function
|
||||
__title__ = "FreeCAD SweetHome3D Importer"
|
||||
__author__ = "Yorik van Havre"
|
||||
__url__ = "https://www.freecadweb.org"
|
||||
|
||||
@@ -20,8 +20,6 @@
|
||||
#* *
|
||||
#***************************************************************************
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import FreeCAD
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -20,8 +20,6 @@
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import FreeCAD
|
||||
import Path
|
||||
import math
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
from PySide import QtCore
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
from __future__ import print_function
|
||||
import FreeCAD
|
||||
import Path
|
||||
import Path.Base.Gui.Util as PathGuiUtil
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
import FreeCAD
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import FreeCAD
|
||||
import Path
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import FreeCAD
|
||||
import Path
|
||||
|
||||
@@ -21,8 +21,6 @@
|
||||
# ***************************************************************************
|
||||
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
__title__ = "Path Slot Operation"
|
||||
__author__ = "russ4262 (Russell Johnson)"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
@@ -21,8 +21,6 @@
|
||||
# ***************************************************************************
|
||||
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
__title__ = "Path Surface Operation"
|
||||
__author__ = "sliptonic (Brad Collette)"
|
||||
__url__ = "https://www.freecadweb.org"
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
__title__ = "Path Surface Support Module"
|
||||
__author__ = "russ4262 (Russell Johnson)"
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import FreeCAD
|
||||
import Path
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
from __future__ import print_function
|
||||
import FreeCAD
|
||||
|
||||
__title__ = "Path Waterline Operation"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
# * *
|
||||
# ***************************************************************************/
|
||||
|
||||
from __future__ import print_function
|
||||
import FreeCAD
|
||||
from FreeCAD import Units
|
||||
import Path
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
from __future__ import print_function
|
||||
import os
|
||||
import FreeCAD
|
||||
from FreeCAD import Units
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
TOOLTIP = """
|
||||
Dumper is an extremely simple postprocessor file for the Path workbench. It is used
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************/
|
||||
from __future__ import print_function
|
||||
|
||||
import FreeCAD
|
||||
import Part
|
||||
import Path
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
# * and modifications (c) luvtofish ([email protected]) 2022 *
|
||||
# ***************************************************************************
|
||||
|
||||
from __future__ import print_function
|
||||
import FreeCAD
|
||||
from FreeCAD import Units
|
||||
import Path
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import FreeCAD
|
||||
from FreeCAD import Units
|
||||
import Path.Post.Utils as PostUtils
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
TOOLTIP = """
|
||||
This is an example postprocessor file for the Path workbench. It is used
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************/
|
||||
from __future__ import print_function
|
||||
|
||||
import FreeCAD
|
||||
from FreeCAD import Units
|
||||
import Path
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
from __future__ import print_function
|
||||
import FreeCAD
|
||||
from FreeCAD import Units
|
||||
import Path
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
from __future__ import print_function
|
||||
import FreeCAD
|
||||
from FreeCAD import Units
|
||||
import Path
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************/
|
||||
from __future__ import print_function
|
||||
|
||||
import FreeCAD
|
||||
from FreeCAD import Units
|
||||
import Path
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
from __future__ import print_function
|
||||
import datetime
|
||||
import Path.Post.Utils as PostUtils
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import Path.Post.UtilsArguments as PostUtilsArguments
|
||||
import Path.Post.UtilsExport as PostUtilsExport
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import Path.Post.UtilsArguments as PostUtilsArguments
|
||||
import Path.Post.UtilsExport as PostUtilsExport
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import Path.Post.UtilsArguments as PostUtilsArguments
|
||||
import Path.Post.UtilsExport as PostUtilsExport
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************/
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
import Path.Post.UtilsArguments as PostUtilsArguments
|
||||
import Path.Post.UtilsExport as PostUtilsExport
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import Path.Post.UtilsArguments as PostUtilsArguments
|
||||
import Path.Post.UtilsExport as PostUtilsExport
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
import datetime
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
from __future__ import print_function
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#* USA *
|
||||
#***************************************************************************/
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
__title__ = "FreeCAD Spreadsheet Workbench - XLSX importer"
|
||||
__author__ = "Ulrich Brammer <[email protected]>"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import FreeCAD
|
||||
import os
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
import FreeCAD
|
||||
import unittest
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
import FreeCAD
|
||||
import os
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
from __future__ import print_function
|
||||
|
||||
import FreeCAD
|
||||
import os
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
# basic test script for TechDraw Py functions migrated from Drawing
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import FreeCAD
|
||||
import Part
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
from __future__ import print_function
|
||||
import FreeCAD
|
||||
import os
|
||||
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
# remove this once python2 support has stopped
|
||||
|
||||
def __exec_new__(text, globals, locals):
|
||||
exec(text, globals, locals)
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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")):
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user