summaryrefslogtreecommitdiffstats
path: root/py
diff options
context:
space:
mode:
Diffstat (limited to 'py')
-rw-r--r--py/.gitignore4
-rw-r--r--py/Makefile.am31
-rw-r--r--py/__init__.py1
-rw-r--r--py/nftables.py2
-rwxr-xr-xpy/setup.py23
5 files changed, 61 insertions, 0 deletions
diff --git a/py/.gitignore b/py/.gitignore
index 0d20b648..09c1e62b 100644
--- a/py/.gitignore
+++ b/py/.gitignore
@@ -1 +1,5 @@
*.pyc
+build/
+dist/
+lib.*/
+nftables.egg-info/
diff --git a/py/Makefile.am b/py/Makefile.am
new file mode 100644
index 00000000..0963535d
--- /dev/null
+++ b/py/Makefile.am
@@ -0,0 +1,31 @@
+EXTRA_DIST = setup.py __init__.py nftables.py
+
+if HAVE_PYTHON
+
+all-local:
+ cd $(srcdir) && \
+ $(PYTHON_BIN) setup.py build --build-base $(abs_builddir)
+
+install-exec-local:
+ cd $(srcdir) && \
+ $(PYTHON_BIN) setup.py build --build-base $(abs_builddir) \
+ install --prefix $(DESTDIR)$(prefix)
+
+uninstall-local:
+ rm -rf $(DESTDIR)$(prefix)/lib*/python*/site-packages/nftables
+ rm -rf $(DESTDIR)$(prefix)/lib*/python*/dist-packages/nftables
+ rm -rf $(DESTDIR)$(prefix)/lib*/python*/site-packages/nftables-[0-9]*.egg-info
+ rm -rf $(DESTDIR)$(prefix)/lib*/python*/dist-packages/nftables-[0-9]*.egg-info
+ rm -rf $(DESTDIR)$(prefix)/lib*/python*/site-packages/nftables-[0-9]*.egg
+ rm -rf $(DESTDIR)$(prefix)/lib*/python*/dist-packages/nftables-[0-9]*.egg
+
+clean-local:
+ cd $(srcdir) && \
+ $(PYTHON_BIN) setup.py clean \
+ --build-base $(abs_builddir)
+ rm -rf scripts-* lib* build dist bdist.* nftables.egg-info
+ find . -name \*.pyc -print0 | xargs -0 rm -f
+
+distclean-local:
+ rm -f version
+endif
diff --git a/py/__init__.py b/py/__init__.py
new file mode 100644
index 00000000..7567f095
--- /dev/null
+++ b/py/__init__.py
@@ -0,0 +1 @@
+from .nftables import *
diff --git a/py/nftables.py b/py/nftables.py
index e6e66fb7..d6135054 100644
--- a/py/nftables.py
+++ b/py/nftables.py
@@ -2,6 +2,8 @@ import json
from ctypes import *
import sys
+NFTABLES_VERSION = "0.1"
+
class Nftables:
"""A class representing libnftables interface"""
diff --git a/py/setup.py b/py/setup.py
new file mode 100755
index 00000000..ef143c42
--- /dev/null
+++ b/py/setup.py
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+from distutils.core import setup
+from nftables import NFTABLES_VERSION
+
+setup(name='nftables',
+ version=NFTABLES_VERSION,
+ description='Libnftables binding',
+ author='Netfilter project',
+ author_email='coreteam@netfilter.org',
+ url='https://netfilter.org/projects/nftables/index.html',
+ packages=['nftables'],
+ provides=['nftables'],
+ package_dir={'nftables':'.'},
+ classifiers=[
+ 'Development Status :: 4 - Beta',
+ 'Environment :: Console',
+ 'Intended Audience :: Developers',
+ 'License :: OSI Approved :: GNU General Public License v2 (GPLv2)',
+ 'Operating System :: POSIX :: Linux',
+ 'Programming Language :: Python',
+ 'Topic :: System :: Networking :: Firewalls',
+ ],
+ )