1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-09-21 17:56:19 +02:00
Commit Graph

53 Commits

Author SHA1 Message Date
f7af6329b5 argparse: Prefer sub-command options over global options 2022-09-30 09:57:34 +02:00
63f1471ef4 Do not traceback on conflicting argparse arguments
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.
2022-09-26 15:53:21 +02:00
4ee3df3bbc cmdln: Handle multiple signatures of do_* handlers 2022-09-20 10:00:45 +02:00
9d11493f33 cmdln: Order options and arguments by the order of decorators in the source code 2022-09-20 09:59:41 +02:00
b5491911ea Add global options to subcommands so they can be specified in any place 2022-08-26 16:23:48 +02:00
99937100df Allow intermixing positional and optional args 2022-08-26 16:11:16 +02:00
d2015d808b Do not crash when do_* handler has no docstring 2022-08-22 13:41:08 +02:00
be8a5268a8 Replace unmaintained cmdln.py with a custom code
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.
2022-08-12 10:05:59 +02:00
Anatoli Babenia
ce91a9ff5a Remove Python 2 code 2022-07-29 17:26:39 +03:00
feb53212dd Modernize code with pyupgrade
pyupgrade --keep-percent-format --py36-plus `find -name '*.py'`
2022-07-28 19:14:12 +02:00
cc0b8f1606 Never require login in the help command 2022-05-05 11:07:28 +02:00
Daniel Mach
473b0d4048
Merge pull request #329 from andrewshadura/master
Allow whitespace before ${cmd_name}.
2022-03-15 09:45:24 +01:00
lethliel
69b1233316 add regex for python3 missing arguments err
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.
2020-05-18 19:46:22 +02:00
lethliel
67560887db [python3] enable full python3 support for man 2018-12-13 13:33:51 +01:00
Andrew Shadura
ca8fe4273a
Allow whitespace before ${cmd_name}. 2017-09-02 13:30:37 +02:00
Bernhard M. Wiedemann
a472fcb522 Allow to override man-page date
to enable reproducible builds of osc packages
2017-06-17 17:40:42 +02:00
Florian Bergmann
8a70a0f285 Added readline support to cmdln-module.
This was already fixed in the original module:
https://github.com/trentm/cmdln/issues/1

Signed-off-by: Florian Bergmann <fbergmann@suse.de>
2015-01-09 13:33:31 +01:00
Marcus Huewe
b07a4d0b37 Merge branch 'w291' of https://github.com/berendt/osc
Conflicts:
	osc/build.py

Resolved merge conflict.
2014-08-14 17:24:28 +02:00
Christian Berendt
1751bdc47f Resolve PEP8 issue E231
* E231 missing whitespace after ':'
2014-08-13 17:30:12 +02:00
Christian Berendt
d35983d5b8 Resolve PEP8 issue W291
* W291 trailing whitespace
2014-08-12 15:01:16 +02:00
Danny Al-Gaaf
e1ea202802 cmdln.py: fix reimport of 're'
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-05-27 14:13:19 +02:00
Danny Al-Gaaf
b99a05e167 cmdln.py: remove some reimports of sys
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-05-27 14:07:04 +02:00
Danny Al-Gaaf
e6f8a1a7b3 cmdln.py: fix "More than one statement on a single line"
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-05-26 15:27:05 +02:00
Danny Al-Gaaf
f0a92430e8 cmdln.py: fix bad indentation
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-05-26 11:24:17 +02:00
Michal Vyskocil
1cd12ac566 python3 compatibility: fix a man page generation
Fixes a fail on a building of a documentation
http://lists.opensuse.org/opensuse-buildservice/2013-04/msg00099.html
2013-04-16 15:51:14 +02:00
Michal Vyskocil
b787ca2b39 python3 compatibility: make all unit test pass
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
2013-04-16 10:51:42 +02:00
Michal Vyskocil
5cc72902e0 python3 compatibility: raw_input
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.
2013-04-16 10:51:41 +02:00
Michal Vyskocil
7f2031558c python3 compatibility: print function
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
2013-04-16 10:51:41 +02:00
Michal Vyskocil
f814fe4af4 python3 compatibility: idioms
more idiomatic code - changes

  * type(foo) == bar to isinstance(foo, bar)
  * changes the uneeded .sort calls by sorted()
2013-04-16 10:51:18 +02:00
Michal Vyskocil
a134074417 python3 compatibility: funcattrs, methodattrs
the introspection names changed a lot in python3, so lets have two
implementations used by respective runtime
2013-04-16 10:51:17 +02:00
Michal Vyskocil
3a93ac6d10 python3 compatibility: except
changes 'except FooError, fe' to 'except FooError as fe'

available in python 2.6
2013-04-16 10:51:17 +02:00
Michal Vyskocil
d3648be24b python3 compatibility: dict
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)
2013-04-16 10:51:17 +02:00
Petr Uzel
197c10f661 Return argument to do_man back
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>
2010-12-22 13:29:52 +01:00
Michal Čihař
fa19a2436e One more case for dash escaping in man page. 2010-12-09 10:32:31 +01:00
Danny Kukawka
5a49daa69a fix warnings from pychecker
Fixed several warnings from pychecker as e.g.:
- (XY): shadows builtin
- Local variable (XY) not used
2010-08-20 14:34:41 +02:00
Danny Kukawka
b3c5204b59 fixed serveral warnings from pychecker.py
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()
2010-07-26 16:46:21 +02:00
Michal Čihař
70b3d34798 Another case of dash escaping. 2010-07-19 11:13:08 +02:00
Ludwig Nussel
32e99306b4 add vim mode lines to avoid evil tab characters :-) 2010-02-25 09:53:45 +01:00
Ludwig Nussel
c9e9730226 most help topics are capitalized 2010-01-12 15:11:42 +01:00
Michal Čihař
3492712952 Fix escaping of parameters separated by | in man page. 2009-12-10 13:55:27 +01:00
Pavol Rusnak
661d927d38 code cleanup 2009-10-20 14:30:15 +00:00
Michal Cihar
c40738b2ea Use non consuming expressions to allow escape more strings in one row. 2009-09-25 12:50:42 +00:00
Michal Cihar
eda5e9c38c Escape ' at the begining of the line as it is command marker for roff. 2009-09-25 11:19:02 +00:00
Michal Cihar
d6a8ac3fbb Better escaping regexps. 2009-06-23 10:09:48 +00:00
Michal Cihar
a574dbb3aa Add proper escaping of - in man page. 2009-06-17 09:28:10 +00:00
Michal Cihar
e5563bcaa4 Move osc specific bits to commandline module. 2009-05-06 13:20:15 +00:00
Michal Cihar
a30a1d595b Add support for generating a man page. 2009-05-06 11:46:17 +00:00
Michal Cihar
aedeea317c Drop shebang line from modules (bnc#500971).
(Some did have it and some did not, this way it is consistent and they
are anyway not supposed to be executed directly.)
2009-05-05 14:11:25 +00:00
3df88ab765 Consolidating delete commands:
* 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 :)
2009-05-04 19:07:05 +00:00
Marcus Hüwe
6ddace8c97 - fixed #426612
- other fixes for python26
2008-09-21 14:44:20 +00:00