public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Chenxiong Qi <cqi@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/fedpkg] 1.48-1: Backport: Fix argparse error in Python 3
Date: Mon, 10 Aug 2026 21:45:36 GMT [thread overview]
Message-ID: <178639833686.1.13270304114558123014.rpms-fedpkg-9c6511d602da@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : rpms/fedpkg
Branch : 1.48-1
Commit : 9c6511d602da36403b5b1374fa78802dc0a657ec
Author : Chenxiong Qi <cqi@redhat.com>
Date : 2018-05-22T20:29:22+08:00
Stats : +46/-2 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/fedpkg/c/9c6511d602da36403b5b1374fa78802dc0a657ec?branch=1.48-1
Log:
Backport: Fix argparse error in Python 3
Signed-off-by: Chenxiong Qi <cqi@redhat.com>
---
diff --git a/0001-Fix-argparse-error-in-Python-3.patch b/0001-Fix-argparse-error-in-Python-3.patch
new file mode 100644
index 0000000..8226cf1
--- /dev/null
+++ b/0001-Fix-argparse-error-in-Python-3.patch
@@ -0,0 +1,39 @@
+From 4ee70510c86469b2b1f910ad85844e7bce9b94a8 Mon Sep 17 00:00:00 2001
+From: Chenxiong Qi <cqi@redhat.com>
+Date: Mon, 21 May 2018 23:22:59 +0800
+Subject: [PATCH] Fix argparse error in Python 3
+
+argparse behaves differently in Python 2 and 3 when no options and
+arguments are passed to executable fedpkg. That causes no attribute
+named command is set to parsed namespace object in Python 3. Command
+line help message has to be output explicitly.
+
+Fixes #221
+
+Signed-off-by: Chenxiong Qi <cqi@redhat.com>
+---
+ fedpkg/__main__.py | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/fedpkg/__main__.py b/fedpkg/__main__.py
+index e12f255..c7ea14c 100644
+--- a/fedpkg/__main__.py
++++ b/fedpkg/__main__.py
+@@ -57,6 +57,14 @@ def main():
+ client.do_imports(site='fedpkg')
+ client.parse_cmdline()
+
++ # 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, client.args does not have attribute
++ # command.
++ if not hasattr(client.args, 'command'):
++ client.parser.print_help()
++ sys.exit(1)
++
+ if not client.args.path:
+ try:
+ client.args.path = pyrpkg.utils.getcwd()
+--
+2.14.3
+
diff --git a/fedpkg.spec b/fedpkg.spec
index f0ed754..166aad2 100644
--- a/fedpkg.spec
+++ b/fedpkg.spec
@@ -5,12 +5,13 @@
Name: fedpkg
Version: 1.33
-Release: 2%{?dist}
+Release: 3%{?dist}
Summary: Fedora utility for working with dist-git
License: GPLv2+
URL: https://pagure.io/fedpkg
Source0: https://pagure.io/releases/fedpkg/%{name}-%{version}.tar.bz2
+Patch0: 0001-Fix-argparse-error-in-Python-3.patch
BuildArch: noarch
@@ -102,6 +103,7 @@ Provides the fedpkg command for working with dist-git
%prep
%setup -q
+%patch0 -p1
%build
%py_build
@@ -147,8 +149,11 @@ nosetests
%changelog
+* Tue May 22 2018 Chenxiong Qi <cqi@redhat.com> 1.33-3
+- Backport: Fix argparse error in Python 3
+
* Mon May 21 2018 Chenxiong Qi <cqi@redhat.com> 1.33-2
-* Require python2-rpkg-1.54-2 as minimum version
+- Require python2-rpkg-1.54-2 as minimum version
* Mon May 14 2018 Chenxiong Qi <cqi@redhat.com> - 1.33-1
- Allow running tests against specified rpkg (cqi)
reply other threads:[~2026-08-10 21:45 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=178639833686.1.13270304114558123014.rpms-fedpkg-9c6511d602da@fedoraproject.org \
--to=cqi@redhat.com \
--cc=git-commits@fedoraproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox