pynetwork / pypcap

pypcap - python libpcap module, forked from code.google.com/p/pypcap
Other
297 stars 74 forks source link

Support standard methods of specifying header / library locations #88

Open mjpieters opened 5 years ago

mjpieters commented 5 years ago

Currently the setup.py strategy is to look for pcap.h in a fixed set of locations. Please support either LDFLAGS / CFLAGS (or CPPFLAGS) to specify additional locations, and / or use pkg-config to locate the prefix.

For example, running pkg-config --libs-only-L --cflags libpcap on conforming systems gives you the correct -I and -L flags (to then be parsed further) or use pkg-config --variable=includedir libpcap and pkg-config --variable=libdir libpcap to get the include and library paths as two separate strings on stdout.

For LDFLAGS and CFLAGS no further parsing would be required, as setuptools.Extension() supports those natively, provided you don't override those. Perhaps only do the current manual search if a pkg-config search fails and no LDFLAGS / CFLAGS / CPPFLAGS environment variables are set?

This then allows for isolated builds that use a specific, bundled version of libpcap.

hellais commented 5 years ago

This is a very good suggestion and I would be glad to review and accept a PR implementing it!