Commit 521ea5aa authored by Léo-Paul Géneau's avatar Léo-Paul Géneau 👾 Committed by GitHub

setup.py: generate pcap.c during setup (#16)

Use Cython as a prerequirement to generate pcap.c during the pip
installation for compatibility with the Python version of the user.
parent d22fde73
......@@ -19,6 +19,7 @@ Additionally, IGMPv2 and MLDv1 are implemented alongside with PIM-DM to detect i
- pip (to install all dependencies)
- libpcap-dev
- python3-dev
- Cython (it can be installed with pip)
# Installation
......
This diff is collapsed.
import sys
from setuptools import setup, find_packages, Extension
try:
from Cython.Build import cythonize
except ModuleNotFoundError:
raise SystemExit("Cython is required. You can install it with pip.")
# we only support Python 3 version >= 3.3
if len(sys.argv) >= 2 and sys.argv[1] == "install" and sys.version_info < (3, 3):
raise SystemExit("Python 3.3 or higher is required")
......@@ -26,11 +32,10 @@ setup(
'igmp==1.0.4',
],
packages=find_packages(exclude=["docs"]),
ext_modules = [Extension(
name="pcap_wrapper",
sources = ["pcap.c"],
libraries=["pcap"],
)],
ext_modules = cythonize([
Extension("pcap_wrapper", ["pcap.pyx"],
libraries=["pcap"]),
], language_level=3),
entry_points={
"console_scripts": [
"pim-dm = pimdm.Run:main",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment