PyCXX upgrade

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
User avatar
yorik
Site Admin
Posts: 11458
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

PyCXX upgrade

Postby yorik » Wed Sep 17, 2014 9:37 pm

I upgraded PyCXX to the most recent version (6.2.5), which can support python3 too. It looks like nothing is broken (very few changes apparently, only adds py3 support), but I'd appreciate if someone else can give it a try and check if all seems to work normally. Thanks!

https://github.com/yorikvanhavre/FreeCAD/tree/pyccc625
User avatar
shoogen
Posts: 2823
Joined: Thu Dec 01, 2011 5:24 pm

Re: PyCXX upgrade

Postby shoogen » Thu Sep 18, 2014 7:21 am

I had problems with some relative paths.

Code: Select all

diff --git a/src/CXX/cxxextensions.c b/src/CXX/cxxextensions.c
index 28a8e1d..cfab556 100644
--- a/src/CXX/cxxextensions.c
+++ b/src/CXX/cxxextensions.c
@@ -37,7 +37,7 @@
 #include "CXX/WrapPython.h"
 
 #if PY_MAJOR_VERSION == 2
-#include "Src/Python2/cxxextensions.c"
+#include "Python2/cxxextensions.c"
 #else
-#include "Src/Python3/cxxextensions.c"
+#include "Python3/cxxextensions.c"
 #endif
diff --git a/src/CXX/cxxsupport.cxx b/src/CXX/cxxsupport.cxx
index 1f2fb43..946e60d 100644
--- a/src/CXX/cxxsupport.cxx
+++ b/src/CXX/cxxsupport.cxx
@@ -37,7 +37,7 @@
 #include "CXX/WrapPython.h"
 
 #if PY_MAJOR_VERSION == 2
-#include "Src/Python2/cxxsupport.cxx"
+#include "Python2/cxxsupport.cxx"
 #else
-#include "Src/Python3/cxxsupport.cxx"
+#include "Python3/cxxsupport.cxx"
 #endif
jmaustpc
Posts: 9556
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: PyCXX upgrade

Postby jmaustpc » Thu Sep 18, 2014 8:13 am

I get a build error code from your repo above...branch "pyccc625"

[ 0%] Building C object src/Base/CMakeFiles/FreeCADBase.dir/__/CXX/cxxextensions.c.o
/home/user/Downloads/cad/FreeCAD/yorik/code/src/CXX/cxxextensions.c:40:39: fatal error: Src/Python2/cxxextensions.c: No such file or directory
#include "Src/Python2/cxxextensions.c"
^
compilation terminated.
make[2]: *** [src/Base/CMakeFiles/FreeCADBase.dir/__/CXX/cxxextensions.c.o] Error 1
make[1]: *** [src/Base/CMakeFiles/FreeCADBase.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....


OS: Kubuntu 14.04.1 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit

Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
SoQt version: 1.6.0a
OCC version: 6.7.1 compiled from their master

Jim
wmayer
Site Admin
Posts: 14603
Joined: Thu Feb 19, 2009 10:32 am

Re: PyCXX upgrade

Postby wmayer » Thu Sep 18, 2014 8:17 am

We have to be careful with upgrading PyCXX. For the Windows platform we had to patch the PyCXX in order to export the class declarations to the library. And recently there were made a couple of changes to build with VS 2012.
jmaustpc
Posts: 9556
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: PyCXX upgrade

Postby jmaustpc » Thu Sep 18, 2014 11:21 am

wmayer wrote:We have to be careful with upgrading PyCXX. For the Windows platform we had to patch the PyCXX in order to export the class declarations to the library. And recently there were made a couple of changes to build with VS 2012.
Are these patches appropriate to offer upstream to PyCXX project?

Out of curiosity the last update to the code at PyCxx project is February this year. Here is a link to the code history on Sourceforge
http://sourceforge.net/p/cxx/code/295/log/?path=

and 6.2.5 was tagged 18-08-2013, just over a year ago.

http://sourceforge.net/p/cxx/code/HEAD/tree/
User avatar
jriegel
Site Admin
Posts: 3369
Joined: Sun Feb 15, 2009 5:29 pm
Location: Ulm, Germany
Contact:

Re: PyCXX upgrade

Postby jriegel » Thu Sep 18, 2014 12:09 pm

My changes regarding VS 2012 was mostly about unclean usage of int and index_type (which are 64 bit on Win64). It was more house keeping then features or bugs...
Stop whining - start coding!
jmaustpc
Posts: 9556
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: PyCXX upgrade

Postby jmaustpc » Thu Sep 18, 2014 12:21 pm

jriegel wrote:My changes regarding VS 2012 was mostly about unclean usage of int and index_type (which are 64 bit on Win64). It was more house keeping then features or bugs...
Does that mean that it could be worth while offering your changes to the PyCXX project? Sorry if this is a silly question. :)
User avatar
yorik
Site Admin
Posts: 11458
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: PyCXX upgrade

Postby yorik » Thu Sep 18, 2014 1:05 pm

Hm Sebastan's and Jim's problems seem to be the same... Indeed the paths were different in the PyCXX source package. I fixed that now.

Jürgen/Werner, what would you think is the best way to isolate those changes you did? A diff with a specific verison of PyCXX?
wmayer
Site Admin
Posts: 14603
Joined: Thu Feb 19, 2009 10:32 am

Re: PyCXX upgrade

Postby wmayer » Thu Sep 18, 2014 1:30 pm

Jürgen/Werner, what would you think is the best way to isolate those changes you did? A diff with a specific verison of PyCXX?
If you do a diff to the official PyCXX version we use and the sources in master you should get the changes we made.
User avatar
yorik
Site Admin
Posts: 11458
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: PyCXX upgrade

Postby yorik » Thu Sep 18, 2014 2:13 pm

Ok! I'll try to port those changes to the new version. It shouldn't be much work, the Python2 version apparently didn't change much...