#1 Only have one Python version
Closed 5 years ago by mtasaka. Opened 5 years ago by churchyard.
rpms/ churchyard/catfish py3  into  master

file modified
+46 -174
@@ -7,20 +7,11 @@ 

  %define		mainver		1.4.5

  %undefine		betaver		

  

- %define		fedoraver	1

- 

- %global	description_common \

- Catfish is a handy file searching tool. The interface is \

- intentionally lightweight and simple, using only GTK+3.\

- You can configure it to your needs by using several command line\

- options.\

- %{nil}

- 

- %global	support_python3		1

+ %define		fedoraver	2

  

  Name:		catfish

  Version:	%{mainver}

- Release:	%{?betaver:0.}%{fedoraver}%{?betaver:.%betaver}%{?dist}.2

+ Release:	%{?betaver:0.}%{fedoraver}%{?betaver:.%betaver}%{?dist}

  Summary:	A handy file search tool

  

  License:	GPLv2+
@@ -32,50 +23,6 @@ 

  BuildRequires:	gettext

  BuildRequires:	intltool

  

- %if 0%{?fedora} >= 28

- %package -n python2-%{name}

- Summary:        A handy file search tool using python 2

- %endif

- 

- BuildRequires:	python2-devel

- BuildRequires:	python2-distutils-extra

- BuildRequires:	python2-setuptools

- BuildRequires:	%{_bindir}/appstream-util

- 

- %BothRequires	pygobject3

- %BothRequires	python-pexpect

- 

- Requires:	%{name}-common = %{version}-%{release}

- Requires:	xdg-utils

- # search engine

- Requires:	%{_bindir}/locate

- # icon

- # Requires:	redhat-artwork

- 

- # Upstream rename

- Obsoletes:	search4files <= 0.2a

- Provides:	search4files = %{version}-%{release}

- # Obsolete old search engine subpackage

- Obsoletes:	catfish-engines <= 0.6

- 

- %if 0%{?fedora} >= 28

- %{?python_provide:%python_provide python2-%{name}}

- Obsoletes:	%{name} < %{version}-%{release}

- Provides:		%{name} = %{version}-%{release}

- 

- %description -n python2-%{name}

- %description_common

- 

- This package uses python 2 for runtime executable.

- %endif

- 

- %description

- %description_common

- 

- %if %support_python3

- %package	python3

- Summary:	A handy file search tool using python3

- 

  BuildRequires:	python3-devel

  BuildRequires:	python3-distutils-extra

  BuildRequires:	python3-setuptools
@@ -84,32 +31,29 @@ 

  %BothRequires	python3-gobject

  %BothRequires	python3-pexpect

  

- Requires:	%{name}-common = %{version}-%{release}

+ # Remove in Fedora 31:

+ Obsoletes:	python2-%{name} < 1.4.5-2

+ Obsoletes:	python-%{name} < 1.4.5-2

+ Obsoletes:	%{name}-python3 < 1.4.5-2

+ Obsoletes:	%{name}-common < 1.4.5-2

+ Provides:	%{name}-python3 = %{version}-%{release}

+ Provides:	%{name}-common = %{version}-%{release}

+ 

  Requires:	xdg-utils

  # search engine

  Requires:	%{_bindir}/locate

  # icon

  # Requires:	redhat-artwork

  

- %{?python_provide:%python_provide python3-%{name}}

- 

- %description	python3

- %description_common

- 

- This package uses python 3 for runtime executable.

- %endif

- 

- %package	common

- Group:	Applications/File

- Summary:	Common files for catfish

- 

- %description	common

- This package contains common files for catfish rpm.

+ %description

+ Catfish is a handy file searching tool. The interface is

+ intentionally lightweight and simple, using only GTK+3.

+ You can configure it to your needs by using several command line

+ options.

  

  

  %prep

- %setup -q -T -c -a 0 %{name}-%{mainver}%{?betaver}

- pushd %{name}-%{mainver}*

+ %setup -q -n %{name}-%{mainver}%{?betaver}

  

  # Fix up permissions...

  find . -type f -print0 | xargs --null chmod 0644
