diff --git a/ndiff/ndifftest.py b/ndiff/ndifftest.py index 7f6eb76..5c31da1 100755 --- a/ndiff/ndifftest.py +++ b/ndiff/ndifftest.py @@ -11,7 +11,7 @@ import StringIO import imp dont_write_bytecode = sys.dont_write_bytecode sys.dont_write_bytecode = True -ndiff = imp.load_source("ndiff", "ndiff") +ndiff = imp.load_source("ndiff", "ndiff.py") for x in dir(ndiff): if not x.startswith("_"): globals()[x] = getattr(ndiff, x) @@ -742,10 +742,10 @@ def host_apply_diff(host, diff): def call_quiet(args, **kwargs): """Run a command with subprocess.call and hide its output.""" return subprocess.call(args, stdout = subprocess.PIPE, - stderr = subprocess.STDOUT, **kwargs) + stderr = subprocess.STDOUT, env = {'PYTHONPATH': "."}, **kwargs) class exit_code_test(unittest.TestCase): - NDIFF = "./ndiff" + NDIFF = "./scripts/ndiff" def test_exit_equal(self): """Test that the exit code is 0 when the diff is empty.""" diff --git a/ndiff/scripts/ndiff b/ndiff/scripts/ndiff new file mode 100755 index 0000000..23ca333 --- /dev/null +++ b/ndiff/scripts/ndiff @@ -0,0 +1,21 @@ +#!/usr/bin/env python + +# Ndiff +# +# This programs reads two Nmap XML files and displays a list of their +# differences. +# +# Copyright 2008 Insecure.Com LLC +# Ndiff is distributed under the same license as Nmap. See the file COPYING or +# http://nmap.org/data/COPYING. See http://nmap.org/book/man-legal.html for more +# details. +# +# David Fifield +# based on a design by Michael Pattrick + +import ndiff +import sys + +if __name__ == "__main__": + sys.excepthook = ndiff.excepthook + sys.exit(ndiff.main()) diff --git a/ndiff/setup.py b/ndiff/setup.py index f128ac6..a89dafe 100644 --- a/ndiff/setup.py +++ b/ndiff/setup.py @@ -28,6 +28,7 @@ class checked_install(distutils.command.install.install): raise distutils.errors.DistutilsPlatformError(str(e) + "\n" + "Installing your distribution's python-dev package may solve this problem.") -distutils.core.setup(name = u"ndiff", scripts = [u"ndiff"], +distutils.core.setup(name = u"ndiff", scripts = [u"scripts/ndiff"], + py_modules = [u"ndiff"], data_files = [(u"share/man/man1", [u"docs/ndiff.1"])], cmdclass = {"install_egg_info": null_command, "install": checked_install})