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

Issue 104 #111

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ python:
- "3.6"
- "3.7"
- "3.9"
- "3.10"

addons:
apt:
Expand Down
2 changes: 1 addition & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Fixes:

- Support Python 3.9
- Support Python 3.9 and 3.10

Adds:

Expand Down
21 changes: 20 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,23 @@ def find_prefix_and_pcap_h():
sys.exit(1)


def ctype_find_library(lib_files):
try:
from ctypes.util import find_library

unique_files = set(map(lambda lib_file: lib_file.split('.')[0], # ignore file extension
lib_files))

for lib_file in unique_files:
lib_file_path = find_library(lib_file)
if lib_file_path:
return lib_file_path

return None # library not found
except:
return None # ctypes not found


def find_lib_path_and_file(prefix):
if sys.maxsize > 2 ** 32:
candidates = [
Expand Down Expand Up @@ -81,7 +98,9 @@ def find_lib_path_and_file(prefix):
'libpcap.dylib',
'wpcap.lib'
]
lib_file_path = recursive_search_dirs(lib_sub_dirs, lib_files)
lib_file_path = ctype_find_library(lib_files)
if not lib_file_path:
lib_file_path = recursive_search_dirs(lib_sub_dirs, lib_files)
if not lib_file_path:
print("None of the following found: %s" % lib_files)
sys.exit(1)
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py27, py36, py37, py39, pypy, docs
envlist = py27, py36, py37, py39, py310, pypy, docs

[travis]
python =
Expand Down