public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-lang/jerryscript/files/, dev-lang/jerryscript/
Date: Sun, 23 May 2021 22:37:06 +0000 (UTC)	[thread overview]
Message-ID: <1621809419.6437ce06b88dbebbcd19d5afade4f8499b49c611.zmedico@gentoo> (raw)

commit:     6437ce06b88dbebbcd19d5afade4f8499b49c611
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun May 23 22:20:55 2021 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun May 23 22:36:59 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6437ce06

dev-lang/jerryscript: 2.4.0-r1 revbump to support USE=debugger

Package-Manager: Portage-3.0.18, Repoman-3.0.3
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

 .../files/jerryscript-2.4.0-python3.patch          | 88 ++++++++++++++++++++++
 ...pt-2.4.0.ebuild => jerryscript-2.4.0-r1.ebuild} | 30 +++++++-
 dev-lang/jerryscript/metadata.xml                  |  3 +
 3 files changed, 119 insertions(+), 2 deletions(-)

diff --git a/dev-lang/jerryscript/files/jerryscript-2.4.0-python3.patch b/dev-lang/jerryscript/files/jerryscript-2.4.0-python3.patch
new file mode 100644
index 00000000000..4a358ac5ce9
--- /dev/null
+++ b/dev-lang/jerryscript/files/jerryscript-2.4.0-python3.patch
@@ -0,0 +1,88 @@
+From 3f725c9a6e62048dcc7e1d0dd0f9c3e8d2e092f6 Mon Sep 17 00:00:00 2001
+From: Zac Medico <zmedico@gmail.com>
+Date: Sun, 23 May 2021 13:46:30 -0700
+Subject: [PATCH] Python debugger support for Python 3 (in addition to Python 2)
+
+https://github.com/jerryscript-project/jerryscript/pull/4678
+
+- Added ord builtin compatibility to pass through int arguments
+- Fixed JerryDebugger _parse_source method to decode bytes as utf8 strings
+- Fixed WebSocket send_message method to use packed_data[0:1] bytes slice
+
+JerryScript-DCO-1.0-Signed-off-by: Zac Medico <zmedico@gmail.com>
+---
+ jerry-debugger/jerry_client_main.py      | 26 ++++++++++++++++--------
+ jerry-debugger/jerry_client_websocket.py | 14 ++++++++++++-
+ 2 files changed, 31 insertions(+), 9 deletions(-)
+
+diff --git a/jerry-debugger/jerry_client_main.py b/jerry-debugger/jerry_client_main.py
+index e65d0e14..b877a159 100644
+--- a/jerry-debugger/jerry_client_main.py
++++ b/jerry-debugger/jerry_client_main.py
+@@ -151,2 +151,12 @@ def arguments_parse():
+ 
++if sys.version_info.major >= 3:
++    _ord_orig = ord
++    def _ord_compat(c):
++        if isinstance(c, int):
++            return c
++        return _ord_orig(c)
++    # pylint: disable=redefined-builtin
++    ord = _ord_compat
++
++
+ class JerryBreakpoint(object):
+@@ -866,5 +876,5 @@ class JerryDebugger(object):
+     def _parse_source(self, data):
+-        source_code = ""
+-        source_code_name = ""
+-        function_name = ""
++        source_code = b""
++        source_code_name = b""
++        function_name = b""
+         stack = [{"line": 1,
+@@ -905,7 +915,7 @@ class JerryDebugger(object):
+ 
+-                stack.append({"source": source_code,
+-                              "source_name": source_code_name,
++                stack.append({"source": source_code.decode("utf8"),
++                              "source_name": source_code_name.decode("utf8"),
+                               "line": position[0],
+                               "column": position[1],
+-                              "name": function_name,
++                              "name": function_name.decode("utf8"),
+                               "lines": [],
+@@ -939,4 +949,4 @@ class JerryDebugger(object):
+                 if not stack:
+-                    func_desc["source"] = source_code
+-                    func_desc["source_name"] = source_code_name
++                    func_desc["source"] = source_code.decode("utf8")
++                    func_desc["source_name"] = source_code_name.decode("utf8")
+ 
+diff --git a/jerry-debugger/jerry_client_websocket.py b/jerry-debugger/jerry_client_websocket.py
+index fe2c761a..07c75e53 100644
+--- a/jerry-debugger/jerry_client_websocket.py
++++ b/jerry-debugger/jerry_client_websocket.py
+@@ -17,2 +17,3 @@
+ import struct
++import sys
+ 
+@@ -22,2 +23,13 @@ WEBSOCKET_FIN_BIT = 0x80
+ 
++
++if sys.version_info.major >= 3:
++    _ord_orig = ord
++    def _ord_compat(c):
++        if isinstance(c, int):
++            return c
++        return _ord_orig(c)
++    # pylint: disable=redefined-builtin
++    ord = _ord_compat
++
++
+ class WebSocket(object):
+@@ -94,3 +106,3 @@ class WebSocket(object):
+                               WEBSOCKET_BINARY_FRAME | WEBSOCKET_FIN_BIT,
+-                              WEBSOCKET_FIN_BIT + struct.unpack(byte_order + "B", packed_data[0])[0],
++                              WEBSOCKET_FIN_BIT + struct.unpack(byte_order + "B", packed_data[0:1])[0],
+                               0) + packed_data[1:]

diff --git a/dev-lang/jerryscript/jerryscript-2.4.0.ebuild b/dev-lang/jerryscript/jerryscript-2.4.0-r1.ebuild
similarity index 58%
rename from dev-lang/jerryscript/jerryscript-2.4.0.ebuild
rename to dev-lang/jerryscript/jerryscript-2.4.0-r1.ebuild
index d3949f02d59..369fd92e37c 100644
--- a/dev-lang/jerryscript/jerryscript-2.4.0.ebuild
+++ b/dev-lang/jerryscript/jerryscript-2.4.0-r1.ebuild
@@ -3,7 +3,8 @@
 
 EAPI=7
 
-inherit cmake
+PYTHON_COMPAT=(python3_{7,8,9})
+inherit cmake python-any-r1
 
 DESCRIPTION="Ultra-lightweight JavaScript engine for the Internet of Things"
 HOMEPAGE="https://github.com/jerryscript-project/jerryscript"
@@ -12,13 +13,22 @@ SRC_URI="https://github.com/jerryscript-project/${PN}/archive/refs/tags/v${PV}.t
 LICENSE="Apache-2.0"
 SLOT="0"
 KEYWORDS="~amd64"
-IUSE=""
+IUSE="debugger"
+RDEPEND="debugger? ( ${PYTHON_DEPS} )"
+BDEPEND="${RDEPEND}"
+
+PATCHES=(
+	"${FILESDIR}/jerryscript-2.4.0-python3.patch"
+)
 
 src_prepare() {
 	find . -name CMakeLists.txt -print0 | xargs -0 sed -i \
 		-e "s:lib/pkgconfig:$(get_libdir)/pkgconfig:" \
 		-e "s:DESTINATION lib):DESTINATION $(get_libdir)):" \
 		|| die
+	find . -name '*.pc.in' -print0 | xargs -0 sed -i \
+		-e "s|/lib\$|/$(get_libdir)|" \
+		|| die
 	cmake_src_prepare
 }
 
@@ -40,5 +50,21 @@ src_configure() {
 }
 
 src_install() {
+	local jerry_debugger_dir
 	cmake_src_install
+
+	if use debugger; then
+		jerry_debugger_dir=/usr/$(get_libdir)/jerryscript/jerry-debugger
+		insinto "${jerry_debugger_dir}"
+		doins jerry-debugger/*.py
+		python_optimize "${ED}${jerry_debugger_dir}"
+
+		cat <<-EOF > "${T}/jerry-debugger"
+		#!/bin/sh
+		export PYTHONPATH=${EPREFIX}${jerry_debugger_dir}
+		exec python "${jerry_debugger_dir}/jerry_client.py" "\$@"
+		EOF
+
+		dobin "${T}"/jerry-debugger
+	fi
 }

diff --git a/dev-lang/jerryscript/metadata.xml b/dev-lang/jerryscript/metadata.xml
index 0c73846f82d..a062390ea35 100644
--- a/dev-lang/jerryscript/metadata.xml
+++ b/dev-lang/jerryscript/metadata.xml
@@ -9,4 +9,7 @@
 		<bugs-to>https://github.com/jerryscript-project/jerryscript/issues</bugs-to>
 		<remote-id type="github">jerryscript-project/jerryscript</remote-id>
 	</upstream>
+	<use>
+		<flag name="debugger">Install jerry-debugger</flag>
+	</use>
 </pkgmetadata>


             reply	other threads:[~2021-05-23 22:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-23 22:37 Zac Medico [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-01-02  0:28 [gentoo-commits] repo/gentoo:master commit in: dev-lang/jerryscript/files/, dev-lang/jerryscript/ Zac Medico

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=1621809419.6437ce06b88dbebbcd19d5afade4f8499b49c611.zmedico@gentoo \
    --to=zmedico@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