Created attachment 249842 [details] Git patch Hi. I am submitting a patch to include the python library python-elgato-streamdeck, version 0.9.5. Note 1. this version requires a patch. I have submitted the patch upstream, and it has been merged already upstream; however it will be fixed in the next release (version 0.9.6) Note 2. i have noticed that the generated PKG file installs everything properly; however, there is a left-over from the packaging system, in particular, I observe the following file: /usr/local/lib/python3.9/site-packages/StreamDeck/Transport/LibUSBHIDAPI.py.orig In my opinion, this file should not be present in the PKG file; however, I am not sure how I can remove it. Help? Suggestions? :-) Thanks!
Created attachment 250069 [details] This patch eliminates the .orig file from the created package So, after some digging, I found out how to make sure that the .orig file is not part of the PKG file. Therefore, I am submitting a new patch. Can you please check and if all OK, commit? Thanks!
Hello, Sugestions: 1. Use PyPI sdist instead of github tarball 2. build, lib, run depends could be corrected to: BUILD_DEPENDS= \ ${PYTHON_PKGNAMEPREFIX}setuptools>0:devel/py-setuptools@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}wheel>0:devel/py-wheel@${PY_FLAVOR} LIB_DEPENDS= libhidapi.so:comms/hidapi RUN_DEPENDS= \ ${PYTHON_PKGNAMEPREFIX}pillow>=8.1.1:graphics/py-pillow@${PY_FLAVOR} Doubts: 1. Is 'elgato-' prefix needed? PyPI package is registered as https://pypi.org/project/streamdeck/ without prefix. I did some research at repology.org and found that some linux distros use prefix, others don't. My opinion is to follow PyPI naming scheme. 2. I'm not familiar with this software but I'm noted that sdist includes a test suite. Could you check the possiblity of including a test target? Note: PyPI sdist seems to be in DOS encoding and it might be needed USES+=dos2unix.
Created attachment 250111 [details] Changes after acomments Hi, thanks for the suggestions for improvement; Accordingly, I have 1) changed from pulling from github to PyPI 2) corrected the build, lib, run depends, as suggested 3) included USES dos2unix (yes, it was required) For the name of the port, I am fine with having it py-streamdeck. Initially I just used the name from github. It probably is better to have only py-streamdeck, as the library, in the future, might support additional hardware, and therefore not be bound only to Elgato devices. Note: I guess that the title of the bug report should also be changed. I will check if I can do this. I have included the tests, as suggested. The tests do not use "conventional" python unit tests. I was able to check that the tests are running properly with 1) running with "make test", and 2) adding a patch that makes the tests break and re-run "make test" and confirming that the tests break. NOTE - of course I did not include the "breaking patch" in the attached file :-) it was only for testing.
Created attachment 250112 [details] Changes after comments Sorry - my bad. This new patch includes a small fix to the previous patch, to remove a portlint warning: WARN: Makefile: DISTNAME is ${PORTNAME}-${PORTVERSION} by default, you don't need to define DISTNAME. 0 fatal errors and 1 warning found.
All good. While we are here, could you give a try running pytest on test.py? My results are: --- platform freebsd15 -- Python 3.9.18, pytest-7.4.4, pluggy-1.4.0 rootdir: /wrkdirs/usr/ports/comms/py-streamdeck/work-py39/streamdeck-0.9.5 collected 3 items test.py EEE [100%] ====================================================================================================== ERRORS ====================================================================================================== ________________________________________________________________________________________ ERROR at setup of test_pil_helpers ________________________________________________________________________________________ file /wrkdirs/usr/ports/comms/py-streamdeck/work-py39/streamdeck-0.9.5/test/test.py, line 22 def test_pil_helpers(deck): E fixture 'deck' not found > available fixtures: cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory > use 'pytest --fixtures [testpath]' for help on them. --- Really curious where do we get "fixture 'deck' not found" from. But maybe this could mean that test suite is supported by pytest. Best method to do this test is using USE_PYTHON+=pytest and additional depends to TEST_DEPENDS.
(In reply to gatekeeper from comment #4) Don't worry about that. We fix it when port is ready.
Created attachment 250114 [details] Fixed patch including comments and pytest Thanks for the hint. I found out that the error comes directly from pytest - the root cause is that the test function requires an argument, and pytest calls this a fixture / requires a fixture to be able to properly call the function. I have made some changes to the test.py file and now the tests should be running properly :-)
(In reply to gatekeeper from comment #7) Well done!
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=e8c02a572f87a9118c02819c75c81bf30ec49c95 commit e8c02a572f87a9118c02819c75c81bf30ec49c95 Author: gatekeeper <tiago.gasiba@gmail.com> AuthorDate: 2024-04-20 22:04:04 +0000 Commit: Nuno Teixeira <eduardo@FreeBSD.org> CommitDate: 2024-04-20 22:07:19 +0000 comms/py-streamdeck: New port: Python library to control the Elgato Stream Deck - Submitter becomes maintainer This is an open source Python 3 library to control an Elgato Stream Deck directly, without the official software. This can allow you to create your own custom front-ends, such as a custom control front-end for home automation software. WWW: https://github.com/abcminiuser/python-elgato-streamdeck PR: 278266 comms/Makefile | 1 + comms/py-streamdeck/Makefile (new) | 30 ++++++++++++++++++++++ comms/py-streamdeck/distinfo (new) | 3 +++ ...-src_StreamDeck_Transport_LibUSBHIDAPI.py (new) | 10 ++++++++ comms/py-streamdeck/files/patch-test_test.py (new) | 19 ++++++++++++++ comms/py-streamdeck/pkg-descr (new) | 4 +++ 6 files changed, 67 insertions(+)
Committed, thanks!