trezor-agent icon indicating copy to clipboard operation
trezor-agent copied to clipboard

unintended effects of ./contrib/neopg-trezor

Open attila-lendvai opened this issue 2 years ago • 4 comments

i'm packaging the trezor tools for guix, but i'm not proficient in the python ecosystem.

with that in mind, i think ./contrib/neopg-trezor causes some trouble. there's a sanity-check phase in the guix build of python packages, and i think what it does is that it tries to load every module.

this sanity check phase fails for trezor-agent. i think the cause is that the .egg-info/top_level.txt file is not empty:

$ cat /gnu/store/sy1szncn8qa464611d7a21wz7ks4hwhl-trezor-agent-0.14.7/lib/python3.10/site-packages/trezor_agent-0.12.0-py3.10.egg-info/top_level.txt 
contrib

i fixed the guix package by deleting the entire contrib/ in an early phase of the build of the package.

someone with a better understanding of the python ecosystem may be able to answer whether this is an issue with trezor-agent, or something that the guix package needs to deal with. please close/fix accordingly.

the error output

starting phase `sanity-check'
validating 'trezor-agent' /gnu/store/69vad40nvw6j1kcl34dbis40dcjg1r4g-trezor-agent-0.14.7/lib/python3.10/site-packages
...checking requirements: OK
...trying to load endpoint console_scripts age-plugin-trezor: ERROR:
Traceback (most recent call last):
  File "/gnu/store/iqsjkp55pcx5bfcp2jm9yj5rlx9a0whd-sanity-check.py", line 89, in <module>
    ep.load()
  File "/gnu/store/dy3xh053ahkhrp2jamggq8cpsyvp8mg0-python-3.10.7/lib/python3.10/site-packages/pkg_resources/__init__.py", line 2471, in load
    return self.resolve()
  File "/gnu/store/dy3xh053ahkhrp2jamggq8cpsyvp8mg0-python-3.10.7/lib/python3.10/site-packages/pkg_resources/__init__.py", line 2477, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
ModuleNotFoundError: No module named 'trezor_agent'
...trying to load endpoint console_scripts trezor-agent: ERROR:
Traceback (most recent call last):
  File "/gnu/store/iqsjkp55pcx5bfcp2jm9yj5rlx9a0whd-sanity-check.py", line 89, in <module>
    ep.load()
  File "/gnu/store/dy3xh053ahkhrp2jamggq8cpsyvp8mg0-python-3.10.7/lib/python3.10/site-packages/pkg_resources/__init__.py", line 2471, in load
    return self.resolve()
  File "/gnu/store/dy3xh053ahkhrp2jamggq8cpsyvp8mg0-python-3.10.7/lib/python3.10/site-packages/pkg_resources/__init__.py", line 2477, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
ModuleNotFoundError: No module named 'trezor_agent'
...trying to load endpoint console_scripts trezor-gpg: ERROR:
Traceback (most recent call last):
  File "/gnu/store/iqsjkp55pcx5bfcp2jm9yj5rlx9a0whd-sanity-check.py", line 89, in <module>
    ep.load()
  File "/gnu/store/dy3xh053ahkhrp2jamggq8cpsyvp8mg0-python-3.10.7/lib/python3.10/site-packages/pkg_resources/__init__.py", line 2471, in load
    return self.resolve()
  File "/gnu/store/dy3xh053ahkhrp2jamggq8cpsyvp8mg0-python-3.10.7/lib/python3.10/site-packages/pkg_resources/__init__.py", line 2477, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
ModuleNotFoundError: No module named 'trezor_agent'
...trying to load endpoint console_scripts trezor-gpg-agent: ERROR:
Traceback (most recent call last):
  File "/gnu/store/iqsjkp55pcx5bfcp2jm9yj5rlx9a0whd-sanity-check.py", line 89, in <module>
    ep.load()
  File "/gnu/store/dy3xh053ahkhrp2jamggq8cpsyvp8mg0-python-3.10.7/lib/python3.10/site-packages/pkg_resources/__init__.py", line 2471, in load
    return self.resolve()
  File "/gnu/store/dy3xh053ahkhrp2jamggq8cpsyvp8mg0-python-3.10.7/lib/python3.10/site-packages/pkg_resources/__init__.py", line 2477, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
ModuleNotFoundError: No module named 'trezor_agent'
...trying to load endpoint console_scripts trezor-signify: ERROR:
Traceback (most recent call last):
  File "/gnu/store/iqsjkp55pcx5bfcp2jm9yj5rlx9a0whd-sanity-check.py", line 89, in <module>
    ep.load()
  File "/gnu/store/dy3xh053ahkhrp2jamggq8cpsyvp8mg0-python-3.10.7/lib/python3.10/site-packages/pkg_resources/__init__.py", line 2471, in load
    return self.resolve()
  File "/gnu/store/dy3xh053ahkhrp2jamggq8cpsyvp8mg0-python-3.10.7/lib/python3.10/site-packages/pkg_resources/__init__.py", line 2477, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
ModuleNotFoundError: No module named 'trezor_agent'
error: in phase 'sanity-check': uncaught exception:
%exception #<&invoke-error program: "python" arguments: ("/gnu/store/iqsjkp55pcx5bfcp2jm9yj5rlx9a0whd-sanity-check.py" "/gnu/store/69vad40nvw6j1kcl34dbis40dcjg1r4g-trezor-agent-0.14.7/lib/python3.10/site-packages") exit-status: 1 term-signal: #f stop-signal: #f> 
phase `sanity-check' failed after 0.3 seconds

attila-lendvai avatar Aug 31 '23 20:08 attila-lendvai

hrm, also note that setuptools can complain like this: error: Multiple top-level packages discovered in a flat-layout: ['contrib', 'libagent']., whatever that means.

i think this is also a sing of some issue.

attila-lendvai avatar Aug 31 '23 20:08 attila-lendvai

Good catch, thanks! I have also removed contrib/ in https://github.com/romanz/trezor-agent/commit/6776971b5a5b9778be99d2f458740d19e061013f.

romanz avatar Sep 02 '23 10:09 romanz

Could you please share the commands you are using for packaging?

romanz avatar Sep 02 '23 10:09 romanz

note that "packaging" in guix means building. i don't know the details of how python apps are built in guix, but it involves running setup.py, and/or setuptools, and whatnot. i.e. it may rerun something that you don't run in your normal build process. but then again, i don't know the python build ecosystem.

this is the file: https://git.savannah.gnu.org/cgit/guix.git/tree/guix/build/python-build-system.scm

attila-lendvai avatar Sep 03 '23 09:09 attila-lendvai