summarylogtreecommitdiffstats
path: root/0100-Add-a-test-to-build-C-Ext.patch
diff options
context:
space:
mode:
authoratomlong2021-08-28 11:19:04 +0800
committeratomlong2021-08-28 13:15:13 +0800
commit89a67c05174951d172252b1db96ff93cc4ec4bcd (patch)
treed8c39fa79b201cf9aea28c51e7446a252ed8fee4 /0100-Add-a-test-to-build-C-Ext.patch
parentcf8d8d8771493a2aa8370ed323d06dc733a84181 (diff)
downloadaur-89a67c05174951d172252b1db96ff93cc4ec4bcd.tar.gz
Update to 3.9.6
Diffstat (limited to '0100-Add-a-test-to-build-C-Ext.patch')
-rw-r--r--0100-Add-a-test-to-build-C-Ext.patch108
1 files changed, 108 insertions, 0 deletions
diff --git a/0100-Add-a-test-to-build-C-Ext.patch b/0100-Add-a-test-to-build-C-Ext.patch
new file mode 100644
index 000000000000..067b44628949
--- /dev/null
+++ b/0100-Add-a-test-to-build-C-Ext.patch
@@ -0,0 +1,108 @@
+From 30080e89858fc1ae343eea6ba2d2bf152257a458 Mon Sep 17 00:00:00 2001
+From: Naveen M K <naveen521kk@gmail.com>
+Date: Tue, 29 Jun 2021 18:24:37 +0530
+Subject: [PATCH 100/N] Add a test to build C-Ext
+
+---
+ .github/workflows/smoketests.py | 85 +++++++++++++++++++++++++++++++++
+ 1 file changed, 85 insertions(+)
+
+diff --git a/.github/workflows/smoketests.py b/.github/workflows/smoketests.py
+index 9277c14..1761724 100644
+--- a/.github/workflows/smoketests.py
++++ b/.github/workflows/smoketests.py
+@@ -123,6 +123,91 @@ class Tests(unittest.TestCase):
+ from time import mktime, gmtime
+ mktime(gmtime())
+
++ def test_c_ext_build(self):
++ import tempfile
++ import sys
++ import subprocess
++ import textwrap
++ from pathlib import Path
++
++ with tempfile.TemporaryDirectory() as tmppro:
++ subprocess.check_call([sys.executable, "-m", "ensurepip", "--user"])
++ with Path(tmppro, "setup.py").open("w") as f:
++ f.write(
++ textwrap.dedent(
++ """\
++ from setuptools import setup, Extension
++
++ setup(
++ name='cwrapper',
++ version='1.0',
++ ext_modules=[
++ Extension(
++ 'cwrapper',
++ sources=['cwrapper.c']),
++ ],
++ )
++ """
++ )
++ )
++ with Path(tmppro, "cwrapper.c").open("w") as f:
++ f.write(
++ textwrap.dedent(
++ """\
++ #include <Python.h>
++ static PyObject *
++ helloworld(PyObject *self, PyObject *args)
++ {
++ printf("Hello World\\n");
++ return Py_None;
++ }
++ static PyMethodDef
++ myMethods[] = {
++ { "helloworld", helloworld, METH_NOARGS, "Prints Hello World" },
++ { NULL, NULL, 0, NULL }
++ };
++ static struct PyModuleDef cwrapper = {
++ PyModuleDef_HEAD_INIT,
++ "cwrapper",
++ "Test Module",
++ -1,
++ myMethods
++ };
++
++ PyMODINIT_FUNC
++ PyInit_cwrapper(void)
++ {
++ return PyModule_Create(&cwrapper);
++ }
++ """
++ )
++ )
++ subprocess.check_call(
++ [sys.executable, "-c", "import struct"],
++ )
++ subprocess.check_call(
++ [
++ sys.executable,
++ "-m",
++ "pip",
++ "install",
++ "wheel",
++ ],
++ )
++ subprocess.check_call(
++ [
++ sys.executable,
++ "-m",
++ "pip",
++ "install",
++ tmppro,
++ ],
++ )
++ subprocess.check_call(
++ [sys.executable, "-c", "import cwrapper"],
++ )
++
++
+
+ def suite():
+ return unittest.TestLoader().loadTestsFromName(__name__)
+--
+2.32.0
+