fix ctypes.util.find_library usage
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
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% |
| <!-- | Total: | 2 |
| Totals | |
|---|---|
| Change from base Build 14: | -0.1% |
| Covered Lines: | 665 |
| Relevant Lines: | 945 |
💛 - Coveralls
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?