diff --git a/.gitignore b/.gitignore index 424c816..37ff877 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ build -libnids-1.25 +dist +MANIFEST diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..d316846 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule "libnids"] + path = libnids + url = https://github.com/mitrecnd/libnids.git + branch = master diff --git a/MANIFEST b/MANIFEST deleted file mode 100644 index 2c25a06..0000000 --- a/MANIFEST +++ /dev/null @@ -1,7 +0,0 @@ -CHANGES -COPYING -Example -libnids-1.25.tar.gz -nidsmodule.c -README -setup.py \ No newline at end of file diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..72d9570 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,3 @@ +include CHANGES COPYING Example nidsmodule.c README setup.py +graft libnids +global-exclude .git diff --git a/dist/pynids-0.6.2.tar.gz b/dist/pynids-0.6.2.tar.gz deleted file mode 100644 index 5cda880..0000000 Binary files a/dist/pynids-0.6.2.tar.gz and /dev/null differ diff --git a/libnids b/libnids new file mode 160000 index 0000000..d47c9d8 --- /dev/null +++ b/libnids @@ -0,0 +1 @@ +Subproject commit d47c9d84ac7822a541ad7c8abf9492ecb57c17c5 diff --git a/libnids-1.25.tar.gz b/libnids-1.25.tar.gz deleted file mode 100644 index 336faa5..0000000 Binary files a/libnids-1.25.tar.gz and /dev/null differ diff --git a/setup.py b/setup.py index 9b76260..31c5188 100644 --- a/setup.py +++ b/setup.py @@ -12,16 +12,13 @@ pathjoin = os.path.join -PKGNAME = 'libnids-1.25' -PKGTAR = PKGNAME + '.tar.gz' -BUILDDIR = PKGNAME +BUILDDIR = 'libnids' INCLUDE_DIRS = ['/usr/local/include', '/opt/local/include'] LIBRARY_DIRS = ['/usr/local/lib', '/opt/local/lib'] EXTRA_OBJECTS = [] class nidsMaker(build): - NIDSTAR = PKGTAR NIDSDIR = BUILDDIR include_dirs = [ pathjoin(NIDSDIR, 'src') ] library_dirs = [] @@ -29,13 +26,11 @@ class nidsMaker(build): def buildNids(self): # extremely crude package builder - try: - os.stat(self.NIDSDIR) - return None # assume already built - except OSError: - pass - spawn(['tar', '-zxf', self.NIDSTAR], search_path = 1) + for extra_obj in self.extra_objects: + if os.path.exists(extra_obj): + return None # assume already built + os.chdir(self.NIDSDIR) spawn([pathjoin('.','configure'), 'CFLAGS=-fPIC', '--disable-libglib', '--disable-libnet']) spawn(['make'], search_path = 1) @@ -45,6 +40,19 @@ def run(self): self.buildNids() build.run(self) + +class nidsClean(build): + NIDSDIR = BUILDDIR + + def cleanNids(self): + os.chdir(self.NIDSDIR) + spawn(['make','distclean'], search_path=1) + os.chdir('..') + + def run(self): + self.cleanNids() + + INCLUDE_DIRS = nidsMaker.include_dirs + INCLUDE_DIRS EXTRA_OBJECTS = nidsMaker.extra_objects + EXTRA_OBJECTS @@ -61,7 +69,7 @@ def run(self): port scan detection. ------- ''', - cmdclass = {'build': nidsMaker}, + cmdclass = {'build': nidsMaker, 'distclean': nidsClean}, ext_modules = [ Extension( "nidsmodule", #define_macros = [ ("DEBUG", None), ], @@ -72,5 +80,5 @@ def run(self): extra_objects = EXTRA_OBJECTS ) ], - url = "http://jon.oberheide.org/pynids/", + url = "http://github.com/mitrecnd/pynids/", )