summaryrefslogtreecommitdiff
path: root/src/config.py
diff options
context:
space:
mode:
authorlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-09-07 23:36:57 +0000
committerlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-09-07 23:36:57 +0000
commitf8ab739a36f7599f4f84590694c02ff3e0f2dd71 (patch)
tree87ec4c833900da6f9c95b9a135be761de9d98e36 /src/config.py
parent7d7f585ed6640d73de9cfcfbe84a56e2ec4d6a5f (diff)
downloadpoezio-f8ab739a36f7599f4f84590694c02ff3e0f2dd71.tar.gz
poezio-f8ab739a36f7599f4f84590694c02ff3e0f2dd71.tar.bz2
poezio-f8ab739a36f7599f4f84590694c02ff3e0f2dd71.tar.xz
poezio-f8ab739a36f7599f4f84590694c02ff3e0f2dd71.zip
do not require argparse anymore, chmod in the directory in the python process directly, fix a little bit the Mafile
Diffstat (limited to 'src/config.py')
-rw-r--r--src/config.py20
1 files changed, 6 insertions, 14 deletions
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