From 936ed0193fc78a444885ab2f8e813a55e3163871 Mon Sep 17 00:00:00 2001 From: mdw Date: Fri, 3 Feb 2006 16:11:40 +0000 Subject: [PATCH] Debianization. --- MANIFEST.in | 1 + Makefile | 10 +++------ debian/changelog | 5 +++++ debian/control | 47 ++++++++++++++++++++++++++++++++++++++++++ debian/copyright | 16 ++++++++++++++ debian/rules | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ setup.py | 24 +++++++-------------- 7 files changed, 142 insertions(+), 24 deletions(-) create mode 100644 debian/changelog create mode 100644 debian/control create mode 100644 debian/copyright create mode 100755 debian/rules diff --git a/MANIFEST.in b/MANIFEST.in index 409b7fd..3f32e61 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1 +1,2 @@ include Makefile MANIFEST MANIFEST.in checkpath.pyx +include debian/rules debian/changelog debian/copyright debian/control diff --git a/Makefile b/Makefile index e414f7b..f1add74 100644 --- a/Makefile +++ b/Makefile @@ -4,21 +4,17 @@ PYTHON = python PYREXC = pyrexc prefix = /usr/local -all: setup.py checkpath.c +all: setup.py $(PYTHON) setup.py build clean: setup.py $(PYTHON) setup.py clean rm -rf build checkpath.c -checkpath.c: checkpath.pyx - pyrexc -o $@.new checkpath.pyx - mv $@.new $@ - -dist: setup.py checkpath.c +dist: setup.py $(PYTHON) setup.py sdist -install: setup.py checkpath.c +install: setup.py $(PYTHON) setup.py install --prefix $(prefix) .PHONY: all clean dist install diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..3f24db8 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +python-checkpath (1.1.0) experimental; urgency=low + + * Debianization! + + -- Mark Wooding Thu, 13 Oct 2005 17:32:44 +0100 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..caea4c0 --- /dev/null +++ b/debian/control @@ -0,0 +1,47 @@ +Source: python-checkpath +Section: libs +Priority: extra +Build-Depends: + python, python2.3, python2.3-pyrex, python2.4, python2.4-pyrex, + libcheckpath-dev, mlib-dev +Maintainer: Mark Wooding +Standards-Version: 3.1.1 + +Package: python-checkpath +Architecture: all +Depends: ${python:Depends} +Description: Checks paths for security + Walks a pathname, checking every symlink and directory on the way, + and issuing alerts if any element is writable by someone other than + the calling uid or root. Useful if you're paranoid. This package + just contains the shared library. If you want to write programs which + use this library, you need libcheckpath-dev. + . + This is a dummy package to install the correct bindings for the default + Debian verison of Python. + +Package: python2.3-checkpath +Architecture: any +Depends: ${shlibs:Depends}, ${python:Depends} +Description: Checks paths for security + Walks a pathname, checking every symlink and directory on the way, + and issuing alerts if any element is writable by someone other than + the calling uid or root. Useful if you're paranoid. This package + just contains the shared library. If you want to write programs which + use this library, you need libcheckpath-dev. + . + This package contains a Python binding for the library for Python version + 2.3. + +Package: python2.4-checkpath +Architecture: any +Depends: ${shlibs:Depends}, ${python:Depends} +Description: Checks paths for security + Walks a pathname, checking every symlink and directory on the way, + and issuing alerts if any element is writable by someone other than + the calling uid or root. Useful if you're paranoid. This package + just contains the shared library. If you want to write programs which + use this library, you need libcheckpath-dev. + . + This package contains a Python binding for the library for Python version + 2.4. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..a21ab13 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,16 @@ +chkpath-python is copyright (c) 2003 Straylight/Edgeware. + +chkpath-python is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +chkpath-python is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have a copy of the GNU General Public License in +/usr/share/common-licenses/GPL; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..4eda6a0 --- /dev/null +++ b/debian/rules @@ -0,0 +1,63 @@ +#! /usr/bin/make -f + +export DH_COMPAT = 4 + +DEFVERSION = 2.3 +VERSIONS = $(DEFVERSION) 2.4 + +build: build-stamp + +build-stamp: + for v in $(VERSIONS); do python$$v setup.py build; done + touch build-stamp + +clean: + dh_clean + make clean + rm -rf build build-stamp + +install: build + dh_clean + for v in $(VERSIONS); do \ + python$$v setup.py build; \ + python$$v setup.py install --root=debian/python$$v-checkpath; \ + done + mkdir -p debian/python-checkpath + +binary-indep: install + dh_testdir -i + dh_testroot -i + dh_compress -i + dh_installdocs -i + dh_python -i + dh_gencontrol -i + dh_fixperms -i + dh_installdeb -i + dh_md5sums -i + dh_builddeb -i + +binary-arch: install + dh_testdir -a + dh_testroot -a + dh_compress -a + dh_installdocs -a + dh_strip -a + dh_shlibdeps -a + dh_python -a + dh_gencontrol -a + dh_fixperms -a + dh_installdeb -a + dh_md5sums -a + dh_builddeb -a + +binary: binary-indep binary-arch + +source: + rm -rf dist/*.tar.gz dist/=deb= + python setup.py sdist + mkdir dist/=deb= + cd dist/=deb=; tar xvfz ../*.tar.gz + d=`pwd`; cd ..; dpkg-source -i -i'/\.svn/' -b $$d/dist/=deb=/* + rm -rf dist/=deb= + +.PHONY: binary binary-arch binary-indep clean install source build diff --git a/setup.py b/setup.py index 5ae8c34..2100e81 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,7 @@ #! /usr/bin/python from distutils.core import setup, Extension +from Pyrex.Distutils import build_ext from os import * from errno import * @@ -40,28 +41,17 @@ def uniquify(l): libconfig('mLib', '2.0.3') libconfig('checkpath', '1.1.0') -class SubprocessFailure (Exception): - def __init__(me, file, rc): - me.args = (file, rc) - me.file = file - me.rc = rc - def __str__(me): - if WIFEXITED(me.rc): - return '%s failed (rc = %d)' % (me.file, WEXITSTATUS(me.rc)) - elif WIFSIGNALED(me.rc): - return '%s died (signal %d)' % (me.file, WTERMSIG(me.rc)) - else: - return '%s died inexplicably' % (me.file) - chk = Extension('checkpath', - ['checkpath.c'], + ['checkpath.pyx'], + ##extra_compile_args = ['-O0'], include_dirs = uniquify(incdirs), library_dirs = uniquify(libdirs), libraries = uniquify(libs)) -setup(name = 'CheckPath', +setup(name = 'checkpath-python', version = '1.1.0', description = 'Checking paths for security', author = 'Straylight/Edgeware', - author_email = 'mdw@nsict.org', + author_email = 'mdw@distorted.org.uk', license = 'GNU General Public License', - ext_modules = [chk]) + ext_modules = [chk], + cmdclass = {'build_ext': build_ext}) -- 2.11.0