@@ -119,137 +63,65 @@ 

  sed -i data/metainfo/catfish.appdata.xml.in \

  	-e '\@version=.*1\.2\.0@s|2018-08-16|2014-08-16|'

  

- popd

  

  %build

  # Remove unneeded shebang

  grep -rl "/usr/bin/env" . | \

  	xargs sed -i -e "\@/usr/bin/env[ ][ ]*python@d"

  

- TOPDIR=$(pwd)

- rm -rf ./_TMPINSTDIR

- mkdir -p ./_TMPINSTDIR/python2

- mkdir -p ./_TMPINSTDIR/python3

- 

- pushd %{name}-%{mainver}*

- 

- %__python2 setup.py \

- 	install \

- 	--root ${TOPDIR}/_TMPINSTDIR/python2

- %if %support_python3

- %__python3 setup.py \

- 	install \

- 	--root ${TOPDIR}/_TMPINSTDIR/python3

- %endif

- 

- popd

- 

- %if %support_python3

- mv _TMPINSTDIR/python3/%{_bindir}/catfish{,-py3}

- %endif

- 

- pushd _TMPINSTDIR

- 

- # Sanity check for file differenct

- %if %support_python3

- ( cd python2 ; find . -type f ) | while read f

- do

- 	test -f python3/$f || continue

- 	cmp -s python2/$f python3/$f

- done

- 

- bash -c \

- 	"diff -u python2/%{_bindir}/catfish <(cat python3/%{_bindir}/catfish-py3 | sed -e 's|python3|python2|')"

- %endif

- 

- ln -sf catfish ./python2/%{_bindir}/catfish-py2

- 

- desktop-file-validate \

- 	./python2/%{_datadir}/applications/%{name}.desktop

- appstream-util validate-relax --nonet \

- 	./python2/%{_datadir}/metainfo/%{name}.appdata.xml

- 

- %if %support_python3

- pushd python3/%{_datadir}/applications/

- mv %{name}{,-py3}.desktop

- sed -i %{name}-py3.desktop \

- 	-e 's|/usr/bin/catfish$|/usr/bin/catfish-py3|' \

- 	-e 's|Catfish|Catfish(py3)|'\

- 	%{nil}

- desktop-file-validate ./%{name}-py3.desktop

- popd

- 

- pushd python3/%{_datadir}/metainfo

- mv catfish.appdata.xml catfish-py3.appdata.xml

- sed -i catfish-py3.appdata.xml \

- 	-e 's|catfish\.desktop|catfish-py3.desktop|' \

- 	%{nil}

- appstream-util validate-relax --nonet catfish-py3.appdata.xml

- popd

- %endif

+ 

+ %py3_build

+ 

  

  %install

- cp -a %{name}-%{mainver}*/[A-Z]* .

+ # no idea, but this has to happen first

+ desktop-file-install --dir %{buildroot}%{_datadir}/applications/ \

+ 			build/share/applications/%{name}.desktop

  

- pushd _TMPINSTDIR

