unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Antwane Mason <ad.mason1413@gmail.com>
To: Hartmut Goebel <h.goebel@crazy-compilers.com>
Cc: guix-devel@gnu.org
Subject: Re: Python Site Package Syntax Runtime Error
Date: Mon, 20 Sep 2021 16:28:12 -0400	[thread overview]
Message-ID: <CAAztfg+tK84EEfqzyOdt6Qs_Fx949_LpvCaxgakzbg_wKjD8Mw@mail.gmail.com> (raw)
In-Reply-To: <1621bc1d-a291-e2dd-c598-0367d7c47edd@crazy-compilers.com>

[-- Attachment #1: Type: text/plain, Size: 3637 bytes --]

On Mon, Sep 20, 2021 at 8:32 AM Hartmut Goebel <h.goebel@crazy-compilers.com>
wrote:

> Looking at the code of the package - which actually is quite simple - I
> discover
>
> scripts=['onlykey_agent.py'],
>
> This might indeed trigger some issue in phase wrap. Please open a
> bug-report for this, explicitly pointing to release v1.1.11 of that package.
>
> As a solution for you I propose replacing the aforementioned line in
> setup.py by this line:
>
>     py_modules=['onlykey_agent'],
>
> I also suggest reporting this upstream, since I assume having onlykey_agent.py
> in bin is not desired. (Actually this is not a working script at all.)
>
> Thank you for the suggestion!  Taking your advice, I ended up with the
following snippet which ends up being simpler than overwriting the wrap
phase.
The main parts added are the modules field and snippet field; I simply
added the whole source field so it is clear where those two fields go
within the package definition.

--8<---------------cut here---------------start------------->8---
(source
      (origin
        (method url-fetch)
        (uri (pypi-uri "onlykey-agent" version))
        (sha256
          (base32
            "1586zhpph79s12alnyj1iiiwj0c5h1z8na2lqczf560p5mca6gxw"))
        (modules '((guix build utils)))
        (snippet
         '(begin (substitute* "setup.py"
                   (("scripts=\\['onlykey_agent.py'\\]")
                    "py_modules=['onlykey_agent']"))
                 #t))))
--8<---------------cut here---------------end--------------->8---

After reinstalling onlykey-agent with the above change, I got the following
runtime error when running onlykey-gpg init "Firstname Lastname <
test@gmail.com>".

--8<---------------cut here---------------start------------->8---
Traceback (most recent call last):
  File
"/gnu/store/rg6jn2bhrgmfhbkiprsjp3rc5gxi55lp-python-onlykey-agent-1.1.12/bin/.onlykey-gpg-real",
line 11, in <module>
    load_entry_point('onlykey-agent==1.1.12', 'console_scripts',
'onlykey-gpg')()
  File
"/gnu/store/rg6jn2bhrgmfhbkiprsjp3rc5gxi55lp-python-onlykey-agent-1.1.12/lib/python3.8/site-packages/onlykey_agent.py",
line 6, in <lambda>
    gpg_tool = lambda: libagent.gpg.main(DeviceType)
  File
"/gnu/store/ahbp2qnrx7m6m5yrxcfsf37gqmgkm13c-python-lib-agent-1.0.3/lib/python3.8/site-packages/libagent/gpg/__init__.py",
line 381, in main
    return args.func(device_type=device_type, args=args)
  File
"/gnu/store/ahbp2qnrx7m6m5yrxcfsf37gqmgkm13c-python-lib-agent-1.0.3/lib/python3.8/site-packages/libagent/gpg/__init__.py",
line 154, in run_init
    agent_path = util.which('{}-gpg-agent'.format(device_name))
  File
"/gnu/store/ahbp2qnrx7m6m5yrxcfsf37gqmgkm13c-python-lib-agent-1.0.3/lib/python3.8/site-packages/libagent/util.py",
line 212, in wrapper
    result = func(*args, **kwargs)
  File
"/gnu/store/ahbp2qnrx7m6m5yrxcfsf37gqmgkm13c-python-lib-agent-1.0.3/lib/python3.8/site-packages/libagent/util.py",
line 248, in which
    raise OSError('Cannot find {!r} in $PATH'.format(cmd))
OSError: Cannot find '.onlykey-gpg-gpg-agent' in $PATH
--8<---------------cut here---------------end--------------->8---

From what I can tell, the issue is that the inherited __str__ for Onlykey
class uses __name__ which resolves to '.onlykey-gpg'. This results in
trying to get the full path for
'.onlykey-gpg-gpg-agent' which doesn't exist. I think it should be instead
trying to get the path of 'onlykey-gpg-agent'. I plan on trying to patch
lib-agent to define a __str__ method that returns 'onlykey' for Onlykey
class.
I'm hoping that will fix the issue.

At the end of this, I plan to submit a bug report as you suggested.

[-- Attachment #2: Type: text/html, Size: 5536 bytes --]

  reply	other threads:[~2021-09-20 20:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-07 17:39 Python Site Package Syntax Runtime Error Antwane Mason
2021-09-16 12:06 ` Hartmut Goebel
2021-09-18 19:44   ` Antwane Mason
2021-09-19 16:31     ` Antwane Mason
2021-09-20 12:32     ` Hartmut Goebel
2021-09-20 20:28       ` Antwane Mason [this message]
2021-09-20 20:45         ` Hartmut Goebel
2021-09-19 17:59 ` Maxime Devos
     [not found]   ` <CAAztfgL+ZmbupibJtAeEQLdLoPwR=BNmnU80YU10Ea35P3jdeA@mail.gmail.com>
2021-09-20 20:10     ` Antwane Mason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAAztfg+tK84EEfqzyOdt6Qs_Fx949_LpvCaxgakzbg_wKjD8Mw@mail.gmail.com \
    --to=ad.mason1413@gmail.com \
    --cc=guix-devel@gnu.org \
    --cc=h.goebel@crazy-compilers.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).