Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 718424 - net-analyzer/nagstamon: need py3.7, 3.8 port
Summary: net-analyzer/nagstamon: need py3.7, 3.8 port
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Deadline: 2020-09-21
Assignee: Christian Ruppert (idl0r)
Keywords: PMASKED, PullRequest
Depends on:
Blocks: python3.7-compat
  Show dependency tree
Reported: 2020-04-19 19:52 UTC by Michał Górny
Modified: 2020-09-05 08:18 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---

Patch to handle optional VERSION_ID in /etc/os-release (nagstamon-3.4.1-version_id.patch,1.19 KB, patch)
2020-08-26 12:12 UTC, Zentoo
Details | Diff
ebuild to handle python-3.7/python-3.8 and VERSION_ID patch (nagstamon-3.4.1-r1.ebuild,1.48 KB, text/plain)
2020-08-26 12:14 UTC, Zentoo

Note You need to log in before you can comment on or make changes to this bug.
Description Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2020-04-19 19:52:00 UTC
The packages are stuck on py3.6 which means they will be pain once we switch to 3.7.  Please test them on 3.7 *and* 3.8 (so we don't to revisit this in a few months), and update PYTHON_COMPAT appropriately.  If it doesn't work, please either fix it, remove Python or issue last rites.  Please consider this urgent.
Comment 1 Zentoo 2020-05-10 11:35:47 UTC
Nagstamon compile and run fine with python 3.7.
The only problem is that emerge process can't fill VERSION_ID variable from /etc/os-release since get_distro function don't find it in /etc/os-release and 
platform.dist() is deprecated in python 3.7.

Traceback (most recent call last):
  File "", line 38, in <module>
    DIST, DIST_VERSION, DIST_NAME = get_distro()
  File "/gentoo/tmp/portage/net-analyzer/nagstamon-3.4.1/work/Nagstamon/Nagstamon/", line 457, in get_distro
    return (os_release_dict['ID'], os_release_dict['VERSION_ID'], os_release_dict['NAME'])

Corresponding code:

def get_distro():
    replacement for platform.dist() which is deprecated and not available anymore since Python 3.8
    read content of /etc/os-release and return it - all relevant distros should deliver this file
    on older Python platform.dist still can be used and even should be on Debian 8 with Python 3.4
    if sys.version_info > (3,7):
        os_release_file = Path('/etc/os-release')
        if os_release_file.exists() and (os_release_file.is_file() or os_release_file.is_symlink()):
            os_release_dict = {}
            for property in os_release_file.read_text().splitlines():
                key, value = property.split('=', 1)
                os_release_dict[key] = value.strip('"').strip("'")
            return (os_release_dict['ID'], os_release_dict['VERSION_ID'], os_release_dict['NAME'])
            return False
        return platform.dist()

Quick and dirty workaround:
Add VERSION_ID variable in /etc/os-realease.
May be this variable should be filled with baselayout major version.

So nagstamon need a little patch to manage VERSION_ID to be emerge with python 3.7.
Comment 2 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2020-08-16 10:01:17 UTC
Comment 3 Sylvain CANOINE 2020-08-26 07:06:21 UTC
Now, emerge says :

!!! The following installed packages are masked:
- net-analyzer/nagstamon-3.4.1::gentoo (masked by: package.mask)
# Michał Górny <> (2020-08-22)
# These packages still require Python 3.6.  They are either dead
# upstream or their maintainers are simply unresponsive.
# Please do not remove any packages from this list unless you actually
# port them to Python 3.7 *and* 3.8 (3.9 would also be nice).
# Removal in 30 days.  Tracker bug #695996.

So, if I understand well, nagstamon is fully python 3.8 compatible (see their changelog), but will be removed from portage, just because Gentoo doesn't provide a standard variable into a standard file. Moreover, the mentioned reason for this removal is obviously false.

I know that writing a patch can take lots of time and some expertise, and I have none of them. But, here, we don't need a patch, we just need a decision : please, Gentoo maintainers, add a VERSION_ID variable into /etc/os-release.
Comment 4 Zentoo 2020-08-26 11:01:21 UTC
I'm agree with Sylvain CANOINE.

A lot of sysadmins use nagstamon to have a live monitoring on their work desktop.
It's not a simple widget but a sysadmin production tool.
So IMHO this removal is not welcome.

From :

           A lower-case string (mostly numeric, no spaces or other
           characters outside of 0–9, a–z, ".", "_" and "-") identifying the
           operating system version, excluding any OS name information or
           release code name, and suitable for processing by scripts or
           usage in generated filenames. This field is optional. Example:
           "VERSION_ID=17" or "VERSION_ID=11.04".

So I think a simple patch that check existence of this variable in /etc/os-release before use it should be sufficient since this value once read is not used at all later.
Comment 5 Zentoo 2020-08-26 11:12:27 UTC
I was on my way to create this simple patch but in fact, that have been already done 5 days ago upstream:

So we can simply backport this patch and use PYTHON_COMPAT=( python3_7  python3_8 ).
Comment 6 Zentoo 2020-08-26 12:12:55 UTC
Created attachment 656888 [details, diff]
Patch to handle optional VERSION_ID in /etc/os-release
Comment 7 Zentoo 2020-08-26 12:14:08 UTC
Created attachment 656890 [details]
ebuild to handle python-3.7/python-3.8 and VERSION_ID patch
Comment 8 Zentoo 2020-08-26 12:15:14 UTC
So I've make a quick patch from upstream and corresponding ebuild that solve this issue.
Enjoy ;)
Comment 9 Zentoo 2020-08-26 12:16:57 UTC
So please remove Pending Mask.
Comment 10 Wojciech Arabczyk 2020-08-31 07:42:28 UTC
It's been fixed upstream:
Comment 11 Zentoo 2020-08-31 10:51:13 UTC
(In reply to Wojciech Arabczyk from comment #10)
> It's been fixed upstream:

The patch and ebuiild that I push here 5 days ago come from this commit.
Comment 12 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2020-09-02 05:45:30 UTC
Please make a github PR or mail a patch to either myself (sam@) or the proxy-maintainers list (I guess this is preferred) using git format-patch.
Comment 13 Zentoo 2020-09-02 09:55:36 UTC
(In reply to Sam James from comment #12)
> Please make a github PR or mail a patch to either myself (sam@) or the
> proxy-maintainers list (I guess this is preferred) using git format-patch.
Here we go. I do my best for my first PR.
Hope everything is OK.
Comment 14 Zentoo 2020-09-02 10:15:25 UTC
PR closed and new one to respect GLEP 66  and GLEP 76:
Comment 15 Larry the Git Cow gentoo-dev 2020-09-05 08:17:05 UTC
The bug has been closed via the following commit(s):

commit b133cb91601a776c9bb7ae20266c00a75545df87
Author:     Hans de Graaff <>
AuthorDate: 2020-09-05 08:15:35 +0000
Commit:     Hans de Graaff <>
CommitDate: 2020-09-05 08:17:00 +0000

    net-analyzer/nagstamon: add python 3.7, 3.8
    Also become co-maintainer.
    Package-Manager: Portage-3.0.4, Repoman-3.0.1
    Signed-off-by: Hans de Graaff <>

 .../files/nagstamon-3.4.1-unknown-version-id.patch | 14 ++++++
 net-analyzer/nagstamon/metadata.xml                |  4 ++
 net-analyzer/nagstamon/nagstamon-3.4.1-r1.ebuild   | 53 ++++++++++++++++++++++
 3 files changed, 71 insertions(+)
Comment 16 Hans de Graaff gentoo-dev 2020-09-05 08:18:34 UTC
Sorry, just noticed the recent activity here, but I already had a testing version ready to commit since last weekend. Thanks for your efforts.