- cp -a python2/* $RPM_BUILD_ROOT

- %if %support_python3

- cp -a python3/* $RPM_BUILD_ROOT

- %endif

- popd

+ %py3_install

  

- pushd %{name}-%{mainver}*

+ # for backwards compatibility:

+ ln -s ./catfish %{buildroot}%{_bindir}/catfish-py3

  

  # Install man page manually

- %{__mkdir_p} $RPM_BUILD_ROOT%{_mandir}/man1

- %{__install} -cpm 0644 ./%{name}.1 $RPM_BUILD_ROOT%{_mandir}/man1/

- %if %support_python3

- %{__install} -cpm 0644 ./%{name}.1 $RPM_BUILD_ROOT%{_mandir}/man1/%{name}-py3.1

- %endif

- 

- popd

+ %{__mkdir_p} %{buildroot}%{_mandir}/man1

+ %{__install} -cpm 0644 ./%{name}.1 %{buildroot}%{_mandir}/man1/

  

  # Remove all unnecessary documentation

- %{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/doc/

+ %{__rm} -rf %{buildroot}%{_datadir}/doc/

  

+ # Language files:

+ %{__mkdir_p} %{buildroot}%{_datadir}/locale/

+ %{__cp} -r build/mo/* %{buildroot}%{_datadir}/locale/

  %{find_lang} %{name}

  

- %files common -f %{name}.lang

- %defattr(-,root,root,-)

+ 

+ %check

+ desktop-file-validate %{buildroot}%{_datadir}/applications/%{name}.desktop

+ appstream-util validate-relax --nonet %{buildroot}%{_metainfodir}/%{name}.appdata.xml

+ 

+ 

+ %files -f %{name}.lang

  %doc AUTHORS

  %doc ChangeLog

  %doc README

  %license COPYING

- 

- %{_datadir}/%{name}/

- %{_datadir}/icons/hicolor/scalable/apps/%{name}.svg

- 

- %if 0%{?fedora} >= 28

- %files -n python2-%{name}

- %else

- %files

- %endif

  %{_bindir}/%{name}

- %{_bindir}/%{name}-py2

+ %{_bindir}/%{name}-py3

  %{_mandir}/man1/%{name}.1*

+ %{_datadir}/%{name}/

+ %{_datadir}/icons/hicolor/scalable/apps/%{name}.svg

  %{_datadir}/applications/%{name}.desktop

- %{_datadir}/metainfo/%{name}.appdata.xml

- %{python2_sitelib}/%{name}/

- %{python2_sitelib}/%{name}_lib/

- %{python2_sitelib}/%{name}-%{version}-py2*.egg-info

- 

- %if %support_python3

- %files	python3

- %{_bindir}/%{name}-py3

- %{_mandir}/man1/%{name}-py3.1*

- %{_datadir}/applications/%{name}-py3.desktop

- %{_datadir}/metainfo/%{name}-py3.appdata.xml

+ %{_metainfodir}/%{name}.appdata.xml

  %{python3_sitelib}/%{name}/

  %{python3_sitelib}/%{name}_lib/

  %{python3_sitelib}/%{name}-%{version}-py3*.egg-info

- %endif

+ 

  

  %changelog

+ * Mon Jul 16 2018 Miro Hrončok <mhroncok@redhat.com> - 1.4.5-2

+ - Only have one Python version

+ 

  * Thu Jul 12 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.5-1.2

  - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

  

According to the current guidelines:

If the executables provide the same functionality independent of whether they are run on top of Python 2 or Python 3, then only the Python 3 version of the executable should be packaged.

https://fedoraproject.org/wiki/Packaging:Python#Executables_in_.2Fusr.2Fbin

rebased onto c22a931

5 years ago

rebased onto a689b2d

5 years ago

rebased onto c470bd5

5 years ago

Currently I have no intention to do so.

Pull-Request has been closed by mtasaka

5 years ago

no intention to do what? follow the guidelines? why? what's the reasoning behind having two catfish packages in Fedora?

Could you please answer?

Could you please answer?

Could you please answer?

Could you please answer?

I'll merge this because it is blocking the removal of python2, and the maintainer seems busy.
I tested the binary and upgrade paths and everything seems in order.

Because there is no guarantee currently that gtk2 and gtk3 behaves exactly the same, I will revert the change.

... actually python2 and python3, sorry.

Of course it doesn't behave exactly the same. We expect gtk2 and gtk3 to be different, and that's in fact the whole point of the change: gtk2 is deprecated and has been for a long time. We cannot keep parts of desktop on an old toolkit. If there are bugs in/with the new toolkit, they need to fixed. But that's not a reason to pretend gtk2 is viable in F30.

This also applies to python2 vs. python3, even more strongly. We don't want users to try python2 and python3 versions of a graphical application on their own to figure out which works better. We also don't want to pull in the python2 stack. In F30 all the commonly used stuff will be using python3, so a graphical app that pulls in another language stack is a significant cost for the users.

Yet @mtasaka revered it anyway.

There is a long history of @mtasaka just doing such things and don't giving a damn. I give up. Better to just drop catfish from the Xfce Spin.

Even the revert commit message says "Rebuilt" instead of "I don't give a damn, let's rollback to how it was before, because I know better".

Is there a guideline when a maintainer is actively working on not following the guidelines and keeping the distro back? If not then I concur with Miro to drop catfish from the spin at least.

Unfortunately there is no such guideline.