On Sat, Sep 18, 2021 at 3:44 PM Antwane Mason <ad.mason1413@gmail.com> wrote:

From what I can tell, one of the build phases responsible for wrapping executables into shell scripts is wrongly wrapping one of the python files. This causes the shell script which is named as the original python file to be loaded as a python module causing a syntax error because the export line is a shell directive and not valid python syntax. Below is the stack trace again for reference.  The last file referenced in the stack trace is a shell script wrapper for the original onlykey_agent.py file which was renamed .onlykey_agent.py-real. Below is the full file for this shell script. Can anyone provide guidance as to which build phase needs to change and how to change it to prevent onlykey_agent.py from being wrapped?
--8<---------------cut here---------------start------------->8---
antwane@wmguix ~$ onlykey-agent
Traceback (most recent call last):
  File "/gnu/store/s2w1lq80x9vcwp5382kn98f5pi2k4b7b-python-onlykey-agent-1.1.12/bin/.onlykey-agent-real", line 11, in <module>
    load_entry_point('onlykey-agent==1.1.12', 'console_scripts', 'onlykey-agent')()
  File "/gnu/store/sd2ic7bpv8fx3imy1j8xcjclx71sv6q0-python-3.8.2/lib/python3.8/site-packages/pkg_resources/__init__.py", line 489, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/gnu/store/sd2ic7bpv8fx3imy1j8xcjclx71sv6q0-python-3.8.2/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2852, in load_entry_point
    return ep.load()
  File "/gnu/store/sd2ic7bpv8fx3imy1j8xcjclx71sv6q0-python-3.8.2/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2443, in load
    return self.resolve()
  File "/gnu/store/sd2ic7bpv8fx3imy1j8xcjclx71sv6q0-python-3.8.2/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2449, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/gnu/store/s2w1lq80x9vcwp5382kn98f5pi2k4b7b-python-onlykey-agent-1.1.12/bin/onlykey_agent.py", line 2
    export PYTHONPATH="/gnu/store/s2w1lq80x9vcwp5382kn98f5pi2k4b7b-python-onlykey-agent-1.1.12/lib/python3.8/site-packages:/gnu/store/ahbp2qnrx7m6m5yrxcfsf37gqmgkm13c-python-lib-agent-1.0.3/lib/python3.8/site-packages:/gnu/store/xq0bpzrxy461igy3vwymgmlfg85ghfgv-python-onlykey-1.2.6/lib/python3.8/site-packages:/gnu/store/sd2ic7bpv8fx3imy1j8xcjclx71sv6q0-python-3.8.2/lib/python3.8/site-packages:/gnu/store/gb0xnb6vldlmwiky77w7hxpkjbvp1560-python-wheel-0.36.2/lib/python3.8/site-packages:/gnu/store/7c48ls8c4xddx22yy7rlnszs0fjl56k7-python-unidecode-1.1.1/lib/python3.8/site-packages:/gnu/store/hi8yk6yzivzwpxak2fcggd6zl887n7zj-python-semver-2.9.0/lib/python3.8/site-packages:/gnu/store/gvka9y88b5i6h1fbwb5qxi8vv0ajh6d3-python-pynacl-1.4.0/lib/python3.8/site-packages:/gnu/store/4153n7v3hy0pn2df0c8rag7v4gmgg0ki-python-pymsgbox-1.0.6/lib/python3.8/site-packages:/gnu/store/ppdbw2sl5filj79rl6k0wqy7xkz2603n-python-pycryptodome-3.9.9/lib/python3.8/site-packages:/gnu/store/b2pf54i477iby8f17am9p0x2bz96gn63-python-mnemonic-0.20/lib/python3.8/site-packages:/gnu/store/3vl9a6y7d9r3w3diy2bj15jxd0qgzycv-python-ecdsa-0.14.1/lib/python3.8/site-packages:/gnu/store/1qz6j51mmn2z1za41fb9vs9dgmwisng3-python-docutils-0.16/lib/python3.8/site-packages:/gnu/store/v74q9niaprwv0l25hb1hcyhvyzwp7zmf-python-daemon-2.2.3/lib/python3.8/site-packages:/gnu/store/jvm96kifzns968g0l115chfdp3n5ksba-python-configargparse-1.2.3/lib/python3.8/site-packages:/gnu/store/j3w4j8x76n7wdbjrh377fwx4hwgmfwmy-python-backports.shutil-which-3.5.2/lib/python3.8/site-packages:/gnu/store/hjmz8ymac939ribn7g3jkgms4dk2az3a-python-six-1.14.0/lib/python3.8/site-packages:/gnu/store/bxbhdka9x8pnl7jnpkvz1nvgg2m8xqfs-python-prompt-toolkit-3.0.18/lib/python3.8/site-packages:/gnu/store/2lrpayrb6rrfmscfkfii65jdd328v945-python-onlykey-solo-0.0.28/lib/python3.8/site-packages:/gnu/store/1xmngywbzxx8lb539z4zcggm12gw6lzm-python-hidapi-0.7.99.post21/lib/python3.8/site-packages:/gnu/store/j1qn1pjvpyljmrb7hh1pjsgz44b13y5i-python-cython-0.29.22/lib/python3.8/site-packages:/gnu/store/d5zp1z8vz42c8b69fszck1vqh59npms4-python-aenum-2.2.4/lib/python3.8/site-packages:/gnu/store/sfy8vc8da10appy093izjz4byzd7sfqp-python-cffi-1.14.4/lib/python3.8/site-packages:/gnu/store/wi6ihkh2dq1sj6pq6g28f5vw157kfy8x-python-lockfile-0.12.2/lib/python3.8/site-packages:/gnu/store/xjiplzqxr084ximm4wdhyx3wzf8nxvv0-python-wcwidth-0.1.8/lib/python3.8/site-packages:/gnu/store/kffam5lzshdhb0ygq0r76gqvavs0190c-python-requests-2.25.0/lib/python3.8/site-packages:/gnu/store/qkj3ssg0y3ya0d450pp0kaa7zbg9i0x6-python-pyusb-1.0.2/lib/python3.8/site-packages:/gnu/store/b3k1kmx7rzkykb4ik5nz0jdabqr86vvv-python-pyserial-3.5/lib/python3.8/site-packages:/gnu/store/w3q52n0pc5zvblr8qdsgdfiw33psj6pz-python-intelhex-2.2.1/lib/python3.8/site-packages:/gnu/store/fpk2f2jwqah0s340hdhmr734vvxq3z3j-python-fido2-0.9.1/lib/python3.8/site-packages:/gnu/store/sjiiqs605sfsqxjdkcm3m8rx0ahv5wvv-python-cryptography-3.3.1/lib/python3.8/site-packages:/gnu/store/5a12m99wdfqydzwx46nlfqqvi9q3pq49-python-click-7.1.2/lib/python3.8/site-packages:/gnu/store/k08j1silv8zxfglz3mb5q7ngmya9cv39-python-pycparser-2.20/lib/python3.8/site-packages:/gnu/store/fd7sx13lhrgbrnsa5k3g8inas417p5q5-python-urllib3-1.26.4/lib/python3.8/site-packages:/gnu/store/ihl3h0s000vlkvadxvv21cbn4fqzvmav-python-idna-2.10/lib/python3.8/site-packages:/gnu/store/ysvrcvvaajbg432f7pr0k8x2w21lnz81-python-chardet-3.0.4/lib/python3.8/site-packages:/gnu/store/2j54g0s8db1b10ggs4rirfb5vv8abm2y-python-certifi-2020.12.5/lib/python3.8/site-packages:/gnu/store/q01v2xjfcl7d020y3yh865695gm8i3gx-python-iso8601-0.1.13/lib/python3.8/site-packages:/gnu/store/xkcc4372psi79xiidw4k33nmyf6mk36h-python-asn1crypto-1.4.0/lib/python3.8/site-packages:/gnu/store/xgsczafbfkmqmanm87nx2qfyzp4h313i-python-pysocks-1.7.1/lib/python3.8/site-packages:/gnu/store/wand0zrwwnds6x636746116cfh3sy50k-python-pyopenssl-20.0.0/lib/python3.8/site-packages${PYTHONPATH:+:}$PYTHONPATH"
           ^
