add option to ingore unknown cmd line opts; bump version

This commit is contained in:
Tobias Oberstein 2014-07-26 17:20:47 +02:00
parent 43ee078ee6
commit 26a360a00c
2 changed files with 7 additions and 6 deletions

View file

@ -5,6 +5,7 @@
# #
# Copyright 2010 Jeff Schiller # Copyright 2010 Jeff Schiller
# Copyright 2010 Louis Simard # Copyright 2010 Louis Simard
# Copyright 2013-2014 Tavendo GmbH
# #
# This file is part of Scour, http://www.codedread.com/scour/ # This file is part of Scour, http://www.codedread.com/scour/
# #
@ -70,7 +71,7 @@ except ImportError:
pass pass
APP = 'scour' APP = 'scour'
VER = '0.28' VER = '0.29'
COPYRIGHT = 'Copyright Jeff Schiller, Louis Simard, 2010' COPYRIGHT = 'Copyright Jeff Schiller, Louis Simard, 2010'
NS = { 'SVG': 'http://www.w3.org/2000/svg', NS = { 'SVG': 'http://www.w3.org/2000/svg',
@ -3177,10 +3178,10 @@ def maybe_gziped_file(filename, mode="r"):
def parse_args(args=None): def parse_args(args=None, ignore_additional_args=False):
options, rargs = _options_parser.parse_args(args) options, rargs = _options_parser.parse_args(args)
if rargs: if rargs and not ignore_additional_args:
_options_parser.error("Additional arguments not handled: %r, see --help" % rargs) _options_parser.error("Additional arguments not handled: %r, see --help" % rargs)
if options.digits < 0: if options.digits < 0:
_options_parser.error("Can't have negative significant digits, see --help") _options_parser.error("Can't have negative significant digits, see --help")
@ -3227,7 +3228,7 @@ def generateDefaultOptions():
def __init__(self, **entries): def __init__(self, **entries):
self.__dict__.update(entries) self.__dict__.update(entries)
d = parse_args()[0].__dict__.copy() d = parse_args(ignore_additional_args = True)[0].__dict__.copy()
return Struct(**d) return Struct(**d)

View file

@ -1,6 +1,6 @@
############################################################################### ###############################################################################
## ##
## Copyright (C) 2013 Tavendo GmbH ## Copyright (C) 2013-2014 Tavendo GmbH
## ##
## Licensed under the Apache License, Version 2.0 (the "License"); ## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License. ## you may not use this file except in compliance with the License.
@ -32,7 +32,7 @@ Authors:
setup ( setup (
name = 'scour', name = 'scour',
version = '0.27', version = '0.29',
description = 'Scour SVG Optimizer', description = 'Scour SVG Optimizer',
# long_description = open("README.md").read(), # long_description = open("README.md").read(),
long_description = LONGDESC, long_description = LONGDESC,