From d723cec5ebac28497c14f24707bcc90d7541a0f1 Mon Sep 17 00:00:00 2001 From: mathieui Date: Sun, 5 Aug 2012 01:50:05 +0200 Subject: Move from optparse (deprecated) to argparse --- src/config.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/config.py b/src/config.py index 742bd947..85fa55f6 100644 --- a/src/config.py +++ b/src/config.py @@ -15,7 +15,7 @@ DEFSECTION = "Poezio" from configparser import RawConfigParser, NoOptionError, NoSectionError from os import environ, makedirs, path from shutil import copy2 -from optparse import OptionParser +from argparse import ArgumentParser class Config(RawConfigParser): """ @@ -192,12 +192,12 @@ if not path.isfile(path.join(CONFIG_PATH, 'poezio.cfg')): copy2(path.join(path.dirname(__file__), '../data/default_config.cfg'), path.join(CONFIG_PATH, 'poezio.cfg')) firstrun = True -parser = OptionParser() -parser.add_option("-f", "--file", dest="filename", default=path.join(CONFIG_PATH, 'poezio.cfg'), - help="The config file you want to use", metavar="CONFIG_FILE") -parser.add_option("-d", "--debug", dest="debug", - help="The file where debug will be written", metavar="DEBUG_FILE") -(options, args) = parser.parse_args() +parser = ArgumentParser() +parser.add_argument("-f", "--file", dest="filename", default=path.join(CONFIG_PATH, 'poezio.cfg'), + help="The config file you want to use", metavar="CONFIG_FILE") +parser.add_argument("-d", "--debug", dest="debug", + help="The file where debug will be written", metavar="DEBUG_FILE") +options = parser.parse_args() config = Config(options.filename) if firstrun: config.set('firstrun', True) -- cgit v1.2.3