summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2008-05-30 14:21:45 -0400
committerRob Crittenden <rcritten@redhat.com>2008-06-03 22:39:28 -0400
commitc90f454dc3f7a5f32c06774516e8099b8b664c63 (patch)
treee589cc4707ad883f1c58e524b2bd93f8a621240c
parentd63df28755a72a3264bc6a99374eee0878551f22 (diff)
downloadfreeipa-c90f454dc3f7a5f32c06774516e8099b8b664c63.tar.gz
freeipa-c90f454dc3f7a5f32c06774516e8099b8b664c63.tar.xz
freeipa-c90f454dc3f7a5f32c06774516e8099b8b664c63.zip
Move version.py to the common ipa directory instead of being server-based so it can be used by the client tool.
Fix the client tool imports to fail more gracefully.
-rw-r--r--Makefile6
-rw-r--r--ipa-client/ipa-install/ipa-client-install44
-rw-r--r--ipa-python/Makefile2
-rw-r--r--ipa-python/version.py.in (renamed from ipa-server/ipaserver/version.py.in)2
-rw-r--r--ipa-server/ipa-install/ipa-server-install2
-rw-r--r--ipa-server/ipaserver/Makefile.am1
-rw-r--r--ipa-server/xmlrpc-server/funcs.py6
7 files changed, 37 insertions, 26 deletions
diff --git a/Makefile b/Makefile
index 0a3d313e..67f7a9b0 100644
--- a/Makefile
+++ b/Makefile
@@ -104,9 +104,9 @@ version-update:
> ipa-server/selinux/ipa-server-selinux.spec
sed s/VERSION/$(IPA_VERSION)/ ipa-python/setup.py.in \
> ipa-python/setup.py
- sed s/__VERSION__/$(IPA_VERSION)/ ipa-server/ipaserver/version.py.in \
- > ipa-server/ipaserver/version.py
- perl -pi -e "s:__NUM_VERSION__:$(IPA_VERSION_MAJOR)$(IPA_VERSION_MINOR)$(IPA_VERSION_RELEASE):" ipa-server/ipaserver/version.py
+ sed s/__VERSION__/$(IPA_VERSION)/ ipa-python/version.py.in \
+ > ipa-python/version.py
+ perl -pi -e "s:__NUM_VERSION__:$(IPA_VERSION_MAJOR)$(IPA_VERSION_MINOR)$(IPA_VERSION_RELEASE):" ipa-python/version.py
archive:
-mkdir -p dist
diff --git a/ipa-client/ipa-install/ipa-client-install b/ipa-client/ipa-install/ipa-client-install
index 2151e2da..ecdf9274 100644
--- a/ipa-client/ipa-install/ipa-client-install
+++ b/ipa-client/ipa-install/ipa-client-install
@@ -19,10 +19,32 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-VERSION = "%prog .1"
+try:
+ import sys
+
+ import os
+ import krbV
+ import socket
+ import logging
+ from optparse import OptionParser
+ import ipaclient.ipadiscovery
+ import ipaclient.ipachangeconf
+ import ipaclient.ntpconf
+ from ipa.ipautil import run
+ from ipa import sysrestore
+ from ipa import version
+except ImportError:
+ print >> sys.stderr, """\
+There was a problem importing one of the required Python modules. The
+error was:
+
+ %s
+""" % sys.exc_value
+ sys.exit(1)
+
def parse_options():
- parser = OptionParser(version=VERSION)
+ parser = OptionParser(version=version.VERSION)
parser.add_option("--domain", dest="domain", help="domain name")
parser.add_option("--server", dest="server", help="IPA server")
parser.add_option("--realm", dest="realm_name", help="realm name")
@@ -371,19 +393,9 @@ def main():
return 0
try:
- import sys
-
- import os
- import krbV
- import socket
- import logging
- from optparse import OptionParser
- import ipaclient.ipadiscovery
- import ipaclient.ipachangeconf
- import ipaclient.ntpconf
- from ipa.ipautil import run
- from ipa import sysrestore
-
- sys.exit(main())
+ if __name__ == "__main__":
+ sys.exit(main())
+except SystemExit, e:
+ sys.exit(e)
except KeyboardInterrupt:
sys.exit(1)
diff --git a/ipa-python/Makefile b/ipa-python/Makefile
index e279286c..13160457 100644
--- a/ipa-python/Makefile
+++ b/ipa-python/Makefile
@@ -13,7 +13,7 @@ install:
fi
clean:
- rm -f *~ *.pyc setup.py ipa-python.spec
+ rm -f *~ *.pyc setup.py ipa-python.spec version.py
distclean: clean
diff --git a/ipa-server/ipaserver/version.py.in b/ipa-python/version.py.in
index b0b53f44..fdb689f0 100644
--- a/ipa-server/ipaserver/version.py.in
+++ b/ipa-python/version.py.in
@@ -22,4 +22,4 @@ VERSION="__VERSION__"
# Just the numeric portion of the version so one can do direct numeric
# comparisons to see if the API is compatible.
-NUM_VERSION="__NUM_VERSION__"
+NUM_VERSION=__NUM_VERSION__
diff --git a/ipa-server/ipa-install/ipa-server-install b/ipa-server/ipa-install/ipa-server-install
index efee04b5..c3243e13 100644
--- a/ipa-server/ipa-install/ipa-server-install
+++ b/ipa-server/ipa-install/ipa-server-install
@@ -44,7 +44,7 @@ import ipaserver.httpinstance
import ipaserver.ntpinstance
from ipaserver import service
-from ipaserver import version
+from ipa import version
from ipaserver.installutils import *
from ipa import sysrestore
diff --git a/ipa-server/ipaserver/Makefile.am b/ipa-server/ipaserver/Makefile.am
index e124f6b8..13029e14 100644
--- a/ipa-server/ipaserver/Makefile.am
+++ b/ipa-server/ipaserver/Makefile.am
@@ -13,7 +13,6 @@ app_PYTHON = \
installutils.py \
replication.py \
certs.py \
- version.py \
$(NULL)
EXTRA_DIST = \
diff --git a/ipa-server/xmlrpc-server/funcs.py b/ipa-server/xmlrpc-server/funcs.py
index 08d351e3..267b0060 100644
--- a/ipa-server/xmlrpc-server/funcs.py
+++ b/ipa-server/xmlrpc-server/funcs.py
@@ -26,7 +26,7 @@ import ipaserver.dsinstance
import ipaserver.ipaldap
import copy
from ipaserver import attrs
-from ipaserver import version
+from ipa import version
from ipa import ipaerror
from ipa import ipautil
from urllib import quote,unquote
@@ -386,8 +386,8 @@ class IPAServer:
# Higher-level API
def version(self, opts=None):
"""The version of IPA"""
- logging.debug("IPA: version %d" % ipaserver.version.NUM_VERSION)
- return ipaserver.version.NUM_VERSION
+ logging.debug("IPA: version %d" % version.NUM_VERSION)
+ return version.NUM_VERSION
def get_aci_entry(self, sattrs, opts=None):
"""Returns the entry containing access control ACIs."""