public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Mike Gilbert" <floppym@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-util/meson-format-array/files/, dev-util/meson-format-array/
Date: Mon, 28 Dec 2020 22:38:31 +0000 (UTC)	[thread overview]
Message-ID: <1609194778.3e391ef7abaf60b6a6966121a586b6e69b43f080.floppym@gentoo> (raw)

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>


                 reply	other threads:[~2020-12-28 22:38 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1609194778.3e391ef7abaf60b6a6966121a586b6e69b43f080.floppym@gentoo \
    --to=floppym@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox