From 0c50c82f585a2021a7b78522566544df51ba7913 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Thu, 23 Nov 2023 06:25:07 +0000 Subject: [PATCH 1/2] Relativize more header imports --- src/sage/cpython/debug.pyx | 4 ++-- src/sage/cpython/python_debug.pxd | 2 +- src/sage/graphs/cliquer.pyx | 2 +- src/sage/modular/arithgroup/farey.cpp | 2 +- src/sage/rings/padics/pow_computer_ext.pyx | 2 +- src/sage/structure/coerce_dict.pyx | 2 +- src/sage_setup/autogen/interpreters/generator.py | 2 +- src/sage_setup/autogen/interpreters/specs/cc.py | 4 ++-- src/sage_setup/autogen/interpreters/specs/cdf.py | 2 +- src/sage_setup/autogen/interpreters/specs/element.py | 2 +- src/sage_setup/autogen/interpreters/specs/rr.py | 4 ++-- 11 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/sage/cpython/debug.pyx b/src/sage/cpython/debug.pyx index cdaca3a4854..09680986673 100644 --- a/src/sage/cpython/debug.pyx +++ b/src/sage/cpython/debug.pyx @@ -18,10 +18,10 @@ cdef extern from "Python.h": # Helper to get a pointer to an object's __dict__ slot, if any PyObject** _PyObject_GetDictPtr(obj) -cdef extern from "sage/cpython/debugimpl.c": +cdef extern from "debugimpl.c": void _type_debug(PyTypeObject*) -from .getattr cimport AttributeErrorMessage +from sage.cpython.getattr cimport AttributeErrorMessage # Determine subtype_traverse, subtype_clear, subtype_dealloc functions diff --git a/src/sage/cpython/python_debug.pxd b/src/sage/cpython/python_debug.pxd index 57057a3ff9f..a7a2f112d00 100644 --- a/src/sage/cpython/python_debug.pxd +++ b/src/sage/cpython/python_debug.pxd @@ -9,7 +9,7 @@ from cpython.ref cimport PyObject, PyTypeObject -cdef extern from "sage/cpython/python_debug.h": +cdef extern from "python_debug.h": # This is what is generally meant by "a debug build" of Python. # Implies Py_REF_DEBUG, Py_TRACE_REFS, and PYMALLOC_DEBUG (if diff --git a/src/sage/graphs/cliquer.pyx b/src/sage/graphs/cliquer.pyx index 6f232d97e16..2800efa5d37 100644 --- a/src/sage/graphs/cliquer.pyx +++ b/src/sage/graphs/cliquer.pyx @@ -35,7 +35,7 @@ from cysignals.memory cimport sig_free from cysignals.signals cimport sig_on, sig_off -cdef extern from "sage/graphs/cliquer/cl.c": +cdef extern from "cliquer/cl.c": cdef int sage_clique_max(graph_t *g, int ** list_of_vertices) cdef int sage_all_clique_max(graph_t *g, int ** list_of_vertices) cdef int sage_clique_number(graph_t *g) diff --git a/src/sage/modular/arithgroup/farey.cpp b/src/sage/modular/arithgroup/farey.cpp index 209391676de..5c912b46ca9 100644 --- a/src/sage/modular/arithgroup/farey.cpp +++ b/src/sage/modular/arithgroup/farey.cpp @@ -29,7 +29,7 @@ #include #include "farey.hpp" -#include "sage/modular/arithgroup/farey_symbol.h" +#include "farey_symbol.h" using namespace std; diff --git a/src/sage/rings/padics/pow_computer_ext.pyx b/src/sage/rings/padics/pow_computer_ext.pyx index 82140353d10..babfec6bb70 100644 --- a/src/sage/rings/padics/pow_computer_ext.pyx +++ b/src/sage/rings/padics/pow_computer_ext.pyx @@ -69,7 +69,7 @@ from sage.libs.ntl.ntl_ZZ cimport ntl_ZZ from sage.libs.ntl.ntl_ZZ_pX cimport ntl_ZZ_pX, ntl_ZZ_pX_Modulus from sage.rings.integer cimport Integer -cdef extern from "sage/ext/ccobject.h": +cdef extern from "ccobject.h": ZZ_c* Allocate_ZZ_array "Allocate_array"(size_t n) void Delete_ZZ_array "Delete_array"(ZZ_c* v) ZZ_pX_c* Allocate_ZZ_pX_array "Allocate_array"(size_t n) diff --git a/src/sage/structure/coerce_dict.pyx b/src/sage/structure/coerce_dict.pyx index 269f1be5fd5..8bfb1f9f030 100644 --- a/src/sage/structure/coerce_dict.pyx +++ b/src/sage/structure/coerce_dict.pyx @@ -73,7 +73,7 @@ from cysignals.memory cimport check_calloc, sig_free cdef extern from "Python.h": void PyTuple_SET_ITEM(object tuple, Py_ssize_t index, PyObject* item) -cdef extern from "sage/cpython/pyx_visit.h": +cdef extern from "pyx_visit.h": void Py_VISIT3(PyObject*, visitproc, void*) cdef type KeyedRef, ref diff --git a/src/sage_setup/autogen/interpreters/generator.py b/src/sage_setup/autogen/interpreters/generator.py index bec7cae2b47..33877422a8c 100644 --- a/src/sage_setup/autogen/interpreters/generator.py +++ b/src/sage_setup/autogen/interpreters/generator.py @@ -374,7 +374,7 @@ def write_wrapper(self, write): from sage.ext.fast_callable cimport Wrapper - cdef extern from "sage/ext/interpreters/interp_{{ s.name }}.c": + cdef extern from "interp_{{ s.name }}.c": {{ myself.func_header(cython=true) -}} {% if s.err_return != 'NULL' %} diff --git a/src/sage_setup/autogen/interpreters/specs/cc.py b/src/sage_setup/autogen/interpreters/specs/cc.py index ea5e8708647..e16252b0b79 100644 --- a/src/sage_setup/autogen/interpreters/specs/cc.py +++ b/src/sage_setup/autogen/interpreters/specs/cc.py @@ -149,7 +149,7 @@ def __init__(self): sage: print(interp.c_header) #include - #include "sage/ext/interpreters/wrapper_cc.h" + #include "wrapper_cc.h" So instructions where you need to interact with Python can @@ -171,7 +171,7 @@ def __init__(self): self.c_header = ri(0, ''' #include - #include "sage/ext/interpreters/wrapper_cc.h" + #include "wrapper_cc.h" ''') self.pxd_header = ri(0, diff --git a/src/sage_setup/autogen/interpreters/specs/cdf.py b/src/sage_setup/autogen/interpreters/specs/cdf.py index 137487e1de2..e85a9fbe802 100644 --- a/src/sage_setup/autogen/interpreters/specs/cdf.py +++ b/src/sage_setup/autogen/interpreters/specs/cdf.py @@ -85,7 +85,7 @@ def __init__(self): self.c_header = ri(0,""" #include #include - #include "sage/ext/interpreters/wrapper_cdf.h" + #include "wrapper_cdf.h" /* On Solaris, we need to define _Imaginary_I when compiling with GCC, * otherwise the constant I doesn't work. The definition below is based diff --git a/src/sage_setup/autogen/interpreters/specs/element.py b/src/sage_setup/autogen/interpreters/specs/element.py index bbb9c21ae57..2f280f703f1 100644 --- a/src/sage_setup/autogen/interpreters/specs/element.py +++ b/src/sage_setup/autogen/interpreters/specs/element.py @@ -105,7 +105,7 @@ def __init__(self): self.chunks = [self.mc_args, self.mc_constants, self.mc_stack, self.mc_domain_info, self.mc_code] self.c_header = ri(0, """ - #include "sage/ext/interpreters/wrapper_el.h" + #include "wrapper_el.h" #define CHECK(x) do_check(&(x), domain) diff --git a/src/sage_setup/autogen/interpreters/specs/rr.py b/src/sage_setup/autogen/interpreters/specs/rr.py index 264b694dfab..06452e24047 100644 --- a/src/sage_setup/autogen/interpreters/specs/rr.py +++ b/src/sage_setup/autogen/interpreters/specs/rr.py @@ -148,7 +148,7 @@ def __init__(self): sage: print(interp.c_header) #include - #include "sage/ext/interpreters/wrapper_rr.h" + #include "wrapper_rr.h" The function ``rr_py_call_helper`` is implemented in Cython:: @@ -188,7 +188,7 @@ def __init__(self): self.c_header = ri(0, ''' #include - #include "sage/ext/interpreters/wrapper_rr.h" + #include "wrapper_rr.h" ''') self.pxd_header = ri(0, From db260ba509c2bf7424b1dc7656816b201dc949d4 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Fri, 24 Nov 2023 10:27:15 +0000 Subject: [PATCH 2/2] Fix compilation errors --- src/sage/rings/padics/pow_computer_ext.pyx | 4 ++-- src/sage/structure/coerce_dict.pyx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sage/rings/padics/pow_computer_ext.pyx b/src/sage/rings/padics/pow_computer_ext.pyx index babfec6bb70..3f6e8eb875b 100644 --- a/src/sage/rings/padics/pow_computer_ext.pyx +++ b/src/sage/rings/padics/pow_computer_ext.pyx @@ -59,7 +59,7 @@ from cpython.dict cimport * from cysignals.signals cimport sig_on, sig_off -include "sage/libs/ntl/decl.pxi" +include "../../libs/ntl/decl.pxi" from sage.misc.timing import cputime from sage.libs.gmp.mpz cimport * @@ -69,7 +69,7 @@ from sage.libs.ntl.ntl_ZZ cimport ntl_ZZ from sage.libs.ntl.ntl_ZZ_pX cimport ntl_ZZ_pX, ntl_ZZ_pX_Modulus from sage.rings.integer cimport Integer -cdef extern from "ccobject.h": +cdef extern from "../../ext/ccobject.h": ZZ_c* Allocate_ZZ_array "Allocate_array"(size_t n) void Delete_ZZ_array "Delete_array"(ZZ_c* v) ZZ_pX_c* Allocate_ZZ_pX_array "Allocate_array"(size_t n) diff --git a/src/sage/structure/coerce_dict.pyx b/src/sage/structure/coerce_dict.pyx index 8bfb1f9f030..bd0a7808664 100644 --- a/src/sage/structure/coerce_dict.pyx +++ b/src/sage/structure/coerce_dict.pyx @@ -73,7 +73,7 @@ from cysignals.memory cimport check_calloc, sig_free cdef extern from "Python.h": void PyTuple_SET_ITEM(object tuple, Py_ssize_t index, PyObject* item) -cdef extern from "pyx_visit.h": +cdef extern from "../cpython/pyx_visit.h": void Py_VISIT3(PyObject*, visitproc, void*) cdef type KeyedRef, ref