* [gentoo-commits] repo/gentoo:master commit in: dev-util/meson-format-array/files/, dev-util/meson-format-array/
@ 2020-12-28 22:38 Mike Gilbert
0 siblings, 0 replies; only message in thread
From: Mike Gilbert @ 2020-12-28 22:38 UTC (permalink / raw
To: gentoo-commits
commit: 3e391ef7abaf60b6a6966121a586b6e69b43f080
Author: Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 28 22:22:14 2020 +0000
Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Mon Dec 28 22:32:58 2020 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3e391ef7
dev-util/meson-format-array: new package
Bug: https://bugs.gentoo.org/759433
Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>
.../meson-format-array/files/meson-format-array | 24 ++++++++++++++++++++++
.../meson-format-array/meson-format-array-0.ebuild | 22 ++++++++++++++++++++
dev-util/meson-format-array/metadata.xml | 8 ++++++++
3 files changed, 54 insertions(+)
diff --git a/dev-util/meson-format-array/files/meson-format-array b/dev-util/meson-format-array/files/meson-format-array
new file mode 100644
index 00000000000..a6d722dc30b
--- /dev/null
+++ b/dev-util/meson-format-array/files/meson-format-array
@@ -0,0 +1,24 @@
+#!/usr/bin/env python3
+
+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-util/meson-format-array/meson-format-array-0.ebuild b/dev-util/meson-format-array/meson-format-array-0.ebuild
new file mode 100644
index 00000000000..1d252e83121
--- /dev/null
+++ b/dev-util/meson-format-array/meson-format-array-0.ebuild
@@ -0,0 +1,22 @@
+# Copyright 2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+PYTHON_COMPAT=( python3_{6..9} )
+
+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 ~m68k ~mips ppc ppc64 ~riscv s390 sparc x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-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-util/meson-format-array/metadata.xml b/dev-util/meson-format-array/metadata.xml
new file mode 100644
index 00000000000..de09ffd8b08
--- /dev/null
+++ b/dev-util/meson-format-array/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person">
+ <email>floppym@gentoo.org</email>
+ <name>Mike Gilbert</name>
+ </maintainer>
+</pkgmetadata>
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2020-12-28 22:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-28 22:38 [gentoo-commits] repo/gentoo:master commit in: dev-util/meson-format-array/files/, dev-util/meson-format-array/ Mike Gilbert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox