From 1552f3e1a064fe762e2807a63d1448d71d2731c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Silvia=20Gonz=C3=A1lez=20Rodr=C3=ADguez?= Date: Fri, 31 Jan 2025 21:09:50 +0100 Subject: [PATCH] Convert contributors list script to Python --- resources/text/CMakeLists.txt | 2 +- resources/text/get_contributors.py | 16 ++++++++++++++++ resources/text/get_contributors.sh | 10 ---------- 3 files changed, 17 insertions(+), 11 deletions(-) create mode 100644 resources/text/get_contributors.py delete mode 100755 resources/text/get_contributors.sh diff --git a/resources/text/CMakeLists.txt b/resources/text/CMakeLists.txt index ce27b010..239b6042 100644 --- a/resources/text/CMakeLists.txt +++ b/resources/text/CMakeLists.txt @@ -9,7 +9,7 @@ add_custom_target( ) execute_process( - COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/get_contributors.sh + COMMAND python3 ${CMAKE_CURRENT_SOURCE_DIR}/get_contributors.py WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ #COMMAND_ERROR_IS_FATAL ANY ) diff --git a/resources/text/get_contributors.py b/resources/text/get_contributors.py new file mode 100644 index 00000000..4f83f425 --- /dev/null +++ b/resources/text/get_contributors.py @@ -0,0 +1,16 @@ +import subprocess + +git_output = subprocess.run( + ["git", "shortlog", "-sn", "--no-merges"], capture_output=True, text=True +) +lines = git_output.stdout.splitlines() +names = [line.partition("\t")[-1] for line in lines] + +text = '

' +for name in names: + text = text + name + "
\n" +text = text + "

" + +file = open("gen_contributors.html", "w") +file.write(text) +file.close() diff --git a/resources/text/get_contributors.sh b/resources/text/get_contributors.sh deleted file mode 100755 index 58ba6cf1..00000000 --- a/resources/text/get_contributors.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -set -eo pipefail - -git shortlog -sn --no-merges \ -| awk '{ \ - printf "

"; \ - for (i=2; i" \ - }' \ -> gen_contributors.html