summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2023-12-13 04:17:03 +0000
committerSam James <sam@gentoo.org>2023-12-13 04:17:16 +0000
commit6fec13b693fcf00b4947f5934a4c4c9cba413d3d (patch)
tree962a05c0155e7a281ad658be84df2f927f883965 /dev-python/nodeenv
parentdev-libs/libxml2: add 2.12.3 (diff)
downloadgentoo-6fec13b693fcf00b4947f5934a4c4c9cba413d3d.tar.gz
gentoo-6fec13b693fcf00b4947f5934a4c4c9cba413d3d.tar.bz2
gentoo-6fec13b693fcf00b4947f5934a4c4c9cba413d3d.zip
dev-python/nodeenv: drop which dependency
Bug: https://github.com/ekalinin/nodeenv/issues/333 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'dev-python/nodeenv')
-rw-r--r--dev-python/nodeenv/files/nodeenv-1.8.0-which-hunt.patch64
-rw-r--r--dev-python/nodeenv/nodeenv-1.8.0-r1.ebuild33
2 files changed, 97 insertions, 0 deletions
diff --git a/dev-python/nodeenv/files/nodeenv-1.8.0-which-hunt.patch b/dev-python/nodeenv/files/nodeenv-1.8.0-which-hunt.patch
new file mode 100644
index 000000000000..58d3275e9568
--- /dev/null
+++ b/dev-python/nodeenv/files/nodeenv-1.8.0-which-hunt.patch
@@ -0,0 +1,64 @@
+https://github.com/ekalinin/nodeenv/issues/333
+https://github.com/ekalinin/nodeenv/pull/346
+
+From 0d3ebaf7e13175e2871f59856f29d880a4cb3acf Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Wed, 13 Dec 2023 04:13:24 +0000
+Subject: [PATCH] Remove usage of non-portable `which`
+
+* Use Python's shutil.which() instead of shelling out to `which` to find Python 2
+* Use `command -v` instead of `which` in README
+
+Fixes: https://github.com/ekalinin/nodeenv/issues/333
+---
+ README.rst | 2 +-
+ README.ru.rst | 2 +-
+ nodeenv.py | 8 ++------
+ 3 files changed, 4 insertions(+), 8 deletions(-)
+
+diff --git a/README.rst b/README.rst
+index c9e130b..3459572 100644
+--- a/README.rst
++++ b/README.rst
+@@ -211,7 +211,7 @@ environment::
+
+ $ workon my_env
+ $ npm install -g coffee-script
+- $ which coffee
++ $ command -v coffee
+ /home/monty/virtualenvs/my_env/bin/coffee
+
+ Creating a virtual environment with a custom prompt:
+diff --git a/README.ru.rst b/README.ru.rst
+index c3eb130..2cc821e 100644
+--- a/README.ru.rst
++++ b/README.ru.rst
+@@ -155,7 +155,7 @@ python'а::
+
+ $ workon my_env
+ $ npm install -g coffee-script
+- $ which coffee
++ $ command -v coffee
+ /home/monty/virtualenvs/my_env/bin/coffee
+
+
+diff --git a/nodeenv.py b/nodeenv.py
+index 9d5dd06..183ded2 100644
+--- a/nodeenv.py
++++ b/nodeenv.py
+@@ -707,12 +707,8 @@ def build_node_from_src(env_dir, src_dir, node_src_dir, args):
+ # Currently, the node.js build scripts are using python2.*,
+ # therefore we need to temporarily point python exec to the
+ # python 2.* version in this case.
+- try:
+- _, which_python2_output = callit(
+- ['which', 'python2'], args.verbose, True, node_src_dir, env
+- )
+- python2_path = which_python2_output[0]
+- except (OSError, IndexError):
++ python2_path = shutil.which('python2')
++ if not python2_path:
+ raise OSError(
+ 'Python >=3.0 virtualenv detected, but no python2 '
+ 'command (required for building node.js) was found'
+
diff --git a/dev-python/nodeenv/nodeenv-1.8.0-r1.ebuild b/dev-python/nodeenv/nodeenv-1.8.0-r1.ebuild
new file mode 100644
index 000000000000..71ae564e69fb
--- /dev/null
+++ b/dev-python/nodeenv/nodeenv-1.8.0-r1.ebuild
@@ -0,0 +1,33 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=setuptools
+PYTHON_COMPAT=( python3_{10..12} )
+
+inherit distutils-r1
+
+DESCRIPTION="Node.js virtual environment builder"
+HOMEPAGE="
+ https://github.com/ekalinin/nodeenv/
+ https://pypi.org/project/nodeenv/
+"
+SRC_URI="
+ https://github.com/ekalinin/nodeenv/archive/${PV}.tar.gz
+ -> ${P}.gh.tar.gz
+"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~arm64 ~hppa ~ppc ~ppc64 ~x86"
+
+# requires network access
+RESTRICT="test"
+PROPERTIES="test_network"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-1.8.0-which-hunt.patch
+)
+
+distutils_enable_tests pytest