unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* Python Package Build Issue
@ 2021-08-24 12:29 Antwane Mason
  2021-08-26 12:11 ` Antwane Mason
  0 siblings, 1 reply; 2+ messages in thread
From: Antwane Mason @ 2021-08-24 12:29 UTC (permalink / raw)
  To: help-guix

I am trying to package a fido2 python library with the ultimate goal of
packaging the cli for a hardware password manager, 2FA authenticator, and
private key store called onlykey.

While building the package definition obtained from guix importer, I get
the following stacktrace. From googling it seems as though this is due to
trying to use windows types on a linux machine but I'm not sure how to fix
or correct this as I'm not sure why this test wasn't filtered out. Any
guidance would be appreciated.

-------------------------------------------------------------------------
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "setup.py", line 46, in <module>
    setup(
  File
"/gnu/store/9w9jvy3bgjg4qaqmrij01nbppiccqr7c-python-3.8.2/lib/python3.8/site-packages/setuptools/__init__.py",
line 145, in setup
    return distutils.core.setup(**attrs)
  File
"/gnu/store/9w9jvy3bgjg4qaqmrij01nbppiccqr7c-python-3.8.2/lib/python3.8/distutils/core.py",
line 148, in setup
    dist.run_commands()
  File
"/gnu/store/9w9jvy3bgjg4qaqmrij01nbppiccqr7c-python-3.8.2/lib/python3.8/distutils/dist.py",
line 966, in run_commands
    self.run_command(cmd)
  File
"/gnu/store/9w9jvy3bgjg4qaqmrij01nbppiccqr7c-python-3.8.2/lib/python3.8/distutils/dist.py",
line 985, in run_command
    cmd_obj.run()
  File
"/gnu/store/9w9jvy3bgjg4qaqmrij01nbppiccqr7c-python-3.8.2/lib/python3.8/site-packages/setuptools/command/test.py",
line 229, in run
    self.run_tests()
  File
"/gnu/store/9w9jvy3bgjg4qaqmrij01nbppiccqr7c-python-3.8.2/lib/python3.8/site-packages/setuptools/command/test.py",
line 247, in run_tests
    test = unittest.main(
  File
"/gnu/store/9w9jvy3bgjg4qaqmrij01nbppiccqr7c-python-3.8.2/lib/python3.8/unittest/main.py",
line 100, in __init__
    self.parseArgs(argv)
  File
"/gnu/store/9w9jvy3bgjg4qaqmrij01nbppiccqr7c-python-3.8.2/lib/python3.8/unittest/main.py",
line 124, in parseArgs
    self._do_discovery(argv[2:])
  File
"/gnu/store/9w9jvy3bgjg4qaqmrij01nbppiccqr7c-python-3.8.2/lib/python3.8/unittest/main.py",
line 244, in _do_discovery
    self.createTests(from_discovery=True, Loader=Loader)
  File
"/gnu/store/9w9jvy3bgjg4qaqmrij01nbppiccqr7c-python-3.8.2/lib/python3.8/unittest/main.py",
line 154, in createTests
    self.test = loader.discover(self.start, self.pattern, self.top)
  File
"/gnu/store/9w9jvy3bgjg4qaqmrij01nbppiccqr7c-python-3.8.2/lib/python3.8/unittest/loader.py",
line 349, in discover
    tests = list(self._find_tests(start_dir, pattern))
  File
"/gnu/store/9w9jvy3bgjg4qaqmrij01nbppiccqr7c-python-3.8.2/lib/python3.8/unittest/loader.py",
line 405, in _find_tests
    tests, should_recurse = self._find_test_path(
  File
"/gnu/store/9w9jvy3bgjg4qaqmrij01nbppiccqr7c-python-3.8.2/lib/python3.8/unittest/loader.py",
line 483, in _find_test_path
    tests = self.loadTestsFromModule(package, pattern=pattern)
  File
"/gnu/store/9w9jvy3bgjg4qaqmrij01nbppiccqr7c-python-3.8.2/lib/python3.8/site-packages/setuptools/command/test.py",
line 55, in loadTestsFromModule
    tests.append(self.loadTestsFromName(submodule))
  File
"/gnu/store/9w9jvy3bgjg4qaqmrij01nbppiccqr7c-python-3.8.2/lib/python3.8/unittest/loader.py",
line 154, in loadTestsFromName
    module = __import__(module_name)
  File
"/tmp/guix-build-python-fido2-0.9.1.drv-0/fido2-0.9.1/fido2/win_api.py",
line 43, in <module>
    from ctypes.wintypes import BOOL, DWORD, LONG, LPCWSTR, HWND
  File
"/gnu/store/9w9jvy3bgjg4qaqmrij01nbppiccqr7c-python-3.8.2/lib/python3.8/ctypes/wintypes.py",
line 20, in <module>
    class VARIANT_BOOL(ctypes._SimpleCData):
ValueError: _type_ 'v' not supported
-------------------------------------------------------------------------

Here is the package definition in case it is useful.

-------------------------------------------------------------------------
(define-public python-fido2
  (package
  (name "python-fido2")
  (version "0.9.1")
  (source
    (origin
      (method url-fetch)
      (uri (pypi-uri "fido2" version))
      (sha256
        (base32
          "0vpyknka7wa4jl1xhvhli48wk70dih7hm45kdrchf8wf4cjyx046"))))
  (build-system python-build-system)
  (propagated-inputs
    `(("python-cryptography" ,python-cryptography)
      ("python-six" ,python-six)))
  (home-page
    "https://github.com/Yubico/python-fido2")
  (synopsis "Python based FIDO 2.0 library")
  (description "Python based FIDO 2.0 library")
