From 9a56175919a48844a35a014fee5b4d7b90895b29 Mon Sep 17 00:00:00 2001 From: Michael Spang Date: Thu, 13 Dec 2007 02:48:05 -0500 Subject: [PATCH] Reorganize build process Now using Python's distutils for installing the Python modules into the wrong place and python-support for moving them into the right place, byte-compiling, and all that jazz. --- bin/ceo | 2 +- bin/ceoquery | 2 +- bin/csc-chfn | 2 +- bin/csc-chsh | 2 +- debian/.gitignore | 1 + debian/compat | 2 +- debian/control | 4 ++-- debian/dirs | 3 +++ debian/docs | 1 + debian/install | 2 ++ debian/rules | 28 ++++++++-------------------- {misc => etc}/csc.schema | 0 setup.py | 12 ++++++++++++ src/Makefile | 8 ++++++++ 14 files changed, 42 insertions(+), 27 deletions(-) create mode 100644 debian/dirs create mode 100644 debian/docs create mode 100644 debian/install rename {misc => etc}/csc.schema (100%) create mode 100755 setup.py diff --git a/bin/ceo b/bin/ceo index 74d60fb2b..fd6a1139e 100755 --- a/bin/ceo +++ b/bin/ceo @@ -1,3 +1,3 @@ -#!/usr/bin/python2.4 -- +#!/usr/bin/python import csc.apps.urwid.main csc.apps.urwid.main.start() diff --git a/bin/ceoquery b/bin/ceoquery index e16c0e44d..046c25f83 100755 --- a/bin/ceoquery +++ b/bin/ceoquery @@ -1,4 +1,4 @@ -#!/usr/bin/python2.4 -- +#!/usr/bin/python """ ceoquery - a script to lookup member and account information """ diff --git a/bin/csc-chfn b/bin/csc-chfn index cf97c4d06..70fff1c1f 100755 --- a/bin/csc-chfn +++ b/bin/csc-chfn @@ -1,4 +1,4 @@ -#!/usr/bin/python2.4 -- +#!/usr/bin/python """ chfn - change real user name and information diff --git a/bin/csc-chsh b/bin/csc-chsh index e8b1970a2..5d18e2a56 100755 --- a/bin/csc-chsh +++ b/bin/csc-chsh @@ -1,4 +1,4 @@ -#!/usr/bin/python2.4 -- +#!/usr/bin/python """ chsh - change login shell diff --git a/debian/.gitignore b/debian/.gitignore index 7d605ca7f..c5d55af83 100644 --- a/debian/.gitignore +++ b/debian/.gitignore @@ -1,3 +1,4 @@ /ceo.substvars /ceo /files +/*.debhelper diff --git a/debian/compat b/debian/compat index b8626c4cf..7ed6ff82d 100644 --- a/debian/compat +++ b/debian/compat @@ -1 +1 @@ -4 +5 diff --git a/debian/control b/debian/control index 7b143b517..4264027eb 100644 --- a/debian/control +++ b/debian/control @@ -2,12 +2,12 @@ Source: ceo Section: admin Priority: optional Maintainer: Michael Spang -Build-Depends: debhelper (>= 4.0.0) +Build-Depends: debhelper (>= 5.0.0), python-dev (>= 2.4), python-support (>= 0.3), libkrb5-dev, libldap2-dev, libsasl2-dev Standards-Version: 3.7.2 Package: ceo Architecture: any -Depends: python2.4, python-ldap, python-urwid, krb5-user, less, python-pam, ${shlibs:Depends} +Depends: python-ldap, python-urwid, python-pam, ${python:Depends}, ${shlibs:Depends} Recommends: quota Description: Computer Science Club Administrative Utilities This package contains the CSC Electronic Office diff --git a/debian/dirs b/debian/dirs new file mode 100644 index 000000000..281c9b5c9 --- /dev/null +++ b/debian/dirs @@ -0,0 +1,3 @@ +usr/bin +etc/csc +etc/ldap/schema diff --git a/debian/docs b/debian/docs new file mode 100644 index 000000000..a188e0692 --- /dev/null +++ b/debian/docs @@ -0,0 +1 @@ +docs/* diff --git a/debian/install b/debian/install new file mode 100644 index 000000000..8be22ff9a --- /dev/null +++ b/debian/install @@ -0,0 +1,2 @@ +etc/accounts.cf etc/kerberos.cf etc/ldap.cf etc/csc +etc/csc.schema etc/ldap/schema diff --git a/debian/rules b/debian/rules index b319fb6e1..1139fa091 100755 --- a/debian/rules +++ b/debian/rules @@ -1,48 +1,36 @@ #!/usr/bin/make -f -PYTHON := python2.4 - build: + python setup.py -q build cd src && make clean: dh_testdir dh_testroot dh_clean - rm -f build-stamp - rm -rf build/ - find pylib/ -name "*.pyc" -print0 | xargs -0 rm -f - cd src && make clean + $(MAKE) -C src clean + python setup.py -q clean -a install: build dh_testdir dh_testroot - - dh_installdirs etc/csc usr/lib/$(PYTHON)/site-packages usr/share/csc \ - usr/lib/csc usr/bin etc/ldap/schema - dh_install pylib/* usr/lib/$(PYTHON)/site-packages/ - dh_install etc/* etc/csc/ - - dh_install bin/ceo bin/ceoquery bin/csc-chsh bin/csc-chfn src/addmember src/addclub usr/bin/ - dh_install misc/csc.schema etc/ldap/schema/ + dh_installdirs + python setup.py -q install --no-compile -O0 --root=debian/ceo + $(MAKE) -C src DESTDIR=$(PWD)/debian/ceo PREFIX=/usr install binary-arch: build install dh_testdir dh_testroot dh_installchangelogs - dh_installdocs docs/* + dh_installdocs dh_installexamples dh_install -# dh_installlogrotate -# dh_installcron dh_installman dh_link dh_strip dh_compress dh_fixperms -# dh_perl -# dh_python -# dh_makeshlibs + dh_pysupport dh_installdeb dh_shlibdeps dh_gencontrol diff --git a/misc/csc.schema b/etc/csc.schema similarity index 100% rename from misc/csc.schema rename to etc/csc.schema diff --git a/setup.py b/setup.py new file mode 100755 index 000000000..e4729fd72 --- /dev/null +++ b/setup.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python + +from distutils.core import setup + +setup( + name='ceo', + description='CSC Electronic Office', + packages=[ 'csc', 'csc.common', 'csc.adm', 'csc.backends', 'csc.apps', 'csc.apps.urwid' ], + package_dir = {'': 'pylib'}, + scripts=['bin/ceo', 'bin/ceoquery', 'bin/csc-chfn', 'bin/csc-chsh'], +) + diff --git a/src/Makefile b/src/Makefile index ac13cd64f..840763d21 100644 --- a/src/Makefile +++ b/src/Makefile @@ -5,6 +5,9 @@ KADM := $(shell krb5-config --libs krb5 kadm-client) LIBCEO := util.o common.o config.o parser.o ldap.o krb5.o kadm.o addhomedir.o +DESTDIR := +PREFIX := /usr/local + all: addmember addclub clean: @@ -18,3 +21,8 @@ addclub: $(LIBCEO) addclub.o config-test: config-test.o parser.o util.o $(CC) $(LDFLAGS) $^ -o $@ + +install: addmember addclub + install -d $(DESTDIR)$(PREFIX)/bin + install addmember addclub $(DESTDIR)$(PREFIX)/bin +