Control: tags 953721 + patch
Control: tags 953721 + pending

Dear maintainer,

I've prepared an NMU for freecad (versioned as 0.18.4+dfsg2-1.1) and
uploaded it to DELAYED/2. Please feel free to tell me if I
should delay it longer.

Regards.

diff -Nru freecad-0.18.4+dfsg2/debian/changelog freecad-0.18.4+dfsg2/debian/changelog
--- freecad-0.18.4+dfsg2/debian/changelog	2020-02-11 13:26:08.000000000 +0100
+++ freecad-0.18.4+dfsg2/debian/changelog	2020-04-11 13:11:52.000000000 +0200
@@ -1,3 +1,12 @@
+freecad (0.18.4+dfsg2-1.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Import Ubuntu patches to fix FTBFS with Python 3.8. (Closes: 953721).
+    This also includes some other patches from Ubuntu that are worth as
+    they are fixing crashes. Thanks to Gianfranco for his work in Ubuntu.
+
+ -- Tobias Frost <t...@debian.org>  Sat, 11 Apr 2020 13:11:52 +0200
+
 freecad (0.18.4+dfsg2-1) unstable; urgency=medium
 
   * [e8be3d7] New upstream version 0.18.4+dfsg2
diff -Nru freecad-0.18.4+dfsg2/debian/patches/FreeCAD-0-18.patch freecad-0.18.4+dfsg2/debian/patches/FreeCAD-0-18.patch
--- freecad-0.18.4+dfsg2/debian/patches/FreeCAD-0-18.patch	1970-01-01 01:00:00.000000000 +0100
+++ freecad-0.18.4+dfsg2/debian/patches/FreeCAD-0-18.patch	2020-02-11 12:51:07.000000000 +0100
@@ -0,0 +1,521 @@
+From 44f6e86d19b0850b9ac90453795ea3cfed0d2ac5 Mon Sep 17 00:00:00 2001
+From: Syres916 <46537884+syres...@users.noreply.github.com>
+Date: Mon, 4 Nov 2019 09:40:31 +0000
+Subject: [PATCH 01/10] [Arch] ArchMaterial 0.18 Fix Crash
+
+As per discussion  https://forum.freecadweb.org/viewtopic.php?t=36806
+---
+ src/Mod/Arch/ArchMaterial.py | 21 +++++++++++++++++----
+ 1 file changed, 17 insertions(+), 4 deletions(-)
+
+Index: freecad-0.18.4+dfsg1/src/Mod/Arch/ArchMaterial.py
+===================================================================
+--- freecad-0.18.4+dfsg1.orig/src/Mod/Arch/ArchMaterial.py
++++ freecad-0.18.4+dfsg1/src/Mod/Arch/ArchMaterial.py
+@@ -259,6 +259,15 @@
+         obj.addProperty("App::PropertyPercent","Transparency","Arch",QT_TRANSLATE_NOOP("App::Property","The transparency value of this material"))
+         obj.addProperty("App::PropertyColor","Color","Arch",QT_TRANSLATE_NOOP("App::Property","The color of this material"))
+ 
++    def isSameColor(self,c1,c2):
++
++        r = 4
++        if round(c1[0],r) == round(c2[0],r):
++            if round(c1[1],r) == round(c2[1],r):
++                if round(c1[2],r) == round(c2[2],r):
++                    return True
++        return False
++
+     def onChanged(self,obj,prop):
+ 
+         d = obj.Material
+@@ -266,7 +275,7 @@
+             if "DiffuseColor" in obj.Material:
+                 c = tuple([float(f) for f in obj.Material['DiffuseColor'].strip("()").split(",")])
+                 if hasattr(obj,"Color"):
+-                    if obj.Color != c:
++                    if not self.isSameColor(obj.Color,c):
+                         obj.Color = c
+             if "Transparency" in obj.Material:
+                 t = int(obj.Material['Transparency'])
+@@ -296,11 +305,10 @@
+             d["Name"] = obj.Label
+         elif prop == "Color":
+             if hasattr(obj,"Color"):
+-                val = str(obj.Color[:3])
+                 if "DiffuseColor" in d:
+-                    if d["DiffuseColor"] == val:
++                    if self.isSameColor(tuple([float(f) for f in d['DiffuseColor'].strip("()").split(",")]),obj.Color[:3]):
+                         return
+-                d["DiffuseColor"] = val
++                d["DiffuseColor"] = str(obj.Color[:3])
+         elif prop == "Transparency":
+             if hasattr(obj,"Transparency"):
+                 val = str(obj.Transparency)
+@@ -516,6 +524,11 @@
+         FreeCADGui.ActiveDocument.resetEdit()
+         FreeCADGui.Control.closeDialog()
+         FreeCAD.ActiveDocument.recompute()
++
++    def reject(self):
++        FreeCADGui.ActiveDocument.resetEdit()
++        FreeCADGui.Control.closeDialog()
++        FreeCAD.ActiveDocument.recompute()
+ 
+     def chooseMat(self, card):
+         "sets self.material from a card"
+Index: freecad-0.18.4+dfsg1/src/Mod/Web/Gui/BrowserView.cpp
+===================================================================
+--- freecad-0.18.4+dfsg1.orig/src/Mod/Web/Gui/BrowserView.cpp
++++ freecad-0.18.4+dfsg1/src/Mod/Web/Gui/BrowserView.cpp
+@@ -126,7 +126,7 @@
+     PyMem_Free(HtmlCode);
+ 
+     if (myWebView)
+-        myWebView->setHtml(QString::fromUtf8(EncodedHtml.c_str()), QUrl(QString::fromLatin1(BaseUrl)));
++        myWebView->setHtml(QString::fromUtf8(EncodedHtml.c_str()), QUrl(QString::fromUtf8(BaseUrl)));
+     return Py::None();
+ }
+ }
+@@ -327,7 +327,12 @@
+                         Gui::Command::doCommand(Gui::Command::Gui,q.toStdString().c_str());
+                     }
+                     // Gui::Command::doCommand(Gui::Command::Gui,"execfile('%s')",(const char*) fi.absoluteFilePath().	toLocal8Bit());
+-                    Gui::Command::doCommand(Gui::Command::Gui,"exec(open('%s').read())",(const char*) fi.absoluteFilePath()	.toLocal8Bit());
++                    QString filename = fi.absoluteFilePath();
++#if PY_MAJOR_VERSION < 3
++                    Gui::Command::doCommand(Gui::Command::Gui,"exec(open(unicode('%s', 'utf-8')).read())",(const char*) filename.toUtf8());
++#else
++                    Gui::Command::doCommand(Gui::Command::Gui,"exec(open('%s').read())",(const char*) filename.toUtf8());
++#endif
+                 }
+                 catch (const Base::Exception& e) {
+                     QMessageBox::critical(this, tr("Error"), QString::fromUtf8(e.what()));
+Index: freecad-0.18.4+dfsg1/src/Mod/AddonManager/AddonManager.py
+===================================================================
+--- freecad-0.18.4+dfsg1.orig/src/Mod/AddonManager/AddonManager.py
++++ freecad-0.18.4+dfsg1/src/Mod/AddonManager/AddonManager.py
+@@ -298,7 +298,10 @@
+         if oktoclose:
+             if hasattr(self,"install_worker"):
+                 QtGui.QMessageBox.information(self, translate("AddonsInstaller","Addon manager"), translate("AddonsInstaller","Please restart FreeCAD for changes to take effect."))
+-            shutil.rmtree(self.macro_repo_dir,onerror=self.remove_readonly)
++            try:
++                shutil.rmtree(self.macro_repo_dir,onerror=self.remove_readonly)
++            except:
++                FreeCAD.Console.PrintMessage(translate("AddonsInstaller", 'AddonManager - Macros, there was nothing to clean up'))
+             QtGui.QDialog.reject(self)
+ 
+     def retranslateUi(self):
+@@ -719,16 +722,20 @@
+             return
+ 
+         self.info_label_signal.emit('Downloading list of macros for git...')
+-        git.Repo.clone_from('https://github.com/FreeCAD/FreeCAD-macros.git', self.repo_dir)
+-        for dirpath, _, filenames in os.walk(self.repo_dir):
+-             if '.git' in dirpath:
+-                 continue
+-             for filename in filenames:
+-                 if filename.lower().endswith('.fcmacro'):
+-                    macro = Macro(filename[:-8])  # Remove ".FCMacro".
+-                    macro.on_git = True
+-                    macro.src_filename = os.path.join(dirpath, filename)
+-                    self.macros.append(macro)
++        try:
++            git.Repo.clone_from('https://github.com/FreeCAD/FreeCAD-macros.git', self.repo_dir)
++            for dirpath, _, filenames in os.walk(self.repo_dir):
++                if '.git' in dirpath:
++                    continue
++                for filename in filenames:
++                    if filename.lower().endswith('.fcmacro'):
++                        macro = Macro(filename[:-8])  # Remove ".FCMacro".
++                        macro.on_git = True
++                        macro.src_filename = os.path.join(dirpath, filename)
++                        self.macros.append(macro)
++        except:
++            FreeCAD.Console.PrintWarning(translate('AddonsInstaller', 'Something went wrong with the Git Macro Retieval, possibly the Git executable is not in the path')+"\n")
++
+ 
+     def retrieve_macros_from_wiki(self):
+         """Retrieve macros from the wiki
+Index: freecad-0.18.4+dfsg1/src/Mod/Fem/femsolver/elmer/equations/equation.py
+===================================================================
+--- freecad-0.18.4+dfsg1.orig/src/Mod/Fem/femsolver/elmer/equations/equation.py
++++ freecad-0.18.4+dfsg1/src/Mod/Fem/femsolver/elmer/equations/equation.py
+@@ -89,14 +89,13 @@
+             self._part.ViewObject.show()
+ 
+     def reject(self):
+-        self._restoreVisibility()
++        self._recomputeAndRestore()
+         return True
+ 
+     def accept(self):
+         if self._obj.References != self._refWidget.references():
+             self._obj.References = self._refWidget.references()
+-        self._obj.Document.recompute()
+-        self._restoreVisibility()
++        self._recomputeAndRestore()
+         return True
+ 
+     def _restoreVisibility(self):
+@@ -110,4 +109,13 @@
+             else:
+                 self._part.ViewObject.hide()
+ 
++    def _recomputeAndRestore(self):
++        doc = Gui.getDocument(self._obj.Document)
++        doc.Document.recompute()
++        self._restoreVisibility()
++        # TODO: test if there is an active selection observer
++        # if yes Gui.Selection.removeObserver is your friend
++        doc.resetEdit()
++
++
+ ##  @}
+Index: freecad-0.18.4+dfsg1/src/Mod/Fem/femguiobjects/FemSelectionWidgets.py
+===================================================================
+--- freecad-0.18.4+dfsg1.orig/src/Mod/Fem/femguiobjects/FemSelectionWidgets.py
++++ freecad-0.18.4+dfsg1/src/Mod/Fem/femguiobjects/FemSelectionWidgets.py
+@@ -29,6 +29,8 @@
+ #  \ingroup FEM
+ #  \brief FreeCAD FEM FemSelectWidget
+ 
++import sys
++
+ import FreeCAD
+ import FreeCADGui
+ import femmesh.meshtools as FemMeshTools
+@@ -160,10 +162,19 @@
+             if solids:
+                 item = (selObj.Object, tuple(solids))
+                 selection.append(item)
++        if len(selection) == 0:
++            FreeCAD.Console.PrintMessage(
++                "Object with no Shape selected or nothing selected at all.\n"
++            )
+         return selection
+ 
+     def _getObjects(self, obj, names):
+         objects = []
++        if not hasattr(obj, "Shape"):
++            FreeCAD.Console.PrintMessage(
++                "Selected object has no Shape.\n"
++            )
++            return objects
+         shape = obj.Shape
+         for n in names:
+             if n.startswith("Face"):
+@@ -195,7 +206,11 @@
+                 if(self._findSub(sub, solid.Vertexes)):
+                     foundSolids.add("Solid" + str(solidId + 1))
+         if len(foundSolids) == 1:
+-            return iter(foundSolids).next()
++            it = iter(foundSolids)
++            if sys.version_info.major >= 3:
++                return next(it)
++            else:
++                return it.next()
+         return None
+ 
+     def _findSub(self, sub, subList):
+Index: freecad-0.18.4+dfsg1/src/Mod/PartDesign/Gui/CommandBody.cpp
+===================================================================
+--- freecad-0.18.4+dfsg1.orig/src/Mod/PartDesign/Gui/CommandBody.cpp
++++ freecad-0.18.4+dfsg1/src/Mod/PartDesign/Gui/CommandBody.cpp
+@@ -643,9 +643,11 @@
+ 
+     std::vector<App::DocumentObject*> beforeFeatures = getDocument()->getObjects();
+ 
+-    openCommand("Duplicate a PartDesign object");
+     doCommand(Doc,"FreeCADGui.runCommand('Std_DuplicateSelection')");
+ 
++    // This transaction must be opened after using the core duplication function.
++    // See https://forum.freecadweb.org/viewtopic.php?f=19&t=41918&p=355939#p355939
++    openCommand("Duplicate a PartDesign object");
+     if (pcActiveBody) {
+         // Find the features that were added
+         std::vector<App::DocumentObject*> afterFeatures = getDocument()->getObjects();
+Index: freecad-0.18.4+dfsg1/src/Mod/Draft/importDXF.py
+===================================================================
+--- freecad-0.18.4+dfsg1.orig/src/Mod/Draft/importDXF.py
++++ freecad-0.18.4+dfsg1/src/Mod/Draft/importDXF.py
+@@ -135,7 +135,10 @@
+         global dxfLibrary,dxfColorMap,dxfReader
+         import dxfLibrary
+         import dxfColorMap
+-        import dxfReader
++        try:
++            import dxfReader
++        except:
++            libsok = False
+     except ImportError:
+         libsok = False
+         FreeCAD.Console.PrintWarning("DXF libraries not found. Trying to download...\n")
+Index: freecad-0.18.4+dfsg1/src/Mod/Sketcher/Gui/EditDatumDialog.cpp
+===================================================================
+--- freecad-0.18.4+dfsg1.orig/src/Mod/Sketcher/Gui/EditDatumDialog.cpp
++++ freecad-0.18.4+dfsg1/src/Mod/Sketcher/Gui/EditDatumDialog.cpp
+@@ -82,9 +82,7 @@
+         }
+ 
+         Gui::MDIView *mdi = Gui::Application::Instance->activeDocument()->getActiveView();
+-        Gui::View3DInventorViewer *viewer = static_cast<Gui::View3DInventor *>(mdi)->getViewer();
+-
+-        QDialog dlg(viewer->getGLWidget());
++        QDialog dlg(mdi);
+ 
+         Ui::InsertDatum ui_ins_datum;
+         ui_ins_datum.setupUi(&dlg);
+Index: freecad-0.18.4+dfsg1/src/3rdParty/salomesmesh/inc/Rn.h
+===================================================================
+--- freecad-0.18.4+dfsg1.orig/src/3rdParty/salomesmesh/inc/Rn.h
++++ freecad-0.18.4+dfsg1/src/3rdParty/salomesmesh/inc/Rn.h
+@@ -180,12 +180,12 @@
+ {
+   friend std::ostream& operator <<(std::ostream& f, const R_4 & P )
+   { f << P.x << ' ' << P.y << ' ' << P.z << ' ' << P.omega; return f; }
+-  friend istream& operator >>(istream& f,  R_4 & P)
++  friend std::istream& operator >>(std::istream& f,  R_4 & P)
+   { f >> P.x >>  P.y >>  P.z >> P.omega ; return f; }
+ 
+   friend std::ostream& operator <<(std::ostream& f, const R_4 * P )
+   { f << P->x << ' ' << P->y << ' ' << P->z << ' ' << P->omega; return f; }
+-  friend istream& operator >>(istream& f,  R_4 * P)
++  friend std::istream& operator >>(std::istream& f,  R_4 * P)
+   { f >> P->x >>  P->y >>  P->z >> P->omega ; return f; }
+ 
+ public:  
+Index: freecad-0.18.4+dfsg1/src/Mod/Drawing/App/DrawingExport.cpp
+===================================================================
+--- freecad-0.18.4+dfsg1.orig/src/Mod/Drawing/App/DrawingExport.cpp
++++ freecad-0.18.4+dfsg1/src/Mod/Drawing/App/DrawingExport.cpp
+@@ -81,6 +81,7 @@
+ #include <Base/Vector3D.h>
+ 
+ using namespace Drawing;
++using namespace std;
+ 
+ TopoDS_Edge DrawingOutput::asCircle(const BRepAdaptor_Curve& c) const
+ {
+Index: freecad-0.18.4+dfsg1/src/Mod/Part/App/Geometry.cpp
+===================================================================
+--- freecad-0.18.4+dfsg1.orig/src/Mod/Part/App/Geometry.cpp
++++ freecad-0.18.4+dfsg1/src/Mod/Part/App/Geometry.cpp
+@@ -203,7 +203,7 @@
+ void Geometry::Save(Base::Writer &writer) const
+ {
+     const char c = Construction?'1':'0';
+-    writer.Stream() << writer.ind() << "<Construction value=\"" <<  c << "\"/>" << endl;
++    writer.Stream() << writer.ind() << "<Construction value=\"" <<  c << "\"/>" << std::endl;
+ }
+ 
+ void Geometry::Restore(Base::XMLReader &reader)
+@@ -323,7 +323,7 @@
+                 << "X=\"" <<  Point.x <<
+                 "\" Y=\"" <<  Point.y <<
+                 "\" Z=\"" <<  Point.z <<
+-             "\"/>" << endl;
++             "\"/>" << std::endl;
+ }
+ 
+ void GeomPoint::Restore(Base::XMLReader &reader)
+@@ -793,7 +793,7 @@
+          << writer.ind()
+              << "<BezierCurve "
+                 << "PolesCount=\"" <<  poles.size() <<
+-             "\">" << endl;
++             "\">" << std::endl;
+ 
+     writer.incInd();
+ 
+@@ -808,11 +808,11 @@
+             "\" Y=\"" << (*itp).y <<
+             "\" Z=\"" << (*itp).z <<
+             "\" Weight=\"" << (*itw) <<
+-        "\"/>" << endl;
++        "\"/>" << std::endl;
+     }
+ 
+     writer.decInd();
+-    writer.Stream() << writer.ind() << "</BezierCurve>" << endl ;
++    writer.Stream() << writer.ind() << "</BezierCurve>" << std::endl;
+ }
+ 
+ void GeomBezierCurve::Restore(Base::XMLReader& reader)
+@@ -1270,7 +1270,7 @@
+                  "\" KnotsCount=\"" <<  knots.size() <<
+                  "\" Degree=\"" <<  degree <<
+                  "\" IsPeriodic=\"" <<  (int) isperiodic <<
+-             "\">" << endl;
++             "\">" << std::endl;
+ 
+     writer.incInd();
+ 
+@@ -1285,7 +1285,7 @@
+             "\" Y=\"" << (*itp).y <<
+             "\" Z=\"" << (*itp).z <<
+             "\" Weight=\"" << (*itw) <<
+-        "\"/>" << endl;
++        "\"/>" << std::endl;
+     }
+ 
+     std::vector<double>::const_iterator itk;
+@@ -1297,11 +1297,11 @@
+             << "<Knot "
+             << "Value=\"" << (*itk)
+             << "\" Mult=\"" << (*itm) <<
+-        "\"/>" << endl;
++        "\"/>" << std::endl;
+     }
+ 
+     writer.decInd();
+-    writer.Stream() << writer.ind() << "</BSplineCurve>" << endl ;
++    writer.Stream() << writer.ind() << "</BSplineCurve>" << std::endl;
+ }
+ 
+ void GeomBSplineCurve::Restore(Base::XMLReader& reader)
+@@ -1903,7 +1903,7 @@
+                 "\" NormalZ=\"" <<  normal.Z() <<
+                 "\" AngleXU=\"" <<  AngleXU <<
+                 "\" Radius=\"" <<  this->myCurve->Radius() <<
+-             "\"/>" << endl;
++             "\"/>" << std::endl;
+ }
+ 
+ void GeomCircle::Restore(Base::XMLReader& reader)
+@@ -2132,7 +2132,7 @@
+                 "\" Radius=\"" <<  circle->Radius() <<
+                 "\" StartAngle=\"" <<  this->myCurve->FirstParameter() <<
+                 "\" EndAngle=\"" <<  this->myCurve->LastParameter() <<
+-             "\"/>" << endl;
++             "\"/>" << std::endl;
+ }
+ 
+ void GeomArcOfCircle::Restore(Base::XMLReader &reader)
+@@ -2383,7 +2383,7 @@
+             << "MajorRadius=\"" <<  this->myCurve->MajorRadius() << "\" "
+             << "MinorRadius=\"" <<  this->myCurve->MinorRadius() << "\" "
+             << "AngleXU=\"" << AngleXU << "\" "
+-            << "/>" << endl;
++            << "/>" << std::endl;
+ }
+ 
+ void GeomEllipse::Restore(Base::XMLReader& reader)
+@@ -2653,7 +2653,7 @@
+             << "AngleXU=\"" << AngleXU << "\" "
+             << "StartAngle=\"" <<  this->myCurve->FirstParameter() << "\" "
+             << "EndAngle=\"" <<  this->myCurve->LastParameter() << "\" "
+-            << "/>" << endl;
++            << "/>" << std::endl;
+ }
+ 
+ void GeomArcOfEllipse::Restore(Base::XMLReader &reader)
+@@ -2826,7 +2826,7 @@
+             << "MajorRadius=\"" <<  this->myCurve->MajorRadius() << "\" "
+             << "MinorRadius=\"" <<  this->myCurve->MinorRadius() << "\" "
+             << "AngleXU=\"" << AngleXU << "\" "
+-            << "/>" << endl;
++            << "/>" << std::endl;
+ }
+ 
+ void GeomHyperbola::Restore(Base::XMLReader& reader)
+@@ -3083,7 +3083,7 @@
+             << "AngleXU=\"" << AngleXU << "\" "
+             << "StartAngle=\"" <<  this->myCurve->FirstParameter() << "\" "
+             << "EndAngle=\"" <<  this->myCurve->LastParameter() << "\" "
+-            << "/>" << endl;
++            << "/>" << std::endl;
+ }
+ 
+ void GeomArcOfHyperbola::Restore(Base::XMLReader &reader)
+@@ -3236,7 +3236,7 @@
+             << "NormalZ=\"" <<  normal.Z() << "\" "
+             << "Focal=\"" <<  this->myCurve->Focal() << "\" "
+             << "AngleXU=\"" << AngleXU << "\" "
+-            << "/>" << endl;
++            << "/>" << std::endl;
+ }
+ 
+ void GeomParabola::Restore(Base::XMLReader& reader)
+@@ -3436,7 +3436,7 @@
+             << "AngleXU=\"" << AngleXU << "\" "
+             << "StartAngle=\"" <<  this->myCurve->FirstParameter() << "\" "
+             << "EndAngle=\"" <<  this->myCurve->LastParameter() << "\" "
+-            << "/>" << endl;
++            << "/>" << std::endl;
+ }
+ 
+ void GeomArcOfParabola::Restore(Base::XMLReader &reader)
+@@ -3581,7 +3581,7 @@
+                 "\" DirX=\"" <<  Dir.x <<
+                 "\" DirY=\"" <<  Dir.y <<
+                 "\" DirZ=\"" <<  Dir.z <<
+-             "\"/>" << endl;
++             "\"/>" << std::endl;
+ }
+ void GeomLine::Restore(Base::XMLReader &reader)
+ {
+@@ -3722,7 +3722,7 @@
+                 "\" EndX=\"" <<  End.x <<
+                 "\" EndY=\"" <<  End.y <<
+                 "\" EndZ=\"" <<  End.z <<
+-             "\"/>" << endl;
++             "\"/>" << std::endl;
+ }
+ 
+ void GeomLineSegment::Restore    (Base::XMLReader &reader)
+Index: freecad-0.18.4+dfsg1/src/Mod/Part/App/Geometry2d.cpp
+===================================================================
+--- freecad-0.18.4+dfsg1.orig/src/Mod/Part/App/Geometry2d.cpp
++++ freecad-0.18.4+dfsg1/src/Mod/Part/App/Geometry2d.cpp
+@@ -83,6 +83,7 @@
+ #include <Mod/Part/App/Geom2d/OffsetCurve2dPy.h>
+ 
+ using namespace Part;
++using namespace std;
+ 
+ extern const char* gce_ErrorStatusText(gce_ErrorType et);
+ 
+Index: freecad-0.18.4+dfsg1/src/Mod/Part/App/PropertyTopoShape.cpp
+===================================================================
+--- freecad-0.18.4+dfsg1.orig/src/Mod/Part/App/PropertyTopoShape.cpp
++++ freecad-0.18.4+dfsg1/src/Mod/Part/App/PropertyTopoShape.cpp
+@@ -281,11 +281,11 @@
+ static Standard_Boolean  BRepTools_Write(const TopoDS_Shape& Sh, 
+                                    const Standard_CString File)
+ {
+-  ofstream os;
++  std::ofstream os;
+ #if OCC_VERSION_HEX >= 0x060800
+-  OSD_OpenStream(os, File, ios::out);
++  OSD_OpenStream(os, File, std::ios::out);
+ #else
+-  os.open(File, ios::out);
++  os.open(File, std::ios::out);
+ #endif
+   if (!os.rdbuf()->is_open()) return Standard_False;
+ 
+Index: freecad-0.18.4+dfsg1/src/Mod/Raytracing/App/AppRaytracingPy.cpp
+===================================================================
+--- freecad-0.18.4+dfsg1.orig/src/Mod/Raytracing/App/AppRaytracingPy.cpp
++++ freecad-0.18.4+dfsg1/src/Mod/Raytracing/App/AppRaytracingPy.cpp
+@@ -40,6 +40,7 @@
+ #include <Mod/Part/App/TopoShapePy.h>
+ #include <App/Application.h>
+ 
++using namespace std;
+ 
+ namespace Raytracing {
+ class Module : public Py::ExtensionModule<Module>
+Index: freecad-0.18.4+dfsg1/src/Mod/Raytracing/App/LuxFeature.cpp
+===================================================================
+--- freecad-0.18.4+dfsg1.orig/src/Mod/Raytracing/App/LuxFeature.cpp
++++ freecad-0.18.4+dfsg1/src/Mod/Raytracing/App/LuxFeature.cpp
+@@ -38,6 +38,7 @@
+ 
+ 
+ using namespace Raytracing;
++using namespace std;
+ 
+ PROPERTY_SOURCE(Raytracing::LuxFeature, Raytracing::RaySegment)
+ 
diff -Nru freecad-0.18.4+dfsg2/debian/patches/freecad-0.18-py38.patch freecad-0.18.4+dfsg2/debian/patches/freecad-0.18-py38.patch
--- freecad-0.18.4+dfsg2/debian/patches/freecad-0.18-py38.patch	1970-01-01 01:00:00.000000000 +0100
+++ freecad-0.18.4+dfsg2/debian/patches/freecad-0.18-py38.patch	2020-01-29 11:31:12.000000000 +0100
@@ -0,0 +1,30 @@
+--- a/src/Base/swigpyrun.cpp
++++ b/src/Base/swigpyrun.cpp
+@@ -35,6 +35,16 @@
+ # pragma GCC diagnostic ignored "-Wcast-function-type"
+ # endif
+ #endif
++
++/* Temporary workaround for PyInterpreterState being made private in Python
++ * 3.8.
++#if PY_VERSION_HEX >= 0x03080000
++# define Py_BUILD_CORE
++#  include "internal/pycore_pystate.h"
++# undef Py_BUILD_CORE
++#endif
++*/
++
+ namespace Swig_python {
+ #define SWIG_PYTHON_NO_BUILD_NONE
+ #include <swigpyrun.h>
+--- a/src/Base/swigpyrun.inl
++++ b/src/Base/swigpyrun.inl
+@@ -72,7 +72,7 @@ void cleanupSWIG_T(const char* TypeName)
+ 
+     PyObject *module, *dict;
+     PyInterpreterState *interp = PyThreadState_GET()->interp;
+-    PyObject *modules = interp->modules;
++    PyObject *modules = PyImport_GetModuleDict();
+     module = PyDict_GetItemString(modules, "__builtin__");
+     if (module != NULL && PyModule_Check(module)) {
+         dict = PyModule_GetDict(module);
diff -Nru freecad-0.18.4+dfsg2/debian/patches/new-pyside2.patch freecad-0.18.4+dfsg2/debian/patches/new-pyside2.patch
--- freecad-0.18.4+dfsg2/debian/patches/new-pyside2.patch	1970-01-01 01:00:00.000000000 +0100
+++ freecad-0.18.4+dfsg2/debian/patches/new-pyside2.patch	2020-02-11 12:59:12.000000000 +0100
@@ -0,0 +1,26 @@
+Description: Now tools in new pyside2 are called uic and rcc and needs -qt5 to work properly
+Author: Gianfranco Costamagna <locutusofb...@debian.org>
+Last-Update: 2020-01-29
+
+--- freecad-0.18.4+dfsg1.orig/cMake/FindPySide2Tools.cmake
++++ freecad-0.18.4+dfsg1/cMake/FindPySide2Tools.cmake
+@@ -20,8 +20,8 @@ if(WIN32 OR ${CMAKE_SYSTEM_NAME} MATCHES
+     set(PYSIDE_BIN_DIR ${PYTHON_BIN_DIR})
+ endif(WIN32 OR ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ 
+-FIND_PROGRAM(PYSIDE2UICBINARY NAMES python2-pyside2-uic pyside2-uic pyside2-uic-${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR} HINTS ${PYSIDE_BIN_DIR})
+-FIND_PROGRAM(PYSIDE2RCCBINARY NAMES pyside2-rcc pyside2-rcc-${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR} HINTS ${PYSIDE_BIN_DIR})
++FIND_PROGRAM(PYSIDE2UICBINARY NAMES uic python2-pyside2-uic pyside2-uic pyside2-uic-${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR} HINTS ${PYSIDE_BIN_DIR})
++FIND_PROGRAM(PYSIDE2RCCBINARY NAMES pyrcc5 pyside2-rcc pyside2-rcc-${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR} HINTS ${PYSIDE_BIN_DIR})
+ 
+ MACRO(PYSIDE_WRAP_UI outfiles)
+   FOREACH(it ${ARGN})
+@@ -41,7 +41,7 @@ MACRO(PYSIDE_WRAP_UI outfiles)
+         # pyside2-uic generates in comments at beginning., which is why
+         # we follow the tool command with in-place sed.
+         ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
+-          COMMAND "${PYSIDE2UICBINARY}" "${infile}" -o "${outfile}"
++          COMMAND "${PYSIDE2UICBINARY}" -qt5 "${infile}" -o "${outfile}"
+           COMMAND sed -i "/^# /d" "${outfile}"
+           MAIN_DEPENDENCY "${infile}"
+         )
diff -Nru freecad-0.18.4+dfsg2/debian/patches/python3.8.patch freecad-0.18.4+dfsg2/debian/patches/python3.8.patch
--- freecad-0.18.4+dfsg2/debian/patches/python3.8.patch	1970-01-01 01:00:00.000000000 +0100
+++ freecad-0.18.4+dfsg2/debian/patches/python3.8.patch	2020-02-11 13:50:00.000000000 +0100
@@ -0,0 +1,43 @@
+Description: fix some failures with new python3.8
+Author: Gianfranco Costamagna <locutusofb...@debian.org>
+
+--- freecad-0.18.4+dfsg1.orig/src/Mod/Test/Document.py
++++ freecad-0.18.4+dfsg1/src/Mod/Test/Document.py
+@@ -1308,7 +1308,7 @@ class DocumentFileIncludeCases(unittest.
+     # copy file from L5 which is in the same directory
+     L7 = doc2.addObject("App::DocumentObjectFileIncluded","FileObject3")
+     L7.File = (L5.File,"Copy.txt")
+-    self.failUnless(os.path.exists(L5.File))
++    self.failUnless(os.path.exists(L7.File))
+     FreeCAD.closeDocument("Doc2")
+ 
+ 
+--- freecad-0.18.4+dfsg1.orig/src/Mod/Path/PathTests/TestPathDeburr.py
++++ freecad-0.18.4+dfsg1/src/Mod/Path/PathTests/TestPathDeburr.py
+@@ -53,7 +53,7 @@ class TestPathDeburr(PathTestUtils.PathT
+         self.assertRoughly(9, offset)
+ 
+     def test01(self):
+-        '''Verify chamfer depth and offset for a 90° v-bit.'''
++        '''Verify chamfer depth and offset for a 90 deg v-bit.'''
+         tool = Path.Tool()
+         tool.FlatRadius = 0
+         tool.CuttingEdgeAngle = 90
+@@ -67,7 +67,7 @@ class TestPathDeburr(PathTestUtils.PathT
+         self.assertRoughly(0.2, offset)
+ 
+     def test02(self):
+-        '''Verify chamfer depth and offset for a 90° v-bit with non 0 flat radius.'''
++        '''Verify chamfer depth and offset for a 90 deg v-bit with non 0 flat radius.'''
+         tool = Path.Tool()
+         tool.FlatRadius = 0.3
+         tool.CuttingEdgeAngle = 90
+@@ -81,7 +81,7 @@ class TestPathDeburr(PathTestUtils.PathT
+         self.assertRoughly(0.5, offset)
+ 
+     def test03(self):
+-        '''Verify chamfer depth and offset for a 60° v-bit with non 0 flat radius.'''
++        '''Verify chamfer depth and offset for a 60 deg v-bit with non 0 flat radius.'''
+         tool = Path.Tool()
+         tool.FlatRadius = 10
+         tool.CuttingEdgeAngle = 60
diff -Nru freecad-0.18.4+dfsg2/debian/patches/python3.8-syntax.diff freecad-0.18.4+dfsg2/debian/patches/python3.8-syntax.diff
--- freecad-0.18.4+dfsg2/debian/patches/python3.8-syntax.diff	1970-01-01 01:00:00.000000000 +0100
+++ freecad-0.18.4+dfsg2/debian/patches/python3.8-syntax.diff	2020-02-11 13:50:02.000000000 +0100
@@ -0,0 +1,16 @@
+Index: b/src/Mod/Test/TestPythonSyntax.py
+===================================================================
+--- a/src/Mod/Test/TestPythonSyntax.py
++++ b/src/Mod/Test/TestPythonSyntax.py
+@@ -34,9 +34,11 @@ class PythonSyntaxTestCase(unittest.Test
+     """
+     def setUp(self):
+         self.whitelist = []
++        self.whitelist += ["ap203_configuration_controlled_3d_design_of_mechanical_parts_and_assemblies_mim_lf.py"]
+         self.whitelist += ["automotive_design.py"]
+         self.whitelist += ["ifc2x3.py"]
+         self.whitelist += ["ifc4.py"]
++        self.whitelist += ["__exec_old.py"]
+         
+ 
+     def testAll(self):
diff -Nru freecad-0.18.4+dfsg2/debian/patches/series freecad-0.18.4+dfsg2/debian/patches/series
--- freecad-0.18.4+dfsg2/debian/patches/series	2020-02-11 13:26:08.000000000 +0100
+++ freecad-0.18.4+dfsg2/debian/patches/series	2020-02-12 01:44:52.000000000 +0100
@@ -7,3 +7,8 @@
 exclude_ply.patch
 disable_memory_check.patch
 remove_doc-files.patch
+freecad-0.18-py38.patch
+new-pyside2.patch
+FreeCAD-0-18.patch
+python3.8.patch
+python3.8-syntax.diff

Reply via email to