--- /dev/null
+From 38e41e474749a2b4ee3d16bf5bbb3fb19a1998a2 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
+Date: Thu, 17 Apr 2025 10:11:12 +0200
+Subject: [PATCH] Temporary hotfix for rhbz#2359689
+
+Reported upstream in https://github.com/kislyuk/argcomplete/issues/535
+
+Fedora RPM-packaged scripts using argcompelte all have Python shebangs.
+
+This checks if the interpreter is anything with python or pypy in it.
+
+Proper fix awaiting upstream response.
+---
+ argcomplete/bash_completion.d/_python-argcomplete | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/argcomplete/bash_completion.d/_python-argcomplete b/argcomplete/bash_completion.d/_python-argcomplete
+index 81c9d41..6520b93 100644
+--- a/argcomplete/bash_completion.d/_python-argcomplete
++++ b/argcomplete/bash_completion.d/_python-argcomplete
+@@ -193,7 +193,8 @@ _python_argcomplete_global() {
+ if (__python_argcomplete_scan_head_noerr "$SCRIPT_NAME" easy_install \
+ && "${interpreter[@]}" "$(__python_argcomplete_which python-argcomplete-check-easy-install-script)" "$SCRIPT_NAME") >/dev/null 2>&1; then
+ ARGCOMPLETE=1
+- elif __python_argcomplete_run "${interpreter[@]}" -m argcomplete._check_console_script "$SCRIPT_NAME"; then
++ elif ([[ "${interpreter[@]}" == *python* ]] || [[ "${interpreter[@]}" == *pypy* ]])\
++ && __python_argcomplete_run "${interpreter[@]}" -m argcomplete._check_console_script "$SCRIPT_NAME"; then
+ ARGCOMPLETE=1
+ fi
+ fi
+--
+2.49.0
+
--- /dev/null
+%global modname argcomplete
+
+%if 0%{?fedora} && 0%{?fedora} <= 42
+%global __python3 %{_bindir}/python3.13
+%global python3_pkgversion 3.13
+%endif
+%if 0%{?rhel} && 0%{?rhel} < 10
+%global __python3 %{_bindir}/python3.12
+%global python3_pkgversion 3.12
+%endif
+%if 0%{?suse_version} >= 1500
+%global __python3 %{_bindir}/python3.11
+%global python3_pkgversion 311
+%endif
+
+Name: python%{python3_pkgversion}-%{modname}
+Summary: Bash tab completion for argparse
+Version: 3.6.2
+Release: 1PGDG%{dist}
+License: Apache-2.0
+URL: https://github.com/kislyuk/%{modname}
+Source0: https://files.pythonhosted.org/packages/source/a/%{modname}/%{modname}-%{version}.tar.gz
+
+# Temporary hotfix for https://bugzilla.redhat.com/2359689
+# Reported upstream in https://github.com/kislyuk/argcomplete/issues/535
+Patch: hotfix-bz2359689.patch
+
+BuildRequires: python%{python3_pkgversion}-devel
+BuildArch: noarch
+
+%description
+Tab complete all the things!
+
+Argcomplete provides easy, extensible command line tab completion of
+arguments for your Python application.
+
+It makes two assumptions:
+
+ - You're using bash or zsh as your shell
+ - You're using argparse to manage your command line arguments/options
+
+Argcomplete is particularly useful if your program has lots of options
+or subparsers, and if your program can dynamically suggest completions
+for your argument/option values (for example, if the user is browsing
+resources over the network).}
+
+%prep
+%autosetup -p1 -n argcomplete-%{version}
+# Remove useless BRs (aka linters)
+sed -i -r -e '/test = /s/"(coverage|ruff|mypy)"[, ]*//g' pyproject.toml
+
+# https://github.com/kislyuk/argcomplete/issues/255
+# https://github.com/kislyuk/argcomplete/issues/256
+sed -i -e "1s|#!.*python.*|#!%{__python3}|" test/prog argcomplete/scripts/*
+sed -i -e "s|python |python3 |" test/test.py
+
+# Remove shebang from installed scripts
+sed -i '/^#!/d' argcomplete/scripts/*.py
+
+%generate_buildrequires
+%pyproject_buildrequires
+
+%build
+%pyproject_wheel
+
+%install
+%pyproject_install
+%{__rm} %{buildroot}%{_bindir}/*
+
+%files
+%license LICENSE.rst
+%doc README.rst
+%{python3_sitelib}/%{modname}-%{version}.dist-info/*
+%{python3_sitelib}/argcomplete/*.py*
+%{python3_sitelib}/argcomplete/__pycache__/*.py*
+%{python3_sitelib}/argcomplete/bash_completion.d/_python-argcomplete
+%{python3_sitelib}/argcomplete/packages/*.py*
+%{python3_sitelib}/argcomplete/packages/__pycache__/*.py*
+%{python3_sitelib}/argcomplete/py.typed
+%{python3_sitelib}/argcomplete/scripts/*.py*
+%{python3_sitelib}/argcomplete/scripts/__pycache__/*.py*
+
+%changelog
+* Mon May 19 2025 Devrim Gunduz <devrim@gunduz.org> - 3.6.2-1PGDG
+- Inıtial packaging for the PostgreSQL RPM repository to support Barman
+ on RHEL 9 and RHEL 8. Modified Fedora rawhide spec file.