; temporarily false. it's mixed license with bsd, apache, and mit
  (license #f)))
-------------------------------------------------------------------------

Regards,
Antwane

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Python Package Build Issue
  2021-08-24 12:29 Python Package Build Issue Antwane Mason
@ 2021-08-26 12:11 ` Antwane Mason
  0 siblings, 0 replies; 2+ messages in thread
From: Antwane Mason @ 2021-08-26 12:11 UTC (permalink / raw)
  To: help-guix

I was able to solve the issue with packaging python-fido2 definition. I
think the problem was that because the setup.py didn't specify where to
look for unit tests, it was loading up all of the project's modules to look
for them. Since this project is cross-platform, it contained code that was
windows specific in win_api.py. Changing the check build phase to invoke
"pipenv run test"  fixed the issue. This project recommends using pipenv to
run its tests in its README. Below is the updated package definition for
reference. Once I get python-onlykey and its dependencies built, I plan on
submitting a patch.

-------------------------------------------------------------------------
(define-public python-fido2
  (package
  (name "python-fido2")
  (version "0.9.1")
  (source
    (origin
      (method url-fetch)
      (uri (pypi-uri "fido2" version))
      (sha256
        (base32
          "0vpyknka7wa4jl1xhvhli48wk70dih7hm45kdrchf8wf4cjyx046"))))
  (build-system python-build-system)
  (arguments
     '(#:phases
       (modify-phases %standard-phases
         (replace 'check
           (lambda* (#:key tests? #:allow-other-keys)
             (when tests?
               (invoke "pipenv" "run" "test")))))))
  (propagated-inputs
    `(("python-cryptography" ,python-cryptography)
      ("python-six" ,python-six)))
  (native-inputs
   `(("python-pipenv" ,python-pipenv)))
  (home-page
    "https://github.com/Yubico/python-fido2")
  (synopsis "Python based FIDO 2.0 library")
  (description "Python based FIDO 2.0 library")
  (license '(license:bsd-2 license:asl2.0 license:mpl2.0))))
-------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-26 12:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-24 12:29 Python Package Build Issue Antwane Mason
2021-08-26 12:11 ` Antwane Mason

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 NNTP newsgroup(s).