# HG changeset patch # User Paul Boddie # Date 1444232549 -7200 # Node ID c64b593fa8535c1ab9d523516b38749fd9dddbbe # Parent 138f021c2e50716fc8a960f479f9b7516a8edac4 Added module path auto-configuration and a usage help string. diff -r 138f021c2e50 -r c64b593fa853 tools/make_freebusy.py --- a/tools/make_freebusy.py Wed Oct 07 17:40:11 2015 +0200 +++ b/tools/make_freebusy.py Wed Oct 07 17:42:29 2015 +0200 @@ -21,6 +21,18 @@ this program. If not, see . """ +from os.path import split +import sys + +# Find the modules. + +try: + import imiptools +except ImportError: + parent = split(split(__file__)[0])[0] + if split(parent)[1] == "imip-agent": + sys.path.append(parent) + from codecs import getwriter from imiptools.client import Client from imiptools.data import get_window_end, Object @@ -28,7 +40,6 @@ from imiptools.period import insert_period from imiptools.profile import Preferences from imip_store import FileStore, FilePublisher -import sys def make_freebusy(store, publisher, preferences, user, participant, store_and_publish, include_needs_action, reset_updated_list, verbose): @@ -161,12 +172,14 @@ user = participants[0] except IndexError: print >>sys.stderr, """\ +Usage: %s [ ] + Need a user and an optional participant (if different from the user), along with the -s option if updating the store and the published details. Specify -n to include objects with PARTSTAT of NEEDS-ACTION. Specify -r to inspect all objects, not just those expected to provide details. Specify -v for additional messages on standard error. - """ +""" % split(sys.argv[0])[1] sys.exit(1) # Define any other participant of interest plus options.