If a plugin uses an argument that conflicts with osc's global args,
osc fails with argparse.ArgumentError.
The exception is now caught and reported as a warning,
while the conflicting argument is skipped.
Cmdln.py is unmaintained for years and uses deprecated optparse.
Let's replace it with a simpler custom code. Also remove code
that generates man page, we'll replace it with a 3rd party tool.
add new regex and check for missing arguments.
The error message in python3 differs from the one in python2.
python3:
do_api() missing 1 required positional argument: 'url'
python2:
do_api() takes exactly 4 arguments (3 given)
To be compatible with python2 two checks are needed.
There are many places can't be covered by 2to3, especially the
str/unicode -> str/bytes change done in python3. This is a big patch
incorporating all changes made in order to make python3 suite.py run
without any single failure.
It
* adapt the introspect_handler_3 for case there are no __defaults__
* adds the ET_ENCODING variable for ET.fromstring ("unicode" in py3,
"utf-8" in py2)
* (re)adds various builtins to both python versions
- memoryview to python 2.6
- bytes compatible with py3 to 2.6 and 2.7
and it changes few parts of tests/common.py in order to be compatible
with python3
* new urlcompare method compares all components or url + parsed query
string in a dictionary, so the ordering, neither quoting does not matter
* bytes builtin has been added to 2.x and used in assertEqualMultiline
raw_input has been removed and equals to input in py3. Unfortunatelly no
__future__ statement exists for that. Ensure all modules uses
osc.core.raw_input except osc.cmdln, where there is NameError way
implemented.
The most visible change in python3 - removal of print statement and all
the crufty
print >> sys.stderr, foo,
The from __future__ import print_function makes it available in python
2.6
this patch
1.) removes the iteritems/itervalues, which were dropped in py3
items/values are used instead
2.) add an extra list() in a cases the list-based access is needed
(included appending, indexing and so)
3.) changes a sorting idiom in few places
instead of
foo = dict.keys()
foo.sort()
for i in foo:
there is a recommended
for i in sorted(dict.keys()):
4.) in one occassion it removes a if dict.has_key() by simpler
dict.get(key, default)
Revert a part of b3c5204, the do_main has to have at least one
argument, unless following exception will appear
osc.cmdln.CmdlnError: incorrect argcount for do_man(): takes 1, must
take 2 for 'argv' signature or 3+ for 'opts' signature
Signed-off-by: Petr Uzel <puzel@suse.cz>
Signed-off-by: Michal Vyskocil <mvyskocil@suse.cz>
Fixed serveral warnings from pychecker.py like such:
- Parameter ($) not used
- Local variable ($) not used
Including fixes like:
- remove not needed imports
- don't read apiurl in core.py from config if already available via
function parameter
- delPerson(): check for user as e.g. in addPerson()
* obsolete deletepac and deleteprj to delete and rdelete commands.
- enable package tracking by default
* add support to hide commands in help list (so we can show propper
help when people still try to use it).
seife: this is for you, drop your own scripts emulating it :)