git: 21188be2ad4e - main - www/py-pytauri-wheel: add test
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 06 Oct 2026 06:05:53 UTC
The branch main has been updated by yuri:
URL: https://cgit.FreeBSD.org/ports/commit/?id=21188be2ad4e10b7ecf612c701ea6bbf97a86b32
commit 21188be2ad4e10b7ecf612c701ea6bbf97a86b32
Author: Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2026-10-06 06:05:07 +0000
Commit: Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2026-10-06 06:05:48 +0000
www/py-pytauri-wheel: add test
---
www/py-pytauri-wheel/Makefile | 8 ++++
.../files/example-tauri-webiew-1.py | 49 ++++++++++++++++++++++
www/py-pytauri-wheel/files/mock_tauri/Tauri.toml | 10 +++++
3 files changed, 67 insertions(+)
diff --git a/www/py-pytauri-wheel/Makefile b/www/py-pytauri-wheel/Makefile
index 89b52cfc9d59..dc5f09ba1a52 100644
--- a/www/py-pytauri-wheel/Makefile
+++ b/www/py-pytauri-wheel/Makefile
@@ -718,7 +718,15 @@ CARGO_BUILDDEP= no
CARGO_TARGET_DIR= ${WRKSRC}/target
MAKE_ENV= ${CARGO_ENV}
+TEST_ENV= ${MAKE_ENV} PYTHONPATH=${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
DISTFILES+= ${DISTNAME}${EXTRACT_SUFX} # add PYPI-related file to DISTFILES
+do-test:
+ # run example-tauri-webiew-1.py
+ @${RM} -r ${WRKDIR}/mock_tauri
+ @${CP} -r ${FILESDIR}/mock_tauri ${WRKDIR}
+ @cd ${WRKDIR} && \
+ ${SETENV} ${TEST_ENV} MOCK_TAURI_DIR=${WRKDIR}/mock_tauri ${PYTHON_CMD} ${FILESDIR}/example-tauri-webiew-1.py
+
.include <bsd.port.mk>
diff --git a/www/py-pytauri-wheel/files/example-tauri-webiew-1.py b/www/py-pytauri-wheel/files/example-tauri-webiew-1.py
new file mode 100644
index 000000000000..80671160cb5e
--- /dev/null
+++ b/www/py-pytauri-wheel/files/example-tauri-webiew-1.py
@@ -0,0 +1,49 @@
+import os
+import sys
+from pathlib import Path
+
+# Inject these WebKit workaround flags before Tauri initializes
+os.environ["WEBKIT_DISABLE_DMABUF_RENDERER"] = "1"
+os.environ["WEBKIT_DISABLE_COMPOSITING_MODE"] = "1"
+
+from pytauri import WebviewUrl
+from pytauri.webview import WebviewWindowBuilder
+from pytauri_wheel.lib import builder_factory, context_factory
+
+def on_setup(app):
+ print("Tauri App has been successfully initialized!")
+
+ WebviewWindowBuilder.from_config(
+ app,
+ {
+ "label": "main",
+ "url": "https://google.com", # <-- Pass as a regular string
+ "title": "My Complete PyTauri App",
+ "width": 1024,
+ "height": 768,
+ "resizable": True
+ }
+ )
+
+
+def main():
+ # Identify our mock directory context
+ #mock_dir = Path("/tmp/mock_tauri")
+ mock_dir = Path(os.environ['MOCK_TAURI_DIR'])
+
+ # Generate context via positional-only argument lookup
+ context = context_factory(mock_dir)
+
+ # 3. Build the application instance with mandatory arguments
+ app = builder_factory().build(
+ context=context,
+ invoke_handler=None, # No background IPC commands registered yet
+ setup=on_setup # Register our window creation callback hook
+ )
+
+ # 4. Kick off the blocking application run cycle
+ sys.exit(app.run_return())
+
+if __name__ == "__main__":
+ main()
+
diff --git a/www/py-pytauri-wheel/files/mock_tauri/Tauri.toml b/www/py-pytauri-wheel/files/mock_tauri/Tauri.toml
new file mode 100644
index 000000000000..ef6ca706ff3d
--- /dev/null
+++ b/www/py-pytauri-wheel/files/mock_tauri/Tauri.toml
@@ -0,0 +1,10 @@
+productName = "mock-app"
+version = "0.1.0"
+identifier = "com.mock.app"
+
+[build]
+frontendDist = "./frontend"
+
+[bundle]
+active = true
+