When fedpkg migrates to Python 3, just add allow_abbrev = False to ArgumentParser params; the rest of added code became redundant
fedpkg
allow_abbrev = False
ArgumentParser
Signed-off-by: Jiri Kucera jkucera@redhat.com
Can you give a use case of "invalid treatment of --user as --user-config"?
I described it in https://bugzilla.redhat.com/show_bug.cgi?id=1546781. I apologize I not include the link before. In a nutshell, when you run $ fedpkg --user johndoe clone lua, then "johndoe" became a value of args.user_config in fedpkg/__main__.py:54 (its value should be default, which is actually ~/.config/rpkg/fedpkg.conf).
$ fedpkg --user johndoe clone lua
"johndoe"
args.user_config
fedpkg/__main__.py:54
~/.config/rpkg/fedpkg.conf
Hi @jkucera
It would be good to move your patch to rpkg. Would you mind to open a PR in rpkg? But, I can do it for you as well.
There are some code style errors detected by Jenkins job. Can you also fix them?
This should be the only difference introduced in Python 3's argparse, right? Whatever it is or not the only one, can you comment it out to hightligh this key difference? I think anyone, who maintains these code or just reads through the code, should be helpful to understand the solution this patch introduced.
My understand of lines from 91 to 96 is to ensure customized ArgumentParser above should be used in Python 2, and the argparse.ArgumentParser should be used in Python 3. Am I right?
If this is the problem these lines to solve, how about replace try-except with a if-else, like this
if six.PY2: ArgumentParser = _ArgumentParser else: ArgumentParser = argparse.ArgumentParser parser = ArgumentParser(**ap_opts)
This should be more straightforward to tell what problem to solve.
Just need to move the custom ArgumentParser.
rebased onto c24dff65e61559cef03feb8a97332ef596b45fb5
PR updated, flake8 errors fixed.
It would be good to move your patch to rpkg. Would you mind to open a PR in rpkg? But, I can do it for you as well. Just need to move the custom ArgumentParser.
This is great idea, I will do it. Once the updated rpkg will be ready, we can import custom ArgumentParser from rpkg (I will make a new PR or update this).
Update: rpkg PR: https://pagure.io/rpkg/pull-request/305
https://pagure.io/rpkg/pull-request/305 is merged. Can this be closed?
rebased onto 1b2c9cb3c0c1b438273d6eab5154a1ec0eb05b84
rebased onto 1110a35f3607de32dd946ff2b8c718ece575b61b
I sync with upstream and update my PR so the custom ArgumentParser is used also in fedpkg/__main__.py. You can merge and/or close this PR if you find it ok.
fedpkg/__main__.py
@jkucera Thank you very much.
Commit 4c64b5bf fixes this pull-request
Pull-Request has been merged by cqi
When
fedpkgmigrates to Python 3, just addallow_abbrev = Falseto
ArgumentParserparams; the rest of added code became redundantSigned-off-by: Jiri Kucera jkucera@redhat.com