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

Output dylib file hardcoded with ".so" in filename #512

Closed
yegle opened this issue May 29, 2016 · 3 comments
Closed

Output dylib file hardcoded with ".so" in filename #512

yegle opened this issue May 29, 2016 · 3 comments

Comments

@yegle
Copy link

yegle commented May 29, 2016

In https://github.com/Valloric/ycmd/blob/master/cpp/ycm/CMakeLists.txt#L426 it assumed that ".so" is always recognized as a valid Python C module extension. But it's not always the case. Some heavy patched Python installation may use other extensions as valid extension.

Not to argue whether it's right to remove ".so" as a valid C module extension, I think it should read supported extensions from imp.get_suffixes().

FYI here's the output on my system:

  • $ /usr/bin/python -c 'import imp; print(imp.get_suffixes())'
    [('.so', 'rb', 3), ('module.so', 'rb', 3), ('.py', 'U', 1), ('.pyc', 'rb', 2)]
  • $ $HOME/.gentoo/usr/bin/python2 -c 'import imp; print(imp.get_suffixes())'
    [('.bundle', 'rb', 3), ('module.bundle', 'rb', 3), ('.py', 'U', 1), ('.pyc', 'rb', 2)]
  • $ $HOME/.gentoo/usr/bin/python3 -c 'import imp; print(imp.get_suffixes())'
    [('.cpython-35-darwin.bundle', 'rb', 3), ('.abi3.bundle', 'rb', 3), ('.bundle', 'rb', 3), ('.py', 'r', 1), ('.pyc', 'rb', 2)]
@vheon
Copy link
Contributor

vheon commented May 29, 2016

Some heavy patched Python installation may use other extensions as valid extension.

What do you mean by this? Can you elaborate?

@yegle
Copy link
Author

yegle commented May 29, 2016

@vheon I'm using Gentoo Prefix https://wiki.gentoo.org/wiki/Project:Prefix as my package manager on OS X, of which they decide to patch and remove support for .so files as valid C module suffixes.

I'm not sure about all other OS X package managers out there. Some notable examples:

@micbou
Copy link
Collaborator

micbou commented May 30, 2016

This issue should be reported to the Gentoo Prefix maintainers because I am sure that ycmd is not the only project assuming that .so is the default extension on OS X (and for a good reason, it's the default in the Python sources) so the Python installation from Gentoo Prefix is broken for all of these projects.

Not to argue whether it's right to remove ".so" as a valid C module extension, I think it should read supported extensions from imp.get_suffixes().

Calling imp.get_suffixes() from CMake will not be easy. We'll need the path to the Python interpreter and we can't really rely on CMake to find the right one. I don't think it's worth the trouble. Not to mention that imp.get_suffixes() is deprecated since Python 3.3 (we'll need to use importlib.machinery.EXTENSION_SUFFIXES for 3.3 and later).

@micbou micbou closed this as completed May 30, 2016
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

No branches or pull requests

3 participants