File suse-specfile_python_single.patch of Package rpmdevtools
Index: rpmdevtools-8.10/spectemplate-python.spec
===================================================================
--- rpmdevtools-8.10.orig/spectemplate-python.spec
+++ rpmdevtools-8.10/spectemplate-python.spec
@@ -1,117 +1,59 @@
-# sitelib for noarch packages, sitearch for others (remove the unneeded one)
-%{!?__python2: %global __python2 %__python}
-%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
-%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
-
-%if 0%{?fedora}
-%bcond_without python3
-%else
-%bcond_with python3
-%endif
+#
+# spec file for package [spectemplate]
+#
+# Copyright (c) __YEAR__ SUSE LINUX GmbH, Nuernberg, Germany.
+#
+# All modifications and additions to the file contributed by third parties
+# remain the property of their copyright owners, unless otherwise agreed
+# upon. The license for this file, and modifications and additions to the
+# file, is the same license as for the pristine package itself (unless the
+# license for the pristine package is not an Open Source License, in which
+# case the license is the MIT License). An "Open Source License" is a
+# license that conforms to the Open Source Definition (Version 1.9)
+# published by the Open Source Initiative.
+# Please submit bugfixes or comments via http://bugs.opensuse.org/
+#
+
+
+%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name:
Version:
-Release: 1%{?dist}
+Release: 0
Summary:
-
-Group: Development/Languages
License:
-URL:
+Group: Development/Languages/Python
+Url:
Source0:
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-
-BuildArch:
-BuildRequires: python2-devel
-%if %{with python3}
-BuildRequires: python3-devel
-%endif # with python3
+BuildRequires: %{python_module devel}
+BuildRequires: python-rpm-macros
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+#BuildArch: noarch
+%python_subpackages
%description
-%if %{with python3}
-%package -n
-Summary:
-Group: Development/Languages
-
-%description -n
-
-%endif # with python3
-
-
%prep
-%setup -q -c
-mv %{name}-%{version} python2
-
-%if %{with python3}
-cp -a python2 python3
-%endif # with python3
-
+%setup -q
%build
-pushd python2
-# Remove CFLAGS=... for noarch packages (unneeded)
-CFLAGS="$RPM_OPT_FLAGS" %{__python2} setup.py build
-popd
-
-%if %{with python3}
-pushd python3
-# Remove CFLAGS=... for noarch packages (unneeded)
-CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build
-popd
-%endif # with python3
-
+# Remove export CFLAGS=... for noarch packages (unneeded)
+export CFLAGS="%{optflags}"
+%python_build
%install
-rm -rf $RPM_BUILD_ROOT
-# Must do the python3 install first because the scripts in /usr/bin are
-# overwritten with every setup.py install (and we want the python2 version
-# to be the default for now).
-%if %{with python3}
-pushd python3
-%{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
-popd
-%endif # with python3
-
-pushd python2
-%{__python2} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
-popd
-
+%python_install
%check
-pushd python2
-%{__python2} setup.py test
-popd
-
-%if %{with python3}
-pushd python3
-%{__python3} setup.py test
-popd
-%endif
-
-
-%clean
-rm -rf $RPM_BUILD_ROOT
+%python_expand $python setup.py test
-
-%files
-%{!?_licensedir:%global license %%doc}
-%license add-license-file-here
-%doc add-docs-here
+%files %{python_files}
+%defattr(-,root,root)
+%doc
# For noarch packages: sitelib
-%{python2_sitelib}/*
+%{python_sitelib}/*
# For arch-specific packages: sitearch
-%{python2_sitearch}/*
-
-%if %{with python3}
-%files -n
-%license add-license-file-here
-%doc add-docs-here
-# For noarch packages: sitelib
-%{python3_sitelib}/*
-# For arch-specific packages: sitearch
-%{python3_sitearch}/*
-%endif # with python3
-
+%{python_sitearch}/*
%changelog