SyntaxError: invalid syntax
--8<---------------cut here---------------end--------------->8---

--8<---------------cut here---------------start------------->8---
#!/gnu/store/pwcp239kjf7lnj5i4lkdzcfcxwcfyk72-bash-minimal-5.0.16/bin/bash
export PYTHONPATH="/gnu/store/s2w1lq80x9vcwp5382kn98f5pi2k4b7b-python-onlykey-agent-1.1.12/lib/python3.8/site-packages:/gnu/store/ahbp2qnrx7m6m5yrxcfsf37gqmgkm13c-python-lib-agent-1.0.3/lib/python3.8/site-packages:/gnu/store/xq0bpzrxy461igy3vwymgmlfg85ghfgv-python-onlykey-1.2.6/lib/python3.8/site-packages:/gnu/store/sd2ic7bpv8fx3imy1j8xcjclx71sv6q0-python-3.8.2/lib/python3.8/site-packages:/gnu/store/gb0xnb6vldlmwiky77w7hxpkjbvp1560-python-wheel-0.36.2/lib/python3.8/site-packages:/gnu/store/7c48ls8c4xddx22yy7rlnszs0fjl56k7-python-unidecode-1.1.1/lib/python3.8/site-packages:/gnu/store/hi8yk6yzivzwpxak2fcggd6zl887n7zj-python-semver-2.9.0/lib/python3.8/site-packages:/gnu/store/gvka9y88b5i6h1fbwb5qxi8vv0ajh6d3-python-pynacl-1.4.0/lib/python3.8/site-packages:/gnu/store/4153n7v3hy0pn2df0c8rag7v4gmgg0ki-python-pymsgbox-1.0.6/lib/python3.8/site-packages:/gnu/store/ppdbw2sl5filj79rl6k0wqy7xkz2603n-python-pycryptodome-3.9.9/lib/python3.8/site-packages:/gnu/store/b2pf54i477iby8f17am9p0x2bz96gn63-python-mnemonic-0.20/lib/python3.8/site-packages:/gnu/store/3vl9a6y7d9r3w3diy2bj15jxd0qgzycv-python-ecdsa-0.14.1/lib/python3.8/site-packages:/gnu/store/1qz6j51mmn2z1za41fb9vs9dgmwisng3-python-docutils-0.16/lib/python3.8/site-packages:/gnu/store/v74q9niaprwv0l25hb1hcyhvyzwp7zmf-python-daemon-2.2.3/lib/python3.8/site-packages:/gnu/store/jvm96kifzns968g0l115chfdp3n5ksba-python-configargparse-1.2.3/lib/python3.8/site-packages:/gnu/store/j3w4j8x76n7wdbjrh377fwx4hwgmfwmy-python-backports.shutil-which-3.5.2/lib/python3.8/site-packages:/gnu/store/hjmz8ymac939ribn7g3jkgms4dk2az3a-python-six-1.14.0/lib/python3.8/site-packages:/gnu/store/bxbhdka9x8pnl7jnpkvz1nvgg2m8xqfs-python-prompt-toolkit-3.0.18/lib/python3.8/site-packages:/gnu/store/2lrpayrb6rrfmscfkfii65jdd328v945-python-onlykey-solo-0.0.28/lib/python3.8/site-packages:/gnu/store/1xmngywbzxx8lb539z4zcggm12gw6lzm-python-hidapi-0.7.99.post21/lib/python3.8/site-packages:/gnu/store/j1qn1pjvpyljmrb7hh1pjsgz44b13y5i-python-cython-0.29.22/lib/python3.8/site-packages:/gnu/store/d5zp1z8vz42c8b69fszck1vqh59npms4-python-aenum-2.2.4/lib/python3.8/site-packages:/gnu/store/sfy8vc8da10appy093izjz4byzd7sfqp-python-cffi-1.14.4/lib/python3.8/site-packages:/gnu/store/wi6ihkh2dq1sj6pq6g28f5vw157kfy8x-python-lockfile-0.12.2/lib/python3.8/site-packages:/gnu/store/xjiplzqxr084ximm4wdhyx3wzf8nxvv0-python-wcwidth-0.1.8/lib/python3.8/site-packages:/gnu/store/kffam5lzshdhb0ygq0r76gqvavs0190c-python-requests-2.25.0/lib/python3.8/site-packages:/gnu/store/qkj3ssg0y3ya0d450pp0kaa7zbg9i0x6-python-pyusb-1.0.2/lib/python3.8/site-packages:/gnu/store/b3k1kmx7rzkykb4ik5nz0jdabqr86vvv-python-pyserial-3.5/lib/python3.8/site-packages:/gnu/store/w3q52n0pc5zvblr8qdsgdfiw33psj6pz-python-intelhex-2.2.1/lib/python3.8/site-packages:/gnu/store/fpk2f2jwqah0s340hdhmr734vvxq3z3j-python-fido2-0.9.1/lib/python3.8/site-packages:/gnu/store/sjiiqs605sfsqxjdkcm3m8rx0ahv5wvv-python-cryptography-3.3.1/lib/python3.8/site-packages:/gnu/store/5a12m99wdfqydzwx46nlfqqvi9q3pq49-python-click-7.1.2/lib/python3.8/site-packages:/gnu/store/k08j1silv8zxfglz3mb5q7ngmya9cv39-python-pycparser-2.20/lib/python3.8/site-packages:/gnu/store/fd7sx13lhrgbrnsa5k3g8inas417p5q5-python-urllib3-1.26.4/lib/python3.8/site-packages:/gnu/store/ihl3h0s000vlkvadxvv21cbn4fqzvmav-python-idna-2.10/lib/python3.8/site-packages:/gnu/store/ysvrcvvaajbg432f7pr0k8x2w21lnz81-python-chardet-3.0.4/lib/python3.8/site-packages:/gnu/store/2j54g0s8db1b10ggs4rirfb5vv8abm2y-python-certifi-2020.12.5/lib/python3.8/site-packages:/gnu/store/q01v2xjfcl7d020y3yh865695gm8i3gx-python-iso8601-0.1.13/lib/python3.8/site-packages:/gnu/store/xkcc4372psi79xiidw4k33nmyf6mk36h-python-asn1crypto-1.4.0/lib/python3.8/site-packages:/gnu/store/xgsczafbfkmqmanm87nx2qfyzp4h313i-python-pysocks-1.7.1/lib/python3.8/site-packages:/gnu/store/wand0zrwwnds6x636746116cfh3sy50k-python-pyopenssl-20.0.0/lib/python3.8/site-packages${PYTHONPATH:+:}$PYTHONPATH"
exec -a "$0" "/gnu/store/s2w1lq80x9vcwp5382kn98f5pi2k4b7b-python-onlykey-agent-1.1.12/bin/.onlykey_agent.py-real" "$@"
--8<---------------cut here---------------end--------------->8---

I think that the build phase that I need to modify is wrap. Does anyone know how to modify wrap phase to exclude a file from being wrapped? I am still a GNU Guile beginner so I am having trouble understanding definitions for wrap phase in guix/build/python-build-system.scm and wrap-program in guix/build/utils.scm.