~lattis/muon

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
2 2

[PATCH 0/1] python: add `python_installation.path()`

Details
Message ID
<D1EPSK1A6G0K.1M5UZ7VN5YYU9@gmail.com>
DKIM signature
pass
Download raw message
Hi,

I just noticed that I missed this method. The implementation is copied
from that of `external_program.full_path()`.

Thanks!

Seedo Paul (1):
  mod/python: add `python_installation.path()`

 src/functions/modules/python.c        | 21 +++++++++++++++++++++
 tests/project/muon/python/meson.build |  3 +++
 2 files changed, 24 insertions(+)


base-commit: 3a38f252b80488c28548fe9248246138df281c68
-- 
2.45.1

[PATCH 1/1] mod/python: add `python_installation.path()`

Details
Message ID
<D1EPSK1A7BZ9.FVHSIQVBS9IN@gmail.com>
In-Reply-To
<D1EPSK1A6G0K.1M5UZ7VN5YYU9@gmail.com> (view parent)
DKIM signature
pass
Download raw message
Patch: +24 -0
---
 src/functions/modules/python.c        | 21 +++++++++++++++++++++
 tests/project/muon/python/meson.build |  3 +++
 2 files changed, 24 insertions(+)

diff --git a/src/functions/modules/python.c b/src/functions/modules/python.c
index c5024ddb..2ff5db1d 100644
--- a/src/functions/modules/python.c
+++ b/src/functions/modules/python.c
@@ -395,6 +395,26 @@ func_python_installation_get_install_dir(struct workspace *wk, obj self, obj *re
	return get_install_dir(wk, self, pure, subdir, res);
}

static bool
func_python_installation_interpreter_path(struct workspace *wk, obj self, obj *res)
{
	if (!pop_args(wk, NULL, NULL)) {
		return false;
	}

	struct obj_python_installation *py = get_obj_python_installation(wk, self);
	struct obj_external_program *ep = get_obj_external_program(wk, py->prog);
	if (get_obj_array(wk, ep->cmd_array)->len > 1) {
		vm_error(wk,
			"cannot return the full_path() of an external program with multiple elements (have: %o)\n",
			ep->cmd_array);
		return false;
	}

	obj_array_index(wk, get_obj_external_program(wk, self)->cmd_array, 0, res);
	return true;
}

static obj
python_self_transform(struct workspace *wk, obj self)
{
@@ -429,5 +449,6 @@ struct func_impl impl_tbl_python_installation[] = {
	{ "has_path", func_python_installation_has_path, tc_bool },
	{ "has_variable", func_python_installation_has_var, tc_bool },
	{ "language_version", func_python_installation_language_version, tc_string },
	{ "path", func_python_installation_interpreter_path, tc_string },
	{ NULL, NULL },
};
diff --git a/tests/project/muon/python/meson.build b/tests/project/muon/python/meson.build
index fab0f045..e2b9e587 100644
--- a/tests/project/muon/python/meson.build
+++ b/tests/project/muon/python/meson.build
@@ -10,6 +10,9 @@ if py.language_version().version_compare('< 3.6')
    error('Invalid Python version, only >= 3.6 is supported.')
endif

interpreter_path = py.path()
message(f'path: @interpreter_path@')

py_nonexisting = import('nonexisting_python_b075e5a', required: false)

if py_nonexisting.found()
-- 
2.45.1
Details
Message ID
<svxxx7jwrajpbmlc62lhbyslasmikq2fobmf76vik6gllkvar4@4nivsogohgch>
In-Reply-To
<D1EPSK1A6G0K.1M5UZ7VN5YYU9@gmail.com> (view parent)
DKIM signature
pass
Download raw message
Thanks, merged as well.

Stone
Reply to thread Export thread (mbox)