#399 Move argparse fix from fedpkg
Merged 6 years ago by onosek. Opened 6 years ago by onosek.
onosek/rpkg move_argparse_fix  into  master

file modified
+8
@@ -2378,6 +2378,14 @@ 

          # Parse the args

          self.args = self.parser.parse_args()

  

+         # This is due to a difference argparse behavior to Python 2 version.

+         # In Python 3, argparse will proceed to here without reporting

+         # "too few arguments". Instead, self.args does not have attribute

+         # command.

+         if not hasattr(self.args, 'command'):

+             self.parser.print_help()

+             sys.exit(1)

+ 

          if self.args.module_name and self.args.repo_name:

              self.parser.error(

                  'argument --name: not allowed with --module-name')

The fix is valid also for rhpkg and moving it to rpkg will prevent code
duplication.

Fixes: #398

Signed-off-by: Ondrej Nosek onosek@redhat.com

rebased onto fb15797

6 years ago

Pull-Request has been merged by onosek

6 years ago