From: Florian BRUNET Date: Fri, 20 Mar 2015 16:20:53 +0000 (+0100) Subject: Rollback from the argparse to the optparse python module of the commit a4f1d4d818127b... X-Git-Tag: V7_6_0a1~8 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=394abf3c82191e3db4996bbe5ba5f13c29167600;p=modules%2Fkernel.git Rollback from the argparse to the optparse python module of the commit a4f1d4d818127b769abf1887ef011eb85da7cbd4 for compatibility reason with python 2.6. --- diff --git a/bin/appli_gen.py b/bin/appli_gen.py index ffb36a7f8..bef44c864 100644 --- a/bin/appli_gen.py +++ b/bin/appli_gen.py @@ -32,12 +32,12 @@ Typical use with options is: python %(prog)s --verbose --prefix= --config= """ -import argparse import os import sys import shutil import virtual_salome import xml.sax +import optparse # --- names of tags in XML configuration file appli_tag = "application" @@ -331,19 +331,18 @@ MMGT_REENTRANT=1 os.chmod(users_dir, 0777) def main(): - parser = argparse.ArgumentParser(usage=usage) + parser = optparse.OptionParser(usage=usage) - parser.add_argument('--prefix', default='.', metavar="", - help="Installation directory (default %(default)s)") + parser.add_option('--prefix', dest="prefix", default='.', + help="Installation directory (default .)") - parser.add_argument('--config', default='config_appli.xml', - metavar="", - help="XML configuration file (default %(default)s)") + parser.add_option('--config', dest="config", default='config_appli.xml', + help="XML configuration file (default config_appli.xml)") - parser.add_argument('-v', '--verbose', action='count', + parser.add_option('-v', '--verbose', action='count', dest='verbose', default=0, help="Increase verbosity") - options = parser.parse_args() + options, args = parser.parse_args() if not os.path.exists(options.config): print "ERROR: config file %s does not exist. It is mandatory." % options.config sys.exit(1)