Hi,

The test target didn't work in this port. Upstream has tests and has
them included in the release tarball, but they don't package the script
that runs the tests.

For now, I added the run-script to FILESDIR and asked upstream
to include it into the release in future. So, hopefully this file can
be removed again at some point.

I also added more optional dependencies that we have in ports to the
README file. The only missing one is mkvtoolnix (for mkvmerge), which is
currently broken.

OK?


Index: www/gallery-dl/Makefile
===================================================================
RCS file: /cvs/ports/www/gallery-dl/Makefile,v
diff -u -p -r1.12 Makefile
--- www/gallery-dl/Makefile     19 Jan 2025 07:25:32 -0000      1.12
+++ www/gallery-dl/Makefile     19 Jan 2025 11:44:09 -0000
@@ -4,6 +4,8 @@ MODPY_DISTV =           1.28.4
 DISTNAME =             gallery_dl-${MODPY_DISTV}
 PKGNAME =              ${DISTNAME:S/_/-/}
 CATEGORIES =           www
+REVISION =             0
+
 HOMEPAGE =             https://github.com/mikf/gallery-dl/
 
 MAINTAINER =           Stefan Hagen <sh+po...@codevoid.de>
@@ -18,5 +20,12 @@ MODPY_PYBUILD =              setuptools
 RUN_DEPENDS =          www/py-requests
 
 TEST_DEPENDS =         devel/py-test
+
+# the run_test script is available in the source,
+# but not in the release tarball.
+do-test:
+       mkdir -p ${WRKSRC}/scripts
+       cp -f ${FILESDIR}/run_tests.py ${WRKSRC}/scripts/
+       python${MODPY_VERSION} ${WRKSRC}/scripts/run_tests.py
 
 .include <bsd.port.mk>
Index: www/gallery-dl/files/run_tests.py
===================================================================
RCS file: www/gallery-dl/files/run_tests.py
diff -N www/gallery-dl/files/run_tests.py
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ www/gallery-dl/files/run_tests.py   19 Jan 2025 11:44:09 -0000
@@ -0,0 +1,46 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+# Copyright 2021 Mike Fährmann
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+
+import os
+import sys
+import unittest
+
+TEST_DIRECTORY = os.path.join(
+    os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "test")
+
+sys.path.insert(0, TEST_DIRECTORY)
+
+if len(sys.argv) <= 1:
+    TESTS = [
+        file.rpartition(".")[0]
+        for file in os.listdir(TEST_DIRECTORY)
+        if file.startswith("test_") and file != "test_results.py"
+    ]
+else:
+    TESTS = [
+        name if name.startswith("test_") else "test_" + name
+        for name in sys.argv[1:]
+    ]
+
+
+suite = unittest.TestSuite()
+
+for test in TESTS:
+    try:
+        module = __import__(test)
+    except ImportError:
+        print("unable to import", test)
+    else:
+        tests = unittest.defaultTestLoader.loadTestsFromModule(module)
+        suite.addTests(tests)
+
+if __name__ == "__main__":
+    result = unittest.TextTestRunner(verbosity=2).run(suite)
+    if result.errors or result.failures:
+        sys.exit(1)
Index: www/gallery-dl/pkg/README
===================================================================
RCS file: /cvs/ports/www/gallery-dl/pkg/README,v
diff -u -p -r1.1.1.1 README
--- www/gallery-dl/pkg/README   12 Nov 2023 11:19:39 -0000      1.1.1.1
+++ www/gallery-dl/pkg/README   19 Jan 2025 11:44:09 -0000
@@ -8,10 +8,11 @@ All supported websites can be listed wit
 Some features are only available after installing an optional
 dependency:
 
-ffmpeg            - Pixiv Ugoira conversion
-py3-socks         - SOCKS proxy support
-py3-brotli        - Brotli compression support
-py3-yaml          - YAML configuration file support
-py3-toml          - TOML configuration file support for Python<3.11
-py3-secretstorage - Keyring passwords (--cookies-from-browser)
-
+ffmpeg               - Pixiv Ugoira conversion
+py3-brotli           - Brotli compression support
+py3-secretstorage    - Keyring passwords (--cookies-from-browser)
+py3-socks            - SOCKS proxy support
+py3-toml             - TOML configuration file support for Python<3.11
+py3-yaml             - YAML configuration file support
+py3-zstandard        - Zstandard compression support
+yt-dlp or youtube-dl - HLS/DASH video downloads, ytdl integration

Reply via email to