summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2024-01-13 19:03:46 +0100
committerMichał Górny <mgorny@gentoo.org>2024-01-13 21:11:59 +0100
commitdb90c393875ad4f98de526b1e124fa7dd7dac04f (patch)
tree006d2f11625c233cc9624c12a4e206304e8cbf54 /dev-build
parentxfce-extra/xfce4-notes-plugin: Bump to 1.11.0 (diff)
downloadgentoo-db90c393875ad4f98de526b1e124fa7dd7dac04f.tar.gz
gentoo-db90c393875ad4f98de526b1e124fa7dd7dac04f.tar.bz2
gentoo-db90c393875ad4f98de526b1e124fa7dd7dac04f.zip
Move {dev-util → dev-build}/meson-format-array
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-build')
-rw-r--r--dev-build/meson-format-array/files/meson-format-array26
-rw-r--r--dev-build/meson-format-array/meson-format-array-0.ebuild22
-rw-r--r--dev-build/meson-format-array/metadata.xml9
3 files changed, 57 insertions, 0 deletions
diff --git a/dev-build/meson-format-array/files/meson-format-array b/dev-build/meson-format-array/files/meson-format-array
new file mode 100644
index 000000000000..d2bf49ba8e59
--- /dev/null
+++ b/dev-build/meson-format-array/files/meson-format-array
@@ -0,0 +1,26 @@
+#!/usr/bin/env python3
+# Copyright 2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+import itertools
+import shlex
+import sys
+
+def quote(s):
+ return "'" + s.replace("\\", "\\\\").replace("'", "\\'") + "'"
+
+def main(args):
+ # Split each argument according to shell rules
+ args = (shlex.split(x) for x in args)
+
+ # Flatten the resulting list of lists
+ args = itertools.chain.from_iterable(args)
+
+ # Add quotes and escape embedded quotes
+ args = (quote(x) for x in args)
+
+ # Format the result
+ print("[" + ", ".join(args) + "]")
+
+if __name__ == "__main__":
+ main(sys.argv[1:])
diff --git a/dev-build/meson-format-array/meson-format-array-0.ebuild b/dev-build/meson-format-array/meson-format-array-0.ebuild
new file mode 100644
index 000000000000..e9b3d6f92bc7
--- /dev/null
+++ b/dev-build/meson-format-array/meson-format-array-0.ebuild
@@ -0,0 +1,22 @@
+# Copyright 2020-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+PYTHON_COMPAT=( python3_{10..12} )
+
+inherit python-r1
+
+DESCRIPTION="Format shell expressions into a meson array"
+HOMEPAGE="https://wiki.gentoo.org/wiki/No_homepage"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
+
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+RDEPEND="${PYTHON_DEPS}"
+S="${WORKDIR}"
+
+src_install() {
+ python_foreach_impl python_doscript "${FILESDIR}"/meson-format-array
+}
diff --git a/dev-build/meson-format-array/metadata.xml b/dev-build/meson-format-array/metadata.xml
new file mode 100644
index 000000000000..f684895450ba
--- /dev/null
+++ b/dev-build/meson-format-array/metadata.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person">
+ <email>floppym@gentoo.org</email>
+ <name>Mike Gilbert</name>
+ </maintainer>
+ <stabilize-allarches/>
+</pkgmetadata>