Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 891749 - sys-power/switcheroo-control-2.6-r1: python-any-r1 eclass causing to set wrong shebang
Summary: sys-power/switcheroo-control-2.6-r1: python-any-r1 eclass causing to set wron...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Pacho Ramos
URL:
Whiteboard:
Keywords: PATCH
: 891807 (view as bug list)
Depends on:
Blocks:
 
Reported: 2023-01-22 17:01 UTC by Marco Genasci
Modified: 2023-02-11 08:43 UTC (History)
1 user (show)

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


Attachments
switcheroo-control-2.6-r1.ebuild.patch (switcheroo-control-2.6-r2.ebuild.patch,903 bytes, patch)
2023-01-22 17:02 UTC, Marco Genasci
Details | Diff
switcheroo-control-2.6-r2.ebuild (switcheroo-control-2.6-r2.ebuild,1.59 KB, text/plain)
2023-01-24 17:58 UTC, Pacho Ramos
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marco Genasci 2023-01-22 17:01:32 UTC
Using python-any-r1 eclas cause python_fix_shebang to use wrong python interpreter. For example in a stable system python-3.11 is installed but PYTHON_TARGETS is set to python_targets_3_10 and python_fix_shebang set #!/usr/bin/python3.11 as shebang causing error on runtime:

Traceback (most recent call last):
  File "/usr/bin/switcherooctl", line 3, in <module>
    from gi.repository import Gio, GLib
ModuleNotFoundError: No module named 'gi'

Usign python-single-r1 eclass fix the problem

--- switcheroo-control-2.6-r1.ebuild    2023-01-22 17:53:13.798380842 +0100
+++ switcheroo-control-2.6-r2.ebuild    2023-01-22 17:54:23.231334893 +0100
@@ -4,7 +4,7 @@
 EAPI=8
 PYTHON_COMPAT=( python3_{9..11} )
 
-inherit meson python-any-r1 systemd
+inherit meson python-single-r1 systemd
 
 DESCRIPTION="D-Bus service to check the availability of dual-GPU"
 HOMEPAGE="https://gitlab.freedesktop.org/hadess/switcheroo-control/"
@@ -25,7 +25,7 @@
        dev-util/gdbus-codegen
        gtk-doc? ( dev-util/gtk-doc )
        test? (
-               $(python_gen_any_dep 'dev-python/python-dbusmock[${PYTHON_USEDEP}]')
+               dev-python/python-dbusmock[${PYTHON_SINGLE_USEDEP}]
                dev-util/umockdev
        )
 "
@@ -34,7 +34,7 @@
 
 python_check_deps() {
        use test || return 0
-       python_has_version "dev-python/python-dbusmock[${PYTHON_USEDEP}]"
+       python_has_version "dev-python/python-dbusmock[${PYTHON_SINGLE_USEDEP}]"
 }
 
 src_configure() {

Reproducible: Always
Comment 1 Marco Genasci 2023-01-22 17:02:25 UTC
Created attachment 849039 [details, diff]
switcheroo-control-2.6-r1.ebuild.patch
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-01-23 06:03:47 UTC
*** Bug 891807 has been marked as a duplicate of this bug. ***
Comment 3 Pacho Ramos gentoo-dev 2023-01-24 17:29:41 UTC
(In reply to Marco Genasci from comment #0)
> Using python-any-r1 eclas cause python_fix_shebang to use wrong python
> interpreter. For example in a stable system python-3.11 is installed but
> PYTHON_TARGETS is set to python_targets_3_10 and python_fix_shebang set
> #!/usr/bin/python3.11 as shebang causing error on runtime:

Ah, that explains why I didn't notice as I have PYTHON_TARGETS also with 3.11 :/
Comment 4 Pacho Ramos gentoo-dev 2023-01-24 17:41:15 UTC
(In reply to Marco Genasci from comment #1)
> Created attachment 849039 [details, diff] [details, diff]
> switcheroo-control-2.6-r1.ebuild.patch

That leads to with USE test enabled (not so strange as dev-python/python-dbusmock is not a python-single-r1 package):
emerge: there are no ebuilds built with USE flags to satisfy "dev-python/python-dbusmock[python_single_target_python3_9(-)?,python_single_target_python3_10(-)?,python_single_target_python3_11(-)?]".
!!! One of the following packages is required to complete your request:
- sys-power/switcheroo-control-2.6-r2::gentoo (Change USE: -python_single_target_python3_10)
(dependency required by "sys-power/switcheroo-control-2.6-r2::gentoo" [ebuild])
(dependency required by "=sys-power/switcheroo-control-2.6-r2" 

Also... as switcherooctl uses python... we will need to move the python checks out of test USE flag as they will always be needed
Comment 5 Pacho Ramos gentoo-dev 2023-01-24 17:58:18 UTC
Created attachment 849153 [details]
switcheroo-control-2.6-r2.ebuild

I think it should be something like this... but I prepared it just now and couldn't test it :/
Comment 6 Marco Genasci 2023-01-24 18:14:09 UTC
(In reply to Pacho Ramos from comment #5)
> Created attachment 849153 [details]
> switcheroo-control-2.6-r2.ebuild
> 
> I think it should be something like this... but I prepared it just now and
> couldn't test it :/

In my stable system works fine now.
Comment 7 Georgi 2023-01-24 18:50:39 UTC
(In reply to Marco Genasci from comment #6)
> (In reply to Pacho Ramos from comment #5)
> > Created attachment 849153 [details]
> > switcheroo-control-2.6-r2.ebuild
> > 
> > I think it should be something like this... but I prepared it just now and
> > couldn't test it :/
> 
> In my stable system works fine now.

Seems to be working on my stable system too.

Best Regards,
Georgi
Comment 8 Larry the Git Cow gentoo-dev 2023-01-27 20:38:56 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fe26dafd89a74727711ce0213d5d93772fee9e7c

commit fe26dafd89a74727711ce0213d5d93772fee9e7c
Author:     Pacho Ramos <pacho@gentoo.org>
AuthorDate: 2023-01-27 20:36:24 +0000
Commit:     Pacho Ramos <pacho@gentoo.org>
CommitDate: 2023-01-27 20:38:51 +0000

    sys-power/switcheroo-control: Fix python handling
    
    Bug: https://bugs.gentoo.org/891749
    Signed-off-by: Pacho Ramos <pacho@gentoo.org>

 .../switcheroo-control-2.6-r2.ebuild               | 71 ++++++++++++++++++++++
 1 file changed, 71 insertions(+)
Comment 9 Larry the Git Cow gentoo-dev 2023-02-11 08:43:34 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=115665d53ea9fb698b0bef80de8a920da07570d4

commit 115665d53ea9fb698b0bef80de8a920da07570d4
Author:     Pacho Ramos <pacho@gentoo.org>
AuthorDate: 2023-02-11 08:43:17 +0000
Commit:     Pacho Ramos <pacho@gentoo.org>
CommitDate: 2023-02-11 08:43:17 +0000

    sys-power/switcheroo-control: stabilize 2.6-r2 for amd64
    
    Closes: https://bugs.gentoo.org/891749
    Signed-off-by: Pacho Ramos <pacho@gentoo.org>

 sys-power/switcheroo-control/switcheroo-control-2.6-r2.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)