New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Find path to FreeCAD.so when importing from external python on MacOS #624
Find path to FreeCAD.so when importing from external python on MacOS #624
Conversation
ianrrees
commented
Mar 17, 2017
•
edited
edited
- snuck in before checklists
6d3ce69
to
c23d363
Compare
src/App/Application.cpp
Outdated
pos = TempHomePath.find_last_of(PATHSEP); | ||
TempHomePath.assign(TempHomePath,0,pos+1); | ||
return TempHomePath; | ||
if ( !PyString_Check(pyPath) ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add a conditional Python3 version of this shortly
c23d363
to
da4ea8d
Compare
src/App/Application.cpp
Outdated
if ( !PyString_Check(pyPath) ) | ||
continue; | ||
std::string path( PyString_AsString(pyPath) ); | ||
#endif // #if/else PY_MAJOR_VERSION >= 3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe checking for PyUnicode (python2 and 3)? and elif checking for PyString for python2?
if ( !PyUnicode_Check(pyPath) )
std::string path( PyUnicode_AsUTF8(pyPath) );
#if PY_MAJOR_VERSION < 3
if ( !PyString_Check(pyPath)
std::string path( PyString_AsString(pyPath) );
+#endif // #if/else PY_MAJOR_VERSION < 3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I'll change it to test for (unicode || string) in Python2 and just unicode in Python3.
However, I should note that this isn't going to add additional functionality until 2973 is fixed.
d537f6e
to
8b0fd78
Compare
Out of curiosity, shouldn't the code to check for FreeCAD.so be located in MainPy.cpp? |
Aha, yes, I think it should. I'll try to change this PR tomorrow. Thanks! |
8b0fd78
to
8afb156
Compare
8afb156
to
d379d65
Compare
Forgot to comment yesterday that I've updated this to put most of the changes in MainPy.cpp. Thanks! |
Merged. |