From f8ab739a36f7599f4f84590694c02ff3e0f2dd71 Mon Sep 17 00:00:00 2001 From: "louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13" Date: Tue, 7 Sep 2010 23:36:57 +0000 Subject: do not require argparse anymore, chmod in the directory in the python process directly, fix a little bit the Mafile --- src/config.py | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'src/config.py') diff --git a/src/config.py b/src/config.py index 3756ef56..b13c3148 100644 --- a/src/config.py +++ b/src/config.py @@ -23,11 +23,7 @@ from/to the config file from configparser import RawConfigParser, NoOptionError from os import environ, makedirs, path from shutil import copy2 -try: - import argparse - HAVE_ARGPARSE = True -except ImportError: - HAVE_ARGPARSE = False +from optparse import OptionParser class Config(RawConfigParser): """ @@ -139,15 +135,11 @@ except OSError: if not path.isfile(CONFIG_PATH+'poezio.cfg'): copy2('../data/default_config.cfg', CONFIG_PATH+'poezio.cfg') -if HAVE_ARGPARSE: - parser = argparse.ArgumentParser(prog="poezio", description='An XMPP ncurses client.') - parser.add_argument('-f', '--file', default=CONFIG_PATH+'poezio.cfg', help='the config file you want to use', metavar="FILE") - args = parser.parse_args() - filename = args.file -else: - filename = CONFIG_PATH+'poezio.cfg' - -config = Config(filename) +parser = OptionParser() +parser.add_option("-f", "--file", dest="filename", default=CONFIG_PATH+'poezio.cfg', + help="the config file you want to use", metavar="CONFIG_FILE") +(options, args) = parser.parse_args() +config = Config(options.filename) if __name__ == '__main__': # tests -- cgit v1.2.3