Fix optparse code.

Small difference from argparse. ;-)
This commit is contained in:
Merlijn Wajer 2013-05-10 11:13:07 +02:00
parent 4323e92a13
commit c3e35b9260
2 changed files with 4 additions and 5 deletions

View File

@ -23,7 +23,7 @@ parser.add_option('-c', '--config', type=str, action='append',
parser.add_option('-C', '--compat', action='store_true', parser.add_option('-C', '--compat', action='store_true',
help='Enable compatibility mode; for Python < 2.7') help='Enable compatibility mode; for Python < 2.7')
args = parser.parse_args() args, _ = parser.parse_args()
# Unpickle from stdin ; currently this is the default and only way # Unpickle from stdin ; currently this is the default and only way
f = pickle.Unpickler(sys.stdin) f = pickle.Unpickler(sys.stdin)
@ -31,9 +31,8 @@ f = pickle.Unpickler(sys.stdin)
conf = f.load() conf = f.load()
for path in args.config: for path in args.config:
if path: config = imp.load_source('', path).config
config = imp.load_source('', path).config conf.update(config)
conf.update(config)
m = KeyMapper(conf) m = KeyMapper(conf)

View File

@ -21,7 +21,7 @@ parser.add_option('-i', '--input-file', action='append',
parser.add_option('-C', '--compat', action='store_true', parser.add_option('-C', '--compat', action='store_true',
help='Enable compatibility mode; for Python < 2.7') help='Enable compatibility mode; for Python < 2.7')
args = parser.parse_args() args, _ = parser.parse_args()
if len(args.input_file) == 0: if len(args.input_file) == 0: