File: setup.py

package info (click to toggle)
net-snmp 5.9.5.2%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 37,776 kB
  • sloc: ansic: 283,260; perl: 17,711; sh: 12,286; makefile: 2,711; python: 734; xml: 660; pascal: 62; sql: 47
file content (44 lines) | stat: -rw-r--r-- 1,461 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from setuptools import setup, Extension, find_packages
import os
import re
import sys

intree=0

args = sys.argv[:]
for arg in args:
    if arg.find('--basedir=') == 0:
        basedir = arg.split('=')[1]
        sys.argv.remove(arg)
        intree=1

if intree:
    netsnmp_libs = os.popen(basedir+'/net-snmp-config --libs').read()
    libdir = os.popen(basedir+'/net-snmp-config --build-lib-dirs '+basedir).read()
    incdir = os.popen(basedir+'/net-snmp-config --build-includes '+basedir).read() + " " + os.popen(basedir+'/net-snmp-config --base-cflags '+basedir).read()
    libs = re.findall(r"(?:^|\s+)-l(\S+)", netsnmp_libs)
    libdirs = re.findall(r"(?:^|\s+)-L(\S+)", libdir)
    incdirs = re.findall(r"(?:^|\s+)-I(\S+)", incdir)
else:
    netsnmp_libs = os.popen('net-snmp-config --libs').read()
    libdirs = re.findall(r"(?:^|\s+)-L(\S+)", netsnmp_libs)
    incdirs = []
    libs = re.findall(r"(?:^|\s+)-l(\S+)", netsnmp_libs)

setup(
    name="netsnmp-python", version="1.0a1",
    description = 'The Net-SNMP Python Interface',
    author = 'G. S. Marzot',
    author_email = 'giovanni.marzot@sparta.com',
    url = 'http://www.net-snmp.org',
    license="BSD",
    packages=find_packages(),
    test_suite = "netsnmp.tests.test",

    ext_modules = [
       Extension("netsnmp.client_intf", ["netsnmp/client_intf.c"],
                 library_dirs=libdirs,
                 include_dirs=incdirs,
                 libraries=libs )
       ]
    )