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.