diff options
author | Rob Crittenden <rcritten@redhat.com> | 2008-05-30 14:21:45 -0400 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2008-06-03 22:39:11 -0400 |
commit | c58b7a3d7c32147fd8e72de4254bb35191fedc4b (patch) | |
tree | 05da08528749094618691cd4f1d36e89e753c594 | |
parent | 5a56b7c885dc2cdf057c022ad0b4357fcdba5388 (diff) | |
download | freeipa-c58b7a3d7c32147fd8e72de4254bb35191fedc4b.tar.gz freeipa-c58b7a3d7c32147fd8e72de4254bb35191fedc4b.tar.xz freeipa-c58b7a3d7c32147fd8e72de4254bb35191fedc4b.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-- | Makefile | 6 | ||||
-rw-r--r-- | ipa-client/ipa-install/ipa-client-install | 44 | ||||
-rw-r--r-- | ipa-python/Makefile | 2 | ||||
-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-install | 2 | ||||
-rw-r--r-- | ipa-server/ipaserver/Makefile.am | 1 | ||||
-rw-r--r-- | ipa-server/xmlrpc-server/funcs.py | 6 |
7 files changed, 37 insertions, 26 deletions
@@ -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.""" |