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

fix ctypes.util.find_library usage #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mstone232
Copy link

Per https://docs.python.org/2/library/ctypes.html the find_library
function should be called "without any prefix like lib, suffix like .so,
.dylib or version number".

  • change _LIBRARY_NAME from "libarchive" to "archive" as required

  • move find_library logic after the *_LIBRARY_PATH logic to preserve
    current behavior. I suspect that the LD_LIBRARY_PATH logic is not
    actually necessary, but a side effect of this bug. I'm leaving it
    alone because I can't test all existing configurations to confirm
    that.

  • if find_library returns a result, use it unconditionally. Trying to
    confirm it is unnecessary (find_library would have returned None
    otherwise) and impossible without duplicating all of the linker's
    logic. The result will be something like "libarchive.so.13" (without
    a path) which will just do the right thing when used with LoadLibrary.

  • remove note about installing libarchive-dev, that isn't needed

Per https://docs.python.org/2/library/ctypes.html the find_library
function should be called "without any prefix like lib, suffix like .so,
.dylib or version number".

 - change _LIBRARY_NAME from "libarchive" to "archive" as required

 - move find_library logic after the *_LIBRARY_PATH logic to preserve
   current behavior. I suspect that the LD_LIBRARY_PATH logic is not
   actually necessary, but a side effect of this bug. I'm leaving it
   alone because I can't test all existing configurations to confirm
   that.

 - if find_library returns a result, use it unconditionally. Trying to
   confirm it is unnecessary (find_library would have returned None
   otherwise) and impossible without duplicating all of the linker's
   logic. The result will be something like "libarchive.so.13" (without
   a path) which will just do the right thing when used with LoadLibrary.

 - remove note about installing libarchive-dev, that isn't needed
@coveralls
Copy link

Pull Request Test Coverage Report for Build 16

  • 4 of 4 (100.0%) changed or added relevant lines in 1 file are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.1%) to 70.37%

Files with Coverage Reduction New Missed Lines %
libarchive/library.py 2 72.41%
Totals Coverage Status
Change from base Build 14: -0.1%
Covered Lines: 665
Relevant Lines: 945

💛 - Coveralls

@jocelynj
Copy link

I'm seeing an issue with python 3.9 that should be fixed by this commit:

    error: [Errno 2] No such file or directory: b'liblibarchive.a'

Is it possible to update this PR, and merge it to master?

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