summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2012-08-05 01:50:05 +0200
committermathieui <mathieui@mathieui.net>2012-08-05 01:50:05 +0200
commitd723cec5ebac28497c14f24707bcc90d7541a0f1 (patch)
tree47d591e1e88dae139c7aec93fe3408b6a78dfb38
parent7826511abb65408cc37d86f826b6f41125750ab6 (diff)
downloadpoezio-d723cec5ebac28497c14f24707bcc90d7541a0f1.tar.gz
poezio-d723cec5ebac28497c14f24707bcc90d7541a0f1.tar.bz2
poezio-d723cec5ebac28497c14f24707bcc90d7541a0f1.tar.xz
poezio-d723cec5ebac28497c14f24707bcc90d7541a0f1.zip
Move from optparse (deprecated) to argparse
-rw-r--r--src/config.py14
1 files 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)