Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 1304822

Summary: glances: Provide a Python 3 (sub-)package
Product: [Fedora] Fedora Reporter: Petr Viktorin (pviktori) <pviktori>
Component: glancesAssignee: Edouard Bourguignon <madko>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 24CC: dkrejci, madko, mail, mhroncok, michel
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-07-26 09:09:06 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1285816    
Attachments:
Description Flags
Version update, fixed file section none

Description Petr Viktorin (pviktori) 2016-02-04 17:26:01 UTC
Upstream, this software supports Python 3. Please provide a Python 3
package for Fedora.


According to the Python packaging guidelines [0], software must be
packaged for Python 3 if upstream supports it.
The guidelines give detailed information on how to do this, and even
provide an example spec file [1].

The current best practice is to provide subpackages for the two Python
versions (called "Common SRPM" in the guidelines). Alternatively, if
nothing depends on your Python2 package, you can just switch to Python 3
entirely.

It's fine to do this in Rawhide only.


If anything is unclear, or if you need any kind of assistance with the
porting, you can ask on IRC (#fedora-python on Freenode), or reply here.
We'll be happy to help!


[0] https://fedoraproject.org/wiki/Packaging:Python
[1] https://fedoraproject.org/wiki/Packaging:Python#Example_common_spec_file

Comment 1 Jan Kurik 2016-02-24 14:24:37 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 24 development cycle.
Changing version to '24'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora24#Rawhide_Rebase

Comment 2 Dominika Krejčí 2016-04-20 12:07:23 UTC
Hello Edouard,

Do you need any help adding Python 3 support to the RPM?

If you need more instructions, a [guide] for porting Python-based RPMs is available.

[guide] http://python-rpm-porting.readthedocs.org/en/latest/index.html

Comment 3 Edouard Bourguignon 2016-04-30 12:35:23 UTC
I've followed the guide and now fedpkg build fails because python-glances is not in tag list for f25.

here is my new spec file:
%global srcname glances 
%global sum	CLI curses based monitoring tool

Name:		python-%{srcname}		
Version:	2.6.1
Release:	1%{?dist}
Summary:	%{sum}

Group:		Applications/System		
License:	GPLv3
URL:		https://github.com/nicolargo/glances
Source0:	https://github.com/nicolargo/glances/archive/v%{version}.tar.gz
BuildArch:	noarch
BuildRequires:  python2-devel python3-devel
BuildRequires:	python-setuptools python3-setuptools
BuildRequires:	python2-psutil >= 2.0.0
BuildRequires:	python3-psutil >= 2.0.0
Requires:	python-setuptools python3-setuptools
Requires:	python2-psutil >= 2.0.0
Requires:	python3-psutil >= 2.0.0

%description
Glances is a CLI curses based monitoring tool for both GNU/Linux and BSD.

Glances uses the PsUtil library to get information from your system.

It is developed in Python.


%package -n python2-%{srcname}
Summary:        %{sum}
%{?python_provide:%python_provide python2-%{srcname}}

%description -n python2-%{srcname}
Glances is a CLI curses based monitoring tool for both GNU/Linux and BSD.

Glances uses the PsUtil library to get information from your system.

It is developed in Python.


%package -n python3-%{srcname}
Summary:        %{sum}
%{?python_provide:%python_provide python3-%{srcname}}

%description -n python3-%{srcname}
Glances is a CLI curses based monitoring tool for both GNU/Linux and BSD.

Glances uses the PsUtil library to get information from your system.

It is developed in Python.


%prep
%autosetup -n %{srcname}-%{version}

%build
%py2_build
%py3_build

%install
# Must do the python2 install first because the scripts in /usr/bin are
# overwritten with every setup.py install, and in general we want the
# python3 version to be the default.
%py2_install
%py3_install

%check
%{__python2} setup.py test
%{__python3} setup.py test

%clean
rm -rf %{buildroot} 


%files -n python2-%{srcname}
%defattr(-,root,root,-)
%doc AUTHORS COPYING README.rst NEWS 
%{_bindir}/glances
%{python2_sitelib}/*
%exclude %{_datadir}/doc/glances
%{_datadir}/man/man1/glances.1.gz

%files -n python3-%{srcname}
%defattr(-,root,root,-)
%doc AUTHORS COPYING README.rst NEWS
%{_bindir}/glances
%{python3_sitelib}/*
%exclude %{_datadir}/doc/glances
%{_datadir}/man/man1/glances.1.gz


%changelog
* Thu Apr 28 2016 Edouard Bourguignon <madko> - 2.6.1
- Update to 2.6.1
- Provides python2 and python3 packages

Any idea?

Comment 4 Miro Hrončok 2016-04-30 21:38:35 UTC
You cannot rename the package that's already in dist-git.

For the sake of simplicity, just keep the package main name as glances.

It would also be good to provide glances from the python2 subpackage just to not break upgrade path:

%package -n python2-%{srcname}
# ...
Provides: %{srcname} = %{version}-%{release}

Comment 5 Miro Hrončok 2016-04-30 21:41:29 UTC
Also, you are trying to package %{_bindir}/glances to both subpackages, this is not going to work. See http://python-rpm-porting.readthedocs.io/en/latest/application-modules.html#files

Comment 6 Dominika Krejčí 2016-09-27 08:31:41 UTC
Created attachment 1205109 [details]
Version update, fixed file section

Hello,
what about this patch? It provides the latest version, original name of the package and fixed file section. 

Koji scratch build: http://koji.fedoraproject.org/koji/taskinfo?taskID=15822881

Comment 7 Fedora End Of Life 2017-07-25 19:53:36 UTC
This message is a reminder that Fedora 24 is nearing its end of life.
Approximately 2 (two) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 24. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '24'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 24 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 8 Petr Viktorin (pviktori) 2017-07-26 09:09:06 UTC
In f26 this is fixed: The `glances` package uses Python 3, and a python2-glances package is available with code.