fix: noconfirm auto-selects first AUR match
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import @tachyon_module@ as tachyon
|
||||
|
||||
result = tachyon.phaserize('shoot')
|
||||
|
||||
if not isinstance(result, int):
|
||||
raise SystemExit('Returned result not an integer.')
|
||||
|
||||
if result != 1:
|
||||
raise SystemExit('Returned result {} is not 1.'.format(result))
|
||||
@@ -0,0 +1,15 @@
|
||||
pylib = py.extension_module('tachyon',
|
||||
'tachyon_module.c',
|
||||
c_args: '-DMESON_MODULENAME="tachyon"',
|
||||
install: true,
|
||||
)
|
||||
|
||||
pylib2 = py2.extension_module('tachyon',
|
||||
'tachyon_module.c',
|
||||
c_args: '-DMESON_MODULENAME="tachyon"',
|
||||
install: true,
|
||||
)
|
||||
|
||||
subdir('nested')
|
||||
subdir('wrongdir')
|
||||
pypathdir = meson.current_build_dir()
|
||||
@@ -0,0 +1,32 @@
|
||||
py.extension_module('tachyon',
|
||||
'../tachyon_module.c',
|
||||
c_args: '-DMESON_MODULENAME="nested.tachyon"',
|
||||
install: true,
|
||||
subdir: 'nested'
|
||||
)
|
||||
py.install_sources(
|
||||
configure_file(
|
||||
input: '../../blaster.py.in',
|
||||
output: 'blaster.py',
|
||||
configuration: {'tachyon_module': 'nested.tachyon'}
|
||||
),
|
||||
pure: false,
|
||||
subdir: 'nested',
|
||||
)
|
||||
|
||||
|
||||
py2.extension_module('tachyon',
|
||||
'../tachyon_module.c',
|
||||
c_args: '-DMESON_MODULENAME="nested.tachyon"',
|
||||
install: true,
|
||||
subdir: 'nested'
|
||||
)
|
||||
py2.install_sources(
|
||||
configure_file(
|
||||
input: '../../blaster.py.in',
|
||||
output: 'blaster.py',
|
||||
configuration: {'tachyon_module': 'nested.tachyon'}
|
||||
),
|
||||
pure: false,
|
||||
subdir: 'nested',
|
||||
)
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
Copyright 2018 The Meson development team
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
/* A very simple Python extension module. */
|
||||
|
||||
#include <Python.h>
|
||||
#include <string.h>
|
||||
|
||||
static PyObject* phaserize(PyObject *self, PyObject *args) {
|
||||
const char *message;
|
||||
int result;
|
||||
|
||||
if(!PyArg_ParseTuple(args, "s", &message))
|
||||
return NULL;
|
||||
|
||||
result = strcmp(message, "shoot") ? 0 : 1;
|
||||
#if PY_VERSION_HEX < 0x03000000
|
||||
return PyInt_FromLong(result);
|
||||
#else
|
||||
return PyLong_FromLong(result);
|
||||
#endif
|
||||
}
|
||||
|
||||
static PyMethodDef TachyonMethods[] = {
|
||||
{"phaserize", phaserize, METH_VARARGS,
|
||||
"Shoot tachyon cannons."},
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
|
||||
#if PY_VERSION_HEX < 0x03000000
|
||||
PyMODINIT_FUNC inittachyon(void) {
|
||||
Py_InitModule("tachyon", TachyonMethods);
|
||||
}
|
||||
#else
|
||||
static struct PyModuleDef tachyonmodule = {
|
||||
PyModuleDef_HEAD_INIT,
|
||||
"tachyon",
|
||||
NULL,
|
||||
-1,
|
||||
TachyonMethods
|
||||
};
|
||||
|
||||
PyMODINIT_FUNC PyInit_tachyon(void) {
|
||||
return PyModule_Create(&tachyonmodule);
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,12 @@
|
||||
py.extension_module('tachyon',
|
||||
'../tachyon_module.c',
|
||||
c_args: '-DMESON_MODULENAME="tachyon"',
|
||||
install: true,
|
||||
install_dir: get_option('libdir')
|
||||
)
|
||||
py2.extension_module('tachyon',
|
||||
'../tachyon_module.c',
|
||||
c_args: '-DMESON_MODULENAME="tachyon"',
|
||||
install: true,
|
||||
install_dir: get_option('libdir')
|
||||
)
|
||||
@@ -0,0 +1,57 @@
|
||||
project('Python extension module', 'c',
|
||||
default_options : ['buildtype=release', 'werror=true', 'python.bytecompile=-1'])
|
||||
# Because Windows Python ships only with optimized libs,
|
||||
# we must build this project the same way.
|
||||
|
||||
if meson.backend() != 'ninja'
|
||||
error('MESON_SKIP_TEST: Ninja backend required')
|
||||
endif
|
||||
|
||||
|
||||
py_mod = import('python')
|
||||
py = py_mod.find_installation()
|
||||
py2 = py_mod.find_installation('python2', required: get_option('python2'), disabler: true)
|
||||
py_dep = py.dependency(required: false)
|
||||
|
||||
if not py_dep.found()
|
||||
error('MESON_SKIP_TEST: Python libraries not found.')
|
||||
endif
|
||||
|
||||
subdir('ext')
|
||||
|
||||
blaster = configure_file(
|
||||
input: 'blaster.py.in',
|
||||
output: 'blaster.py',
|
||||
configuration: {'tachyon_module': 'tachyon'}
|
||||
)
|
||||
|
||||
test('extmod',
|
||||
py,
|
||||
args : blaster,
|
||||
env : ['PYTHONPATH=' + pypathdir])
|
||||
|
||||
py.install_sources(blaster, pure: false)
|
||||
py.install_sources(blaster, subdir: 'pure')
|
||||
install_subdir('subinst', install_dir: py.get_install_dir(pure: false))
|
||||
|
||||
py2.install_sources(blaster, pure: false)
|
||||
py2.install_sources(blaster, subdir: 'pure')
|
||||
install_subdir('subinst', install_dir: py2.get_install_dir(pure: false))
|
||||
|
||||
|
||||
py3_pkg_dep = dependency('python3', method: 'pkg-config', required : false)
|
||||
if py3_pkg_dep.found()
|
||||
py3_dep_majver = py3_pkg_dep.version().split('.')
|
||||
py3_dep_majver = py3_dep_majver[0] + '.' + py3_dep_majver[1]
|
||||
message(f'got two pythons: pkg-config is @py3_dep_majver@, and module is', py.language_version())
|
||||
if py3_dep_majver != py.language_version()
|
||||
message('skipped python3 pkg-config test because the default python3 is different from Meson\'s')
|
||||
else
|
||||
python_lib_dir = py3_pkg_dep.get_pkgconfig_variable('libdir')
|
||||
|
||||
# Check we can apply a version constraint
|
||||
dependency('python3', version: '>=@0@'.format(py_dep.version()))
|
||||
endif
|
||||
else
|
||||
message('Skipped python3 pkg-config test because it was not found')
|
||||
endif
|
||||
@@ -0,0 +1 @@
|
||||
option('python2', type: 'feature', value: 'disabled')
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
print('subinst')
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
print('subinst.submod')
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"installed": [
|
||||
{ "type": "python_file", "file": "usr/@PYTHON_PLATLIB@/blaster.py" },
|
||||
{ "type": "python_lib", "file": "usr/@PYTHON_PLATLIB@/tachyon" },
|
||||
{ "type": "py_implib", "file": "usr/@PYTHON_PLATLIB@/tachyon" },
|
||||
{ "type": "python_file", "file": "usr/@PYTHON_PURELIB@/pure/blaster.py" },
|
||||
{ "type": "python_file", "file": "usr/@PYTHON_PLATLIB@/nested/blaster.py" },
|
||||
{ "type": "python_lib", "file": "usr/@PYTHON_PLATLIB@/nested/tachyon" },
|
||||
{ "type": "py_implib", "file": "usr/@PYTHON_PLATLIB@/nested/tachyon" },
|
||||
{ "type": "python_file", "file": "usr/@PYTHON_PLATLIB@/subinst/printer.py" },
|
||||
{ "type": "python_file", "file": "usr/@PYTHON_PLATLIB@/subinst/submod/printer.py" },
|
||||
{ "type": "python_lib", "file": "usr/lib/tachyon" },
|
||||
{ "type": "py_implib", "file": "usr/lib/tachyon" }
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user