* [ptxdist] [RFC PATCH] repology: python WIP
@ 2025-06-13 18:47 Bruno Thomsen
0 siblings, 0 replies; only message in thread
From: Bruno Thomsen @ 2025-06-13 18:47 UTC (permalink / raw)
To: ptxdist; +Cc: bruno.thomsen
'ptxdist-repology' must depend on 'host-system-python3' for 'python3'!
Signed-off-by: Bruno Thomsen <bruno.thomsen@gmail.com>
---
I'm stuck in converting repology command from Bash/Makefile to Bash/Python as
it needs to depend on host-system-python3 but I simply do not know how
to do that. So any pointers would be helpful.
bin/ptxdist | 6 ++++++
rules/post/ptxd_make_repology.make | 21 +++++++++++++++++++++
scripts/bash_completion | 2 +-
scripts/report/repology.py | 25 +++++++++++++++++++++++++
4 files changed, 53 insertions(+), 1 deletion(-)
create mode 100644 rules/post/ptxd_make_repology.make
create mode 100755 scripts/report/repology.py
diff --git a/bin/ptxdist b/bin/ptxdist
index 66b46c6da..64a1cb9f7 100755
--- a/bin/ptxdist
+++ b/bin/ptxdist
@@ -799,6 +799,7 @@ Misc:
variable and print the contents of this variable
licensecheck check md5sums of license files for all packages
lint run some basic checks for the bsp and PTXdist
+ repology generate repology JSON for PTXdist
list-packages print a list of all selected packages
local-src <pkg> [<directory>] overwrite a package source with a locally provided
directory containing the sourcecode.
@@ -1916,6 +1917,11 @@ EOF
ptxd_bailout "lint checks failed"
fi
;;
+ repology)
+ check_premake_compiler &&
+ ptxd_make_log ptxdist-repology
+ exit
+ ;;
list-packages)
check_config &&
check_deps &&
diff --git a/rules/post/ptxd_make_repology.make b/rules/post/ptxd_make_repology.make
new file mode 100644
index 000000000..3fad8e248
--- /dev/null
+++ b/rules/post/ptxd_make_repology.make
@@ -0,0 +1,21 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2025 by Bruno Thomsen <bruno.thomsen@gmail.com>
+# 2025 by Ladislav Michl <ladis@triops.cz>
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+PHONY += ptxdist-repology
+
+# Use '=' to delay $(shell ...) calls until this is needed
+PTX_REPOLOGY_PY = $(call ptx/in-path, PTXDIST_PATH_SCRIPTS, report/repology.py)
+
+ptx/repology = \
+ @$(call world/execute, PTX_REPOLOGY, $(PTX_REPOLOGY_PY))
+
+ptxdist-repology:
+ @$(call ptx/repology)
+
+# vim: syntax=make
diff --git a/scripts/bash_completion b/scripts/bash_completion
index 4bff2d4b6..2bb21a848 100644
--- a/scripts/bash_completion
+++ b/scripts/bash_completion
@@ -123,7 +123,7 @@ _ptxdist_completion()
clean)
COMPREPLY=( $( compgen -W root -- $cur ) )
;&
- get|extract|prepare|compile|install|targetinstall|tags|urlcheck|licensecheck|package-info|cargosync)
+ get|extract|prepare|compile|install|targetinstall|tags|urlcheck|licensecheck|repology|package-info|cargosync)
COMPREPLY+=( $( compgen -W "$(__ptxdist_completion_packages)" -- $cur ) )
;;
drop)
diff --git a/scripts/report/repology.py b/scripts/report/repology.py
new file mode 100755
index 000000000..5e9d562cd
--- /dev/null
+++ b/scripts/report/repology.py
@@ -0,0 +1,25 @@
+#!/usr/bin/env python3
+#
+# Copyright (C) 2025 by Bruno Thomsen <bruno.thomsen@gmail.com>
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+from os import environ
+
+from report.report import ReportException
+
+
+def main():
+ print("Repology script")
+ print(environ)
+ exit(0)
+
+if __name__ == "__main__":
+ try:
+ main()
+ except ReportException as e:
+ print(f'Repology report failed: {e.args[0]}')
+ exit(1)
+
--
2.49.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-06-13 18:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-13 18:47 [ptxdist] [RFC PATCH] repology: python WIP Bruno Thomsen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox