From 5920bed5a71e80b9d0719a54b331f6d708f66e7f Mon Sep 17 00:00:00 2001 From: Fredrik Wahlberg Date: Wed, 28 Jan 2004 21:40:27 +0000 Subject: [PATCH] Added check for optparse module, if not we install the Optik package. --- installer/check_modules.py | 28 +++++++++++++++++++++++----- installer/install.sh | 12 +++++++++++- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/installer/check_modules.py b/installer/check_modules.py index 1c75fe9..91c50f8 100755 --- a/installer/check_modules.py +++ b/installer/check_modules.py @@ -1,10 +1,28 @@ #!/usr/bin/env python +# Checks with python if a module is installed import sys -try: - import dns - has = 1 -except: - has = 0 + +module = sys.argv[1] + +if module == 'dns': + try: + import dns + has = 1 + except: + has = 0 + + +if module == 'optparse': + try: + from optparse import OptionParser + has = 1 + except: + try: + from optik import OptionParser + has = 1 + except: + has = 0 + if has == 1: sys.exit(0) diff --git a/installer/install.sh b/installer/install.sh index 31651fa..90f316a 100644 --- a/installer/install.sh +++ b/installer/install.sh @@ -1,8 +1,9 @@ #!/bin/sh DNSPYTHON_VER=1.2.0 +OPTIK_VER=1.4.1 # Do we have the dns modules?? -./check_dnsmod.py +./check_modules.py dns if [ "$?" == "1" ]; then DNSPYTHON=dnspython-$DNSPYTHON_VER tar zxf $DNSPYTHON.tar.gz @@ -11,6 +12,15 @@ if [ "$?" == "1" ]; then cd .. fi +./check_modules.py optparse +if [ "$?" == "1" ]; then + OPTIK=dnspython-$OPTIK_VER + tar zxf $OPTIK.tar.gz + cd $OPTIK + python setup.py install + cd .. +fi + # Copy the manpages cp ../dnsupdate.1 /usr/share/man/man1 gzip /usr/share/man/man1/dnsupdate.1