Skip to content
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

Closed

Conversation

ianrrees
Copy link
Contributor

@ianrrees ianrrees commented Mar 17, 2017

  • snuck in before checklists

@ianrrees ianrrees force-pushed the 20170317-import-from-external-python branch from 6d3ce69 to c23d363 Compare March 18, 2017 19:58
pos = TempHomePath.find_last_of(PATHSEP);
TempHomePath.assign(TempHomePath,0,pos+1);
return TempHomePath;
if ( !PyString_Check(pyPath) )
Copy link
Contributor Author

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

@ianrrees ianrrees force-pushed the 20170317-import-from-external-python branch from c23d363 to da4ea8d Compare March 18, 2017 21:51
if ( !PyString_Check(pyPath) )
continue;
std::string path( PyString_AsString(pyPath) );
#endif // #if/else PY_MAJOR_VERSION >= 3
Copy link
Contributor

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

Copy link
Contributor Author

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.

@ianrrees ianrrees force-pushed the 20170317-import-from-external-python branch 2 times, most recently from d537f6e to 8b0fd78 Compare March 19, 2017 00:47
@wwmayer
Copy link
Contributor

wwmayer commented Mar 19, 2017

Out of curiosity, shouldn't the code to check for FreeCAD.so be located in MainPy.cpp?

@ianrrees
Copy link
Contributor Author

Aha, yes, I think it should. I'll try to change this PR tomorrow. Thanks!

@ianrrees ianrrees force-pushed the 20170317-import-from-external-python branch from 8b0fd78 to 8afb156 Compare March 20, 2017 22:53
@ianrrees ianrrees force-pushed the 20170317-import-from-external-python branch from 8afb156 to d379d65 Compare March 20, 2017 23:14
@ianrrees
Copy link
Contributor Author

Forgot to comment yesterday that I've updated this to put most of the changes in MainPy.cpp. Thanks!

@wwmayer
Copy link
Contributor

wwmayer commented Mar 21, 2017

Merged.

@wwmayer wwmayer closed this Mar 21, 2017
@ianrrees ianrrees deleted the 20170317-import-from-external-python branch March 23, 2017 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants