[Backport release-26.05] sage: 10.7 -> 10.9 (#524477)

This commit is contained in:
Mauricio Collares
2026-05-26 15:56:53 +00:00
committed by GitHub
13 changed files with 425 additions and 544 deletions

View File

@@ -38,45 +38,27 @@ assert (!blas.isILP64) && (!lapack.isILP64);
stdenv.mkDerivation (finalAttrs: {
pname = "giac${lib.optionalString enableGUI "-with-xcas"}";
version = "1.9.0-993"; # TODO try to remove preCheck phase on upgrade
version = "2.0.0-19"; # TODO try to remove preCheck phase on upgrade
src = fetchurl {
url = "https://www-fourier.ujf-grenoble.fr/~parisse/debian/dists/stable/main/source/giac_${finalAttrs.version}.tar.gz";
sha256 = "sha256-pqytFWrSWfEwQqRdRbaigGCq68s8mdgj2j8M+kclslE=";
url = "https://www-fourier.univ-grenoble-alpes.fr/~parisse/debian/dists/stable/main/source/giac_${finalAttrs.version}.tar.gz";
hash = "sha256-7fuKV8xNlDyN9ha1+NNHUjFPhEP0NZ3thwRXL1kcA5E=";
};
patches = [
./remove-old-functional-patterns.patch
./fix-fltk-guard.patch
(fetchpatch {
name = "pari_2_15.patch";
url = "https://raw.githubusercontent.com/sagemath/sage/07a2afd65fb4b0a1c9cbc43ede7d4a18c921a000/build/pkgs/giac/patches/pari_2_15.patch";
sha256 = "sha256-Q3xBFED7XEAyNz6AHjzt63XtospmdGAIdS6iPq1C2UE=";
})
(fetchpatch {
name = "infinity.patch";
url = "https://github.com/geogebra/giac/commit/851c2cd91e879c79d6652f8a5d5bed03b65c6d39.patch";
sha256 = "sha256-WJRT2b8I9kgAkRuIugMiXoF4hT7yR7qyad8A6IspNTM=";
stripLen = 5;
extraPrefix = "/src/";
excludes = [ "src/kdisplay.cc" ];
})
# giac calls scanf/printf with non-constant first arguments, which
# the compiler rightfully warns about (with an error nowadays).
(fetchpatch {
name = "fix-string-compiler-error.patch";
url = "https://salsa.debian.org/science-team/giac/-/raw/9ca8dbf4bb16d9d96948aa4024326d32485d7917/debian/patches/fix-string-compiler-error.patch";
sha256 = "sha256-r+M+9MRPRqhHcdhYWI6inxyNvWbXUbBcPCeDY7aulvk=";
hash = "sha256-Q3xBFED7XEAyNz6AHjzt63XtospmdGAIdS6iPq1C2UE=";
})
# issue with include path precedence
(fetchpatch {
name = "fix_implicit_declaration.patch";
url = "https://salsa.debian.org/science-team/giac/-/raw/c05ae9b9e74d3c6ee6411d391071989426a76201/debian/patches/fix_implicit_declaration.patch";
sha256 = "sha256-ompUceYJLiL0ftfjBkIMcYvX1YqG2/XA7e1yDyFY0IY=";
hash = "sha256-ompUceYJLiL0ftfjBkIMcYvX1YqG2/XA7e1yDyFY0IY=";
})
]
++ lib.optionals (!enableGUI) [
@@ -85,7 +67,10 @@ stdenv.mkDerivation (finalAttrs: {
(fetchpatch {
name = "nofltk-check.patch";
url = "https://raw.githubusercontent.com/sagemath/sage/7553a3c8dfa7bcec07241a07e6a4e7dcf5bb4f26/build/pkgs/giac/patches/nofltk-check.patch";
sha256 = "sha256-nAl5q3ufLjK3X9s0qMlGNowdRRf3EaC24eVtJABzdXY=";
hash = "sha256-eA0S+pEgllv77+KIpMvZgjz99jlbnreVvtNqNXs2HvI=";
postFetch = ''
substituteInPlace "$out" --replace-quiet periode Periode
'';
})
];

View File

@@ -1,294 +0,0 @@
From f1c5309d5b815acc2616cd9fbb5182b1e64d225f Mon Sep 17 00:00:00 2001
From: George Huebner <george@feyor.sh>
Date: Wed, 17 Jul 2024 18:12:36 -0500
Subject: [PATCH 1/4] remove old <functional> patterns
pointer_to_binary_function and ptr_fun are holdovers from pre c++11,
and can be replaced or entirely removed. This allows Giac to compile
with Clang 16>=.
---
src/all_global_var | 2 +-
src/gausspol.cc | 2 +-
src/gausspol.h | 2 +-
src/gen.cc | 2 +-
src/gen.h | 4 ++--
src/maple.cc | 2 +-
src/monomial.h | 16 ++++++++--------
src/plot.cc | 2 +-
src/poly.h | 17 +++++++++--------
src/solve.cc | 18 +++++++++---------
src/usual.cc | 2 +-
11 files changed, 35 insertions(+), 34 deletions(-)
diff --git a/src/all_global_var b/src/all_global_var
index 7d75d73..55f4782 100644
--- a/src/all_global_var
+++ b/src/all_global_var
@@ -16,7 +16,7 @@ Relatif a l'evaluation du tableur
// File Eqw.cc
vector<string> completion_tab;
// File alg_ext.cc
- rootmap symbolic_rootof_list(ptr_fun(islesscomplex));
+ rootmap symbolic_rootof_list(islesscomplex);
// File derive.cc
// File desolve.cc
identificateur laplace_var(" s");
diff --git a/src/gausspol.cc b/src/gausspol.cc
index 8fbd581..2f2121f 100644
--- a/src/gausspol.cc
+++ b/src/gausspol.cc
@@ -855,7 +855,7 @@ namespace giac {
std::vector< monomial<gen> >::const_iterator & itb_end,
std::vector< monomial<gen> > & new_coord,
bool (* is_strictly_greater)( const index_m &, const index_m &),
- const std::pointer_to_binary_function < const monomial<gen> &, const monomial<gen> &, bool> m_is_strictly_greater
+ const std::function<bool(const monomial<gen> &, const monomial<gen> &)> m_is_strictly_greater
) {
if (ita==ita_end || itb==itb_end){
new_coord.clear();
diff --git a/src/gausspol.h b/src/gausspol.h
index b5d214b..e6c7e0c 100644
--- a/src/gausspol.h
+++ b/src/gausspol.h
@@ -93,7 +93,7 @@ namespace giac {
std::vector< monomial<gen> >::const_iterator & itb_end,
std::vector< monomial<gen> > & new_coord,
bool (* is_strictly_greater)( const index_t &, const index_t &),
- const std::pointer_to_binary_function < const monomial<gen> &, const monomial<gen> &, bool> m_is_greater
+ const std::function<bool(const monomial<gen> &, const monomial<gen> &)> m_is_greater
) ;
void mulpoly(const polynome & th,const gen & fact,polynome & res);
polynome operator * (const polynome & th, const gen & fact) ;
diff --git a/src/gen.cc b/src/gen.cc
index 7d4874c..0b64afe 100644
--- a/src/gen.cc
+++ b/src/gen.cc
@@ -1126,7 +1126,7 @@ namespace giac {
#if 1 // def NSPIRE
g.__MAPptr = new ref_gen_map;
#else
- g.__MAPptr = new ref_gen_map(ptr_fun(islesscomplexthanf));
+ g.__MAPptr = new ref_gen_map(islesscomplexthanf);
#endif
#endif
g.type=_MAP;
diff --git a/src/gen.h b/src/gen.h
index 04d70af..496b25d 100644
--- a/src/gen.h
+++ b/src/gen.h
@@ -443,7 +443,7 @@ namespace giac {
};
typedef std::map<gen,gen,comparegen> gen_map;
#else
- typedef std::map<gen,gen,const std::pointer_to_binary_function < const gen &, const gen &, bool> > gen_map;
+ typedef std::map<gen,gen,const std::function<bool(const gen &, const gen &)> > gen_map;
#endif
struct ref_gen_map;
@@ -902,7 +902,7 @@ namespace giac {
#if 1 // def NSPIRE
ref_gen_map(): ref_count(1),m() {}
#else
- ref_gen_map(const std::pointer_to_binary_function < const gen &, const gen &, bool> & p): ref_count(1),m(p) {}
+ ref_gen_map(const std::function<bool(const gen &, const gen &)> & p): ref_count(1),m(p) {}
#endif
ref_gen_map(const gen_map & M):ref_count(1),m(M) {}
};
diff --git a/src/maple.cc b/src/maple.cc
index 3b33da8..d57a170 100644
--- a/src/maple.cc
+++ b/src/maple.cc
@@ -3626,7 +3626,7 @@ namespace giac {
#if 1 // def NSPIRE
gen_map m;
#else
- gen_map m(ptr_fun(islessthanf));
+ gen_map m(islessthanf);
#endif
int s=int(args.size());
vector<int> indexbegin,indexsize;
diff --git a/src/monomial.h b/src/monomial.h
index 6e606d0..637a76c 100644
--- a/src/monomial.h
+++ b/src/monomial.h
@@ -338,9 +338,9 @@ namespace giac {
template<class T> class sort_helper {
public:
- std::pointer_to_binary_function < const monomial<T> &, const monomial<T> &, bool> strictly_greater ;
- sort_helper(const std::pointer_to_binary_function < const monomial<T> &, const monomial<T> &, bool> is_strictly_greater):strictly_greater(is_strictly_greater) {};
- sort_helper():strictly_greater(std::ptr_fun<const monomial<T> &, const monomial<T> &, bool>(m_lex_is_strictly_greater<T>)) {};
+ std::function<bool(const monomial<T> &, const monomial<T> &)> strictly_greater ;
+ sort_helper(const std::function<bool(const monomial<T> &, const monomial<T> &)> is_strictly_greater):strictly_greater(is_strictly_greater) {};
+ sort_helper():strictly_greater(m_lex_is_strictly_greater<T>) {};
bool operator () (const monomial<T> & a, const monomial<T> & b){ return strictly_greater(a,b);}
};
@@ -677,7 +677,7 @@ namespace giac {
typename std::vector< monomial<T> >::const_iterator & itb_end,
std::vector< monomial<T> > & new_coord,
bool (* is_strictly_greater)( const index_m &, const index_m &),
- const std::pointer_to_binary_function < const monomial<T> &, const monomial<T> &, bool> m_is_strictly_greater
+ const std::function<bool(const monomial<T> &, const monomial<T> &)> m_is_strictly_greater
) {
if (ita==ita_end || itb==itb_end){
new_coord.clear();
@@ -726,8 +726,8 @@ namespace giac {
#endif
#ifndef NSPIRE
/* other algorithm using a map to avoid reserving too much space */
- typedef std::map< index_t,T,const std::pointer_to_binary_function < const index_m &, const index_m &, bool> > application;
- application produit(std::ptr_fun(is_strictly_greater));
+ typedef std::map< index_t,T,const std::function<bool(const index_m &, const index_m &)> > application;
+ application produit(is_strictly_greater);
// typedef std::map<index_t,T> application;
// application produit;
index_t somme(ita->index.size());
@@ -848,7 +848,7 @@ namespace giac {
typename std::vector< monomial<T> >::const_iterator a=v.begin(), a_end=v.end();
typename std::vector< monomial<T> >::const_iterator b=w.begin(), b_end=w.end();
std::vector< monomial<T> > res;
- Mul(a,a_end,b,b_end,res,i_lex_is_strictly_greater,std::ptr_fun< const monomial<T> &, const monomial<T> &, bool >((m_lex_is_strictly_greater<T>)));
+ Mul(a,a_end,b,b_end,res,i_lex_is_strictly_greater,m_lex_is_strictly_greater<T>);
return res ;
}
@@ -856,7 +856,7 @@ namespace giac {
std::vector< monomial<T> > & operator *= (std::vector< monomial<T> > & v,const std::vector< monomial<T> > & w){
typename std::vector< monomial<T> >::const_iterator a=v.begin(), a_end=v.end();
typename std::vector< monomial<T> >::const_iterator b=w.begin(), b_end=w.end();
- Mul(a,a_end,b,b_end,v,i_lex_is_strictly_greater,std::ptr_fun< const monomial<T> &, const monomial<T> &, bool >((m_lex_is_strictly_greater<T>)));
+ Mul(a,a_end,b,b_end,v,i_lex_is_strictly_greater,m_lex_is_strictly_greater<T>);
return v;
}
diff --git a/src/plot.cc b/src/plot.cc
index 288a1b5..ac85c9a 100755
--- a/src/plot.cc
+++ b/src/plot.cc
@@ -11886,7 +11886,7 @@ static vecteur densityscale(double xmin,double xmax,double ymin,double ymax,doub
#if 1 // def NSPIRE
gen_map m;
#else
- gen_map m(ptr_fun(islesscomplexthanf));
+ gen_map m(islesscomplexthanf);
#endif
int taille;
is >> taille;
diff --git a/src/poly.h b/src/poly.h
index 7d64e2c..d9ff991 100644
--- a/src/poly.h
+++ b/src/poly.h
@@ -40,23 +40,24 @@ namespace giac {
// T zero;
// functional object sorting function for monomial ordering
bool (* is_strictly_greater)( const index_m &, const index_m &);
- std::pointer_to_binary_function < const monomial<T> &, const monomial<T> &, bool> m_is_strictly_greater ;
+ std::function<bool(const monomial<T> &, const monomial<T> &)> m_is_strictly_greater ;
// constructors
tensor(const tensor<T> & t) : dim(t.dim), coord(t.coord), is_strictly_greater(t.is_strictly_greater), m_is_strictly_greater(t.m_is_strictly_greater) { }
tensor(const tensor<T> & t, const std::vector< monomial<T> > & v) : dim(t.dim), coord(v), is_strictly_greater(t.is_strictly_greater), m_is_strictly_greater(t.m_is_strictly_greater) { }
// warning: this constructor prohibits construction of tensor from a value
// of type T if this value is an int, except by using tensor<T>(T(int))
- tensor() : dim(0), is_strictly_greater(i_lex_is_strictly_greater), m_is_strictly_greater(std::ptr_fun<const monomial<T> &, const monomial<T> &, bool>(m_lex_is_strictly_greater<T>)) { }
- explicit tensor(int d) : dim(d), is_strictly_greater(i_lex_is_strictly_greater), m_is_strictly_greater(std::ptr_fun<const monomial<T> &, const monomial<T> &, bool>(m_lex_is_strictly_greater<T>)) { }
+ // DANGER
+ tensor() : dim(0), is_strictly_greater(i_lex_is_strictly_greater), m_is_strictly_greater(m_lex_is_strictly_greater<T>) { }
+ explicit tensor(int d) : dim(d), is_strictly_greater(i_lex_is_strictly_greater), m_is_strictly_greater(m_lex_is_strictly_greater<T>) { }
explicit tensor(int d,const tensor<T> & t) : dim(d),is_strictly_greater(t.is_strictly_greater), m_is_strictly_greater(t.m_is_strictly_greater) { }
- tensor(const monomial<T> & v) : dim(int(v.index.size())), is_strictly_greater(i_lex_is_strictly_greater), m_is_strictly_greater(std::ptr_fun<const monomial<T> &, const monomial<T> &, bool>(m_lex_is_strictly_greater<T>)) {
+ tensor(const monomial<T> & v) : dim(int(v.index.size())), is_strictly_greater(i_lex_is_strictly_greater), m_is_strictly_greater(m_lex_is_strictly_greater<T>) {
coord.push_back(v);
}
- tensor(const T & v, int d) : dim(d), is_strictly_greater(i_lex_is_strictly_greater), m_is_strictly_greater(std::ptr_fun<const monomial<T> &, const monomial<T> &, bool>(m_lex_is_strictly_greater<T>)) {
+ tensor(const T & v, int d) : dim(d), is_strictly_greater(i_lex_is_strictly_greater), m_is_strictly_greater(m_lex_is_strictly_greater<T>) {
if (!is_zero(v))
coord.push_back(monomial<T>(v,0,d));
}
- tensor(int d,const std::vector< monomial<T> > & c) : dim(d), coord(c), is_strictly_greater(i_lex_is_strictly_greater),m_is_strictly_greater(std::ptr_fun<const monomial<T> &, const monomial<T> &, bool>(m_lex_is_strictly_greater<T>)) { }
+ tensor(int d,const std::vector< monomial<T> > & c) : dim(d), coord(c), is_strictly_greater(i_lex_is_strictly_greater),m_is_strictly_greater(m_lex_is_strictly_greater<T>) { }
~tensor() { coord.clear(); }
// member functions
// ordering monomials in the tensor
@@ -519,10 +520,10 @@ namespace giac {
template <class T>
void lexsort(std::vector < monomial<T> > & v){
#if 1 // def NSPIRE
- sort_helper<T> M(std::ptr_fun<const monomial<T> &, const monomial<T> &, bool>(m_lex_is_strictly_greater<T>));
+ sort_helper<T> M(m_lex_is_strictly_greater<T>);
sort(v.begin(),v.end(),M);
#else
- sort(v.begin(),v.end(),std::ptr_fun<const monomial<T> &, const monomial<T> &, bool>(m_lex_is_strictly_greater<T>));
+ sort(v.begin(),v.end(),m_lex_is_strictly_greater<T>);
#endif
}
diff --git a/src/solve.cc b/src/solve.cc
index 889f824..2a51ab8 100755
--- a/src/solve.cc
+++ b/src/solve.cc
@@ -8684,39 +8684,39 @@ namespace giac {
switch (order.val){
case _PLEX_ORDER:
p.is_strictly_greater=i_lex_is_strictly_greater;
- p.m_is_strictly_greater=std::ptr_fun(m_lex_is_strictly_greater<gen>);
+ p.m_is_strictly_greater=m_lex_is_strictly_greater<gen>;
break;
case _REVLEX_ORDER:
p.is_strictly_greater=i_total_revlex_is_strictly_greater;
- p.m_is_strictly_greater=std::ptr_fun(m_total_revlex_is_strictly_greater<gen>);
+ p.m_is_strictly_greater=m_total_revlex_is_strictly_greater<gen>;
break;
case _TDEG_ORDER:
p.is_strictly_greater=i_total_lex_is_strictly_greater;
- p.m_is_strictly_greater=std::ptr_fun(m_total_lex_is_strictly_greater<gen>);
+ p.m_is_strictly_greater=m_total_lex_is_strictly_greater<gen>;
break;
case _3VAR_ORDER:
p.is_strictly_greater=i_3var_is_strictly_greater;
- p.m_is_strictly_greater=std::ptr_fun(m_3var_is_strictly_greater<gen>);
+ p.m_is_strictly_greater=m_3var_is_strictly_greater<gen>;
break;
case _7VAR_ORDER:
p.is_strictly_greater=i_7var_is_strictly_greater;
- p.m_is_strictly_greater=std::ptr_fun(m_7var_is_strictly_greater<gen>);
+ p.m_is_strictly_greater=m_7var_is_strictly_greater<gen>;
break;
case _11VAR_ORDER:
p.is_strictly_greater=i_11var_is_strictly_greater;
- p.m_is_strictly_greater=std::ptr_fun(m_11var_is_strictly_greater<gen>);
+ p.m_is_strictly_greater=m_11var_is_strictly_greater<gen>;
break;
case _16VAR_ORDER:
p.is_strictly_greater=i_16var_is_strictly_greater;
- p.m_is_strictly_greater=std::ptr_fun(m_16var_is_strictly_greater<gen>);
+ p.m_is_strictly_greater=m_16var_is_strictly_greater<gen>;
break;
case _32VAR_ORDER:
p.is_strictly_greater=i_32var_is_strictly_greater;
- p.m_is_strictly_greater=std::ptr_fun(m_32var_is_strictly_greater<gen>);
+ p.m_is_strictly_greater=m_32var_is_strictly_greater<gen>;
break;
case _64VAR_ORDER:
p.is_strictly_greater=i_64var_is_strictly_greater;
- p.m_is_strictly_greater=std::ptr_fun(m_64var_is_strictly_greater<gen>);
+ p.m_is_strictly_greater=m_64var_is_strictly_greater<gen>;
break;
}
p.tsort();
diff --git a/src/usual.cc b/src/usual.cc
index fddede6..eb7ae5e 100755
--- a/src/usual.cc
+++ b/src/usual.cc
@@ -5950,7 +5950,7 @@ namespace giac {
#if 1 // def NSPIRE
gen_map m;
#else
- gen_map m(ptr_fun(islesscomplexthanf));
+ gen_map m(islesscomplexthanf);
#endif
for (;it!=itend;++it){
if (is_equal(*it) || it->is_symb_of_sommet(at_deuxpoints)){
--
2.44.1

View File

@@ -7,16 +7,14 @@
}:
stdenv.mkDerivation rec {
version = "1.3.1";
version = "1.3.2";
pname = "libbraiding";
src = fetchFromGitHub {
owner = "miguelmarco";
repo = "libbraiding";
# version 1.3.1 contains a typo in configure.ac, fixed in the next commit.
# TODO: remove if on upgrade
rev = if version == "1.3.1" then "b174832026c2412baec83277c461e4df71d8525c" else version;
hash = "sha256-ar/EiaMZuQRa1lr0sZPLRuk5K00j63TqNf0q0iuiKjw=";
rev = version;
hash = "sha256-Vo4nwzChjrI4PeNB+adPwDeL3gb++DEc4isX4/iDHMc=";
};
nativeBuildInputs = [

View File

@@ -0,0 +1,89 @@
diff --git a/src/sage/config.py.in b/src/sage/config.py.in
index 3a95538d313..f75e951f3b8 100644
--- a/src/sage/config.py.in
+++ b/src/sage/config.py.in
@@ -48,6 +48,11 @@ FOURTITWO_PPI = "@FOURTITWO_PPI@"
FOURTITWO_CIRCUITS = "@FOURTITWO_CIRCUITS@"
FOURTITWO_GROEBNER = "@FOURTITWO_GROEBNER@"
+# Colon-separated list of pkg-config modules to search for cblas functionality.
+# We hard-code it here as cblas because configure (build/pkgs/openblas/spkg-configure.m4)
+# always provides cblas.pc, if necessary by creating a facade pc file for a system BLAS.
+CBLAS_PC_MODULES = "cblas"
+
# for sage_setup.setenv
SAGE_ARCHFLAGS = "@SAGE_ARCHFLAGS@"
SAGE_PKG_CONFIG_PATH = "@SAGE_PKG_CONFIG_PATH@".replace("$SAGE_LOCAL", SAGE_LOCAL)
diff --git a/src/sage/env.py b/src/sage/env.py
index f6c198a8617..dc45d11fb46 100644
--- a/src/sage/env.py
+++ b/src/sage/env.py
@@ -218,6 +218,7 @@ FOURTITWO_RAYS = var("FOURTITWO_RAYS")
FOURTITWO_PPI = var("FOURTITWO_PPI")
FOURTITWO_CIRCUITS = var("FOURTITWO_CIRCUITS")
FOURTITWO_GROEBNER = var("FOURTITWO_GROEBNER")
+CBLAS_PC_MODULES = var("CBLAS_PC_MODULES", "cblas:openblas:blas")
ECL_CONFIG = var("ECL_CONFIG", "ecl-config")
NTL_INCDIR = var("NTL_INCDIR")
NTL_LIBDIR = var("NTL_LIBDIR")
@@ -322,8 +323,17 @@ def sage_include_directories(use_sources=False):
return dirs
+def get_cblas_pc_module_name() -> str:
+ """
+ Return the name of the BLAS libraries to be used.
+ """
+ import pkgconfig
+ cblas_pc_modules = CBLAS_PC_MODULES.split(':')
+ return next(blas_lib for blas_lib in cblas_pc_modules if pkgconfig.exists(blas_lib))
+
+
default_required_modules = ('fflas-ffpack', 'givaro', 'gsl', 'linbox', 'Singular',
- 'libpng', 'gdlib', 'm4ri', 'zlib', 'ecl')
+ 'libpng', 'gdlib', 'm4ri', 'zlib', 'cblas', 'ecl')
default_optional_modules = ('lapack',)
@@ -348,7 +358,7 @@ def cython_aliases(required_modules=None, optional_modules=None):
sage: cython_aliases()
{...}
sage: sorted(cython_aliases().keys())
- ['ECL_CFLAGS',
+ ['CBLAS_CFLAGS',
...,
'ZLIB_LIBRARIES']
sage: cython_aliases(required_modules=('module-that-is-assumed-to-not-exist'))
@@ -395,6 +405,8 @@ def cython_aliases(required_modules=None, optional_modules=None):
for lib, required in itertools.chain(((lib, True) for lib in required_modules),
((lib, False) for lib in optional_modules)):
var = lib.upper().replace("-", "") + "_"
+ if lib == 'cblas':
+ lib = get_cblas_pc_module_name()
if lib == 'zlib':
aliases[var + "CFLAGS"] = ""
try:
diff --git a/src/sage/misc/cython.py b/src/sage/misc/cython.py
index 6d30189ae89..830a744c1aa 100644
--- a/src/sage/misc/cython.py
+++ b/src/sage/misc/cython.py
@@ -50,12 +50,16 @@ def _standard_libs_libdirs_incdirs_aliases():
{...})
"""
aliases = cython_aliases()
- standard_libs = ["mpfr", "gmp", "gmpxx", "pari", "m", "ec", "gsl", "ntl"]
+ standard_libs = [
+ 'mpfr', 'gmp', 'gmpxx', 'pari', 'm',
+ 'ec', 'gsl',
+ ] + aliases["CBLAS_LIBRARIES"] + [
+ 'ntl']
standard_libdirs = []
if SAGE_LOCAL:
standard_libdirs.append(os.path.join(SAGE_LOCAL, "lib"))
- standard_libdirs.extend(aliases["NTL_LIBDIR"])
- standard_incdirs = [dir.as_posix() for dir in get_include_dirs()] + aliases["NTL_INCDIR"]
+ standard_libdirs.extend(aliases["CBLAS_LIBDIR"] + aliases["NTL_LIBDIR"])
+ standard_incdirs = [dir.as_posix() for dir in get_include_dirs()] + aliases["CBLAS_INCDIR"] + aliases["NTL_INCDIR"]
return standard_libs, standard_libdirs, standard_incdirs, aliases
################################################################

View File

@@ -0,0 +1,14 @@
diff --git a/src/sage_docbuild/sphinxbuild.py b/src/sage_docbuild/sphinxbuild.py
index 62b2d3cb112..df4665982e8 100644
--- a/src/sage_docbuild/sphinxbuild.py
+++ b/src/sage_docbuild/sphinxbuild.py
@@ -107,7 +107,8 @@ class SageSphinxLogger():
re.compile('WARNING: Any IDs not assiend for figure node'),
re.compile('WARNING: .* is not referenced'),
re.compile('WARNING: Build finished'),
- re.compile('WARNING: rST localisation for language .* not found')
+ re.compile('WARNING: rST localisation for language .* not found'),
+ re.compile('WARNING: error while formatting arguments for .*')
)
# The warning "unknown config value 'multidoc_first_pass'..."
# should only appear when building the documentation for a

View File

@@ -0,0 +1,129 @@
diff --git a/src/doc/en/reference/repl/meson.build b/src/doc/en/reference/repl/meson.build
index eb492404897..9b162becf3b 100644
--- a/src/doc/en/reference/repl/meson.build
+++ b/src/doc/en/reference/repl/meson.build
@@ -9,10 +9,3 @@ doc_sources = [
foreach file : doc_sources
doc_src += fs.copyfile(file)
endforeach
-
-doc_src_repl = custom_target(
- 'options',
- output: ['options.txt'],
- command: [py, src / 'sage' / 'cli', '--help'],
- capture: true,
-)
diff --git a/src/doc/meson.build b/src/doc/meson.build
index 1f33822cf5f..5ba1ab0397b 100644
--- a/src/doc/meson.build
+++ b/src/doc/meson.build
@@ -1,11 +1,21 @@
-if not get_option('build-docs')
- subdir_done()
-endif
-
-warning(
- 'Documentation building enabled, generating targets may be slow. To disable this, pass -Dbuild-docs=false.',
+project(
+ 'SageMath',
+ ['c', 'cpp', 'cython'],
+ version: '10.9',
+ license: 'GPL v3',
+ default_options: ['c_std=c17', 'cpp_std=c++17', 'python.install_env=auto'],
+ meson_version: '>=1.5',
)
+src = meson.current_source_dir()
+fs = import('fs')
+
+# Python module
+# https://mesonbuild.com/Python-module.html
+py_module = import('python')
+py = py_module.find_installation(pure: false)
+py_dep = py.dependency()
+
sphinx_check = py_module.find_installation(required: false, modules: ['sphinx'])
if not sphinx_check.found()
warning(
@@ -35,21 +45,17 @@ doc_bootstrap = custom_target(
'bootstrap',
output: ['autogen'],
command: [
- py,
- files('../../tools/bootstrap-docs.py'),
+ 'sage',
+ '-python',
+ files('bootstrap-docs.py'),
meson.current_build_dir(),
],
- env: {'SAGE_ROOT': root},
- # doc_src is not really a dependency of the bootstrap, but we want to make sure
- # that all the source files are present before running the actual doc build
- # so let's collect all source-related targets here.
- depends: doc_src,
)
references = run_command(
- py,
[
- src / 'build-docs.py',
+ 'sage',
+ '--docbuild',
'--no-prune-empty-dirs',
'--all-documents',
'reference',
@@ -71,10 +77,7 @@ foreach type : ['inventory', 'html', 'pdf']
short_ref = ref
endif
deps = []
- deps += doc_bootstrap
- if short_ref == 'repl'
- deps += doc_src_repl
- endif
+ deps += doc_bootstrap
if type == 'html' or type == 'pdf'
deps += reference_inventory
endif
@@ -93,8 +96,8 @@ foreach type : ['inventory', 'html', 'pdf']
'doc-' + type + '-reference-' + short_ref,
output: [type + short_ref],
command: [
- py,
- src / 'build-docs.py',
+ 'sage',
+ '--docbuild',
'--no-prune-empty-dirs',
'--no-pdf-links',
ref,
@@ -120,9 +123,9 @@ foreach type : ['inventory', 'html', 'pdf']
endforeach
other_documents = run_command(
- py,
[
- src / 'build-docs.py',
+ 'sage',
+ '--docbuild',
'--no-prune-empty-dirs',
'--all-documents',
'all',
@@ -140,8 +143,8 @@ foreach type : ['html', 'pdf']
'doc-' + type + '-other-' + short_doc,
output: [type + short_doc],
command: [
- py,
- src / 'build-docs.py',
+ 'sage',
+ '--docbuild',
'--no-prune-empty-dirs',
'--no-pdf-links',
doc,
diff --git a/src/meson.build b/src/meson.build
index 039cbbd1294..dfb82d980fb 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -309,4 +309,3 @@ src = meson.current_source_dir()
# Submodules
subdir('sage')
-subdir('doc')

View File

@@ -1,30 +0,0 @@
diff --git a/src/sage_docbuild/builders.py b/src/sage_docbuild/builders.py
index 91035a01f1c..24f3d0c7c12 100644
--- a/src/sage_docbuild/builders.py
+++ b/src/sage_docbuild/builders.py
@@ -130,10 +130,9 @@ def builder_helper(type):
logger.debug(build_command)
# Run Sphinx with Sage's special logger
- sys.argv = ["sphinx-build"] + build_command.split()
- from .sphinxbuild import runsphinx
+ args = "python3 -um sage_docbuild.sphinxbuild -N".split() + build_command.split()
try:
- runsphinx()
+ subprocess.check_call(args)
except Exception:
if build_options.ABORT_ON_ERROR:
raise
diff --git a/src/sage_docbuild/sphinxbuild.py b/src/sage_docbuild/sphinxbuild.py
index 62b2d3cb112..aa7dc07741b 100644
--- a/src/sage_docbuild/sphinxbuild.py
+++ b/src/sage_docbuild/sphinxbuild.py
@@ -331,3 +331,8 @@ def runsphinx():
if not sys.warnoptions:
warnings.filters = original_filters[:]
+
+if __name__ == '__main__':
+ import sys
+ sys.argv[0] = "sphinx-build"
+ runsphinx()

View File

@@ -0,0 +1,32 @@
diff --git a/src/sage/config.py.in b/src/sage/config.py.in
index 3a95538d313..cdd551122fc 100644
--- a/src/sage/config.py.in
+++ b/src/sage/config.py.in
@@ -4,6 +4,8 @@ import sage
VERSION = "@PACKAGE_VERSION@"
+SAGE_BUILD_SRC = "@EDITABLE_SRC@/src"
+
# The following must not be used during build to determine source or installation
# location of sagelib. See comments in SAGE_ROOT/src/Makefile.in
# These variables come first so that other substituted variable values can refer
diff --git a/src/sage/misc/sageinspect.py b/src/sage/misc/sageinspect.py
index c237af52c24..7a8e8291406 100644
--- a/src/sage/misc/sageinspect.py
+++ b/src/sage/misc/sageinspect.py
@@ -270,6 +270,14 @@ def _extract_embedded_position(docstring):
return None
raw_filename = res.group('FILENAME')
+
+ # remove SAGE_BUILD_SRC prefix to workaround
+ # https://github.com/cython/cython/pull/6755
+ from sage.config import SAGE_BUILD_SRC
+ from os.path import commonprefix, relpath
+ if commonprefix([raw_filename, SAGE_BUILD_SRC]) == SAGE_BUILD_SRC:
+ raw_filename = relpath(raw_filename, SAGE_BUILD_SRC)
+
filename = raw_filename
if not os.path.isabs(filename):

View File

@@ -7,6 +7,7 @@
env-locations,
gfortran,
ninja,
meson,
bash,
coreutils,
gnused,
@@ -66,6 +67,7 @@ let
pythonEnv
gfortran # for inline fortran
ninja # for inline fortran via numpy.f2py
meson # for inline fortran
stdenv.cc # for cython
bash
coreutils
@@ -129,84 +131,60 @@ writeTextFile rec {
m4ri
]
}'
export SAGE_ROOT='${sagelib.src}'
''
+
# TODO: is using pythonEnv instead of @sage-local@ here a good
# idea? there is a test in src/sage/env.py that checks if the values
# SAGE_ROOT and SAGE_LOCAL set here match the ones set in env.py.
# we fix up env.py's SAGE_ROOT in sage-src.nix (which does not
# have access to sage-with-env), but env.py autodetects
# SAGE_LOCAL to be pythonEnv.
# setting SAGE_LOCAL to pythonEnv also avoids having to create
# python3, ipython, ipython3 and jupyter symlinks in
# sage-with-env.nix.
''
export SAGE_LOCAL='${pythonEnv}'
export PATH="${runtimepath}:$PATH"
export SAGE_DOC="''${SAGE_DOC_OVERRIDE:-doc-placeholder}"
export SAGE_DOC_SRC="''${SAGE_DOC_SRC_OVERRIDE:-${sagelib.src}/src/doc}"
export SAGE_SHARE='${sagelib}/share'
export SAGE_ENV_CONFIG_SOURCED=1 # sage-env complains if sage-env-config is not sourced beforehand
orig_path="$PATH"
export PATH='${runtimepath}'
# set locations of dependencies
. ${env-locations}/sage-env-locations
# set dependent vars, like JUPYTER_CONFIG_DIR
source "${sagelib.src}/src/bin/sage-env"
export PATH="$RUNTIMEPATH_PREFIX:${runtimepath}:$orig_path" # sage-env messes with PATH
# needed for cython
export CC='${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc'
export CXX='${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++'
# cython needs to find these libraries, otherwise will fail with `ld: cannot find -lflint` or similar
export LDFLAGS='${
lib.concatStringsSep " " (
map (pkg: "-L${pkg}/lib") [
flint
gap
glpk
gmp
mpfr
pari
zlib
eclib
gsl
ntl
sympow
]
)
}'
export CFLAGS='${
lib.concatStringsSep " " (
map (pkg: "-isystem ${pkg}/include") [
singular
gmp.dev
glpk
flint
gap
mpfr.dev
]
)
}'
export CXXFLAGS=$CFLAGS
export SAGE_LOGS="$TMPDIR/sage-logs"
export SAGE_DOC="''${SAGE_DOC_OVERRIDE:-doc-placeholder}"
export SAGE_DOC_SRC="''${SAGE_DOC_SRC_OVERRIDE:-${sagelib.src}/src/doc}"
export SAGE_LIB='${sagelib}/${python3.sitePackages}'
# set locations of dependencies
. ${env-locations}/sage-env-locations
export SAGE_EXTCODE='${sagelib.src}/src/sage/ext_data'
# needed for cython
export CC='${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc'
export CXX='${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++'
# cython needs to find these libraries, otherwise will fail with `ld: cannot find -lflint` or similar
export LDFLAGS='${
lib.concatStringsSep " " (
map (pkg: "-L${pkg}/lib") [
flint
gap
glpk
gmp
mpfr
pari
zlib
eclib
gsl
ntl
sympow
]
)
}'
export CFLAGS='${
lib.concatStringsSep " " (
map (pkg: "-isystem ${pkg}/include") [
singular
gmp.dev
glpk
flint
gap
mpfr.dev
]
)
}'
export CXXFLAGS=$CFLAGS
export SAGE_LIB='${sagelib}/${python3.sitePackages}'
export SAGE_EXTCODE='${sagelib.src}/src/sage/ext_data'
# for find_library
export DYLD_LIBRARY_PATH="${
lib.makeLibraryPath [
stdenv.cc.libc
singular
giac
gap
]
}''${DYLD_LIBRARY_PATH:+:}$DYLD_LIBRARY_PATH"
'';
# for find_library
export DYLD_LIBRARY_PATH="${
lib.makeLibraryPath [
stdenv.cc.libc
singular
giac
gap
]
}''${DYLD_LIBRARY_PATH:+:}$DYLD_LIBRARY_PATH"
'';
}

View File

@@ -12,14 +12,14 @@
# all get the same sources with the same patches applied.
stdenv.mkDerivation rec {
version = "10.7";
version = "10.9";
pname = "sage-src";
src = fetchFromGitHub {
owner = "sagemath";
repo = "sage";
rev = version;
hash = "sha256-nYlBmKQ9TD5EAVvNwo8YzqAd5IUCpTU3kBTqUH21IxQ=";
hash = "sha256-8IBCQYdmL7ane7/WOoogArbwgqPDtL8ecz9GIzuEfOU=";
};
# contains essential files (e.g., setup.cfg) generated by the bootstrap script.
@@ -27,21 +27,39 @@ stdenv.mkDerivation rec {
configure-src = fetchurl {
# the hash below is the tagged commit's _parent_. it can also be found by looking for
# the "configure" asset at https://github.com/sagemath/sage/releases/tag/${version}
url = "mirror://sageupstream/configure/configure-858268b40010e5ed6da13488ad0f52cda4d1f70e.tar.gz";
hash = "sha256-TsVX+wUWr+keCXmGQp1OHGXgNc7luajyGxfTwduSEtc=";
url = "mirror://sageupstream/configure/configure-8592858fd4c0eb936cfa9ebf704d165f6b857617.tar.gz";
hash = "sha256-jakdc+4S/2uRooEaXMlNZpo01dVBumVp7HHHP4iZu0c=";
};
# Patches needed because of particularities of nix or the way this is packaged.
# The goal is to upstream all of them and get rid of this list.
nixPatches = [
# Parallelize docubuild using subprocesses, fixing an isolation issue. See
# https://groups.google.com/forum/#!topic/sage-packaging/YGOm8tkADrE
./patches/sphinx-docbuild-subprocesses.patch
# After updating smypow to (https://github.com/sagemath/sage/issues/3360)
# we can now set the cache dir to be within the .sage directory. This is
# not strictly necessary, but keeps us from littering in the user's HOME.
./patches/sympow-cache.patch
# MILD HACK: Turn src/doc/meson.build into a standalone project, so we can
# docbuild separately.
./patches/sagedoc-standalone-meson.patch
# Silence some warnings during docbuild. Imported from Arch.
./patches/sagedoc-silence-formatting-warnings.patch
# Workaround for https://github.com/cython/cython/pull/6755, adapted from Void. Can be removed after next Cython release.
./patches/workaround-cython-relpaths.patch
# Revert https://github.com/sagemath/sage/pull/40520. It causes
# "undefined symbol: cblas_ctrmv" errors.
./patches/revert-blas-mesonification.patch
# https://github.com/sagemath/sage/pull/41637 causes problems when
# docbuilding.
(fetchpatch2 {
url = "https://github.com/sagemath/sage/commit/854ea0e546ee24ff09072ee77550b944b54f697c.patch?full_index=1";
revert = true;
hash = "sha256-j5evAmOtKEG4OVFb/w/SVY2vvP5BSkqHBDmnroh8XY0=";
})
]
++ lib.optionals (stdenv.cc.isClang) [
# https://github.com/NixOS/nixpkgs/pull/264126
@@ -60,11 +78,11 @@ stdenv.mkDerivation rec {
# a more conservative version of https://github.com/sagemath/sage/pull/37951
./patches/gap-element-crash.patch
# https://github.com/sagemath/sage/pull/40895, landed in 10.8.beta6
# https://github.com/sagemath/sage/pull/42009, landed in 10.10.beta0
(fetchpatch2 {
name = "doctest-absolute-path.patch";
url = "https://github.com/sagemath/sage/commit/3a5904d43f552bf63ed1eed9154f87b1f0de53fb.patch?full_index=1";
hash = "sha256-rp+9d8Y6kifWzufE07GWU68txPn//w7uMn4LcpITaBs=";
name = "gap-root-paths.patch";
url = "https://github.com/sagemath/sage/commit/24c9605a770b2419cd401bf6c8780bb4be923244.patch?full_index=1";
hash = "sha256-68w2HWLR6mb13BWi5Fb6SfPAqPbdJrns0l5T6SoMqNI=";
})
];
@@ -75,63 +93,6 @@ stdenv.mkDerivation rec {
# should come from or be proposed to upstream. This list will probably never
# be empty since dependencies update all the time.
packageUpgradePatches = [
# https://github.com/sagemath/sage/pull/40919, landed in 10.8.beta8
(fetchpatch2 {
name = "gap-4.15.1-update.patch";
url = "https://github.com/sagemath/sage/commit/54d4ddb132cc71ef26b4db1f48afd6736d41cc63.patch?full_index=1";
hash = "sha256-PZyOXRsgcsPvgceGGZXet5URJgWiIlCfFx8tvwpLk5A=";
excludes = [ "src/doc/zh/constructions/rep_theory.rst" ];
})
# https://github.com/sagemath/sage/pull/41141, landed in 10.8.beta9
(fetchpatch2 {
name = "ipython-9_7_0-unicode_to_str.patch";
url = "https://github.com/sagemath/sage/commit/fa00696112fde95e0c4241ad6063936200ce6f68.patch?full_index=1";
hash = "sha256-eFDpNu/2gcQATELmQ7/VzXI35xIzaVrD8bhhJ57e2gc=";
})
# https://github.com/sagemath/sage/pull/41233, landed in 10.8.rc0
(fetchpatch2 {
name = "flint-3.4-update.patch";
url = "https://github.com/sagemath/sage/commit/9bd5304f1a222e215d7006a04854ff66616748bf.patch?full_index=1";
hash = "sha256-7bgouXV3pM20IX5PM24ZpJWOBlZjQksGtjopgouEbyg=";
})
# https://github.com/sagemath/sage/pull/41078, landed in 10.8.beta8
(fetchpatch2 {
name = "docutils-0.22-update.patch";
url = "https://github.com/sagemath/sage/commit/e206e205a6841cc5251dfb37fdd36ed29345fba4.patch?full_index=1";
hash = "sha256-Y8DqwGBkRnL+6ejZibCmkEJ7q/Qs0wD2KGmAefVdd94=";
})
# https://github.com/sagemath/sage/pull/41342, landed in 10.9.beta1
(fetchpatch2 {
name = "numpy-2.4-update.patch";
url = "https://github.com/sagemath/sage/commit/97ceea842a39fa2f2e9098daae2738a2f2765b9e.patch?full_index=1";
hash = "sha256-/Tk3tIy0syOjaNRMCyot6kma3jj4288QJ3zypS79jZo=";
})
# https://github.com/sagemath/sage/pull/41346, landed in 10.9.beta2
(fetchpatch2 {
name = "ipython-9.8-updte.patch";
url = "https://github.com/sagemath/sage/commit/380949e6eeda80cca6e5dd971e2c6f367647a863.patch?full_index=1";
hash = "sha256-e4zmgfHrenOixgbUS1uFHzftmwNGGoSb7yFhYmqT0yc=";
})
# https://github.com/sagemath/sage/pull/41395, landed in 10.9.beta2
(fetchpatch2 {
name = "pyparsing-3.3-update.patch";
url = "https://github.com/sagemath/sage/commit/1b5a5dd78b5dcb4b3c7d1f94461ddbc647c5679f.patch?full_index=1";
hash = "sha256-kFXg2O3IpwaOwAaNIy6Wscx8/XSDWXrqAXS2ZJgdqsg=";
})
# https://github.com/sagemath/sage/pull/41433, landed in 10.9.beta3
(fetchpatch2 {
name = "scipy-1.17-update.patch";
url = "https://github.com/sagemath/sage/commit/ff58afe27c80c067a8965e1d70966e25d0355aaf.patch?full_index=1";
hash = "sha256-gWoXwhUVXL2RSVLPRbxtlP0LCSEkJ9z1PJ1wKLXef1k=";
})
# https://github.com/sagemath/sage/pull/42089, landed in 10.10.beta0
(fetchpatch2 {
name = "flint-3.5.0-update.patch";
@@ -158,16 +119,28 @@ stdenv.mkDerivation rec {
"s|var(\"SAGE_ROOT\".*|var(\"SAGE_ROOT\", \"$out\")|" \
src/sage/env.py
# https://github.com/sagemath/sage/pull/40489 removed this file,
# but it seems like autogen/interpreters/internal/__init__.py
# was not fully adapted for that, and it causes fast_callable problems
touch src/sage/ext/all.py
# HACK: meson tries to run maxima at build time. that's not necessary
# because we ensure Sage will find all it needs at runtime.
sed -i 's/not is_windows/false/g' src/sage/meson.build
sed -i 's/if not maxima_present/if false/g' src/sage/libs/meson.build
sed -i '/SAGE_MAXIMA/d' src/sage/libs/meson.build
# sage --docbuild unsets JUPYTER_PATH, which breaks our docbuilding
# https://trac.sagemath.org/ticket/33650#comment:32
sed -i "/export JUPYTER_PATH/d" src/bin/sage
'';
buildPhase = "# do nothing";
buildPhase = ''
tar xzf ${configure-src}
rm configure
'';
installPhase = ''
cp -r . "$out"
tar xzf ${configure-src} -C "$out"
rm "$out/configure"
'';
}

View File

@@ -12,15 +12,31 @@ stdenv.mkDerivation rec {
strictDeps = true;
nativeBuildInputs = with python3.pkgs; [
meson-python
cython
sphinx
];
unpackPhase = ''
export SAGE_DOC_OVERRIDE="$PWD/share/doc/sage"
export SAGE_DOC_SRC_OVERRIDE="$PWD/docsrc"
cp -r "${src}/src/doc" "$SAGE_DOC_SRC_OVERRIDE"
chmod -R 755 "$SAGE_DOC_SRC_OVERRIDE"
# Tools needed for meson to run the bootstrap script
cp -r "${src}/tools/bootstrap-docs.py" "$SAGE_DOC_SRC_OVERRIDE"
cp -r "${src}/build/sage_bootstrap" "$SAGE_DOC_SRC_OVERRIDE"
chmod -R 755 "$SAGE_DOC_SRC_OVERRIDE/sage_bootstrap/env.py"
sed "/assert/d" "${src}/build/sage_bootstrap/env.py" > "$SAGE_DOC_SRC_OVERRIDE/sage_bootstrap/env.py"
'';
preBuild = ''
preConfigure = ''
cd docsrc
'';
buildPhase = ''
export SAGE_ROOT="${sage-with-env.env.lib.src}"
export PATH="${sage-with-env}/bin:$PATH"
export HOME="$TMPDIR/sage_home"
@@ -32,10 +48,10 @@ stdenv.mkDerivation rec {
# jupyter-sphinx calls the sagemath jupyter kernel during docbuild
export JUPYTER_PATH=${jupyter-kernel-specs}
# the Makefile tries to guess SAGE_DOC, but in a buggy way (changed in 10.8)
export SAGE_DOC="$SAGE_DOC_OVERRIDE"
cd docsrc
meson setup $SAGE_DOC_OVERRIDE
meson compile -C $SAGE_DOC_OVERRIDE
sage -advanced > $SAGE_DOC_OVERRIDE/en/reference/repl/options.txt
meson compile -C $SAGE_DOC_OVERRIDE doc-html
'';
enableParallelBuilding = true;

View File

@@ -9,6 +9,7 @@
perl,
pkg-config,
sage-setup,
sage-docbuild,
setuptools,
gd,
iml,
@@ -73,6 +74,7 @@
pplpy,
primecountpy,
ptyprocess,
pytest,
requests,
rpy2,
scipy,
@@ -103,10 +105,8 @@ buildPythonPackage rec {
pkg-config
sage-setup
setuptools
];
pythonRelaxDeps = [
"sphinx"
meson-python
cython
];
buildInputs = [
@@ -115,6 +115,8 @@ buildPythonPackage rec {
libpng
];
mesonFlags = [ "-Dbuild-docs=false" ];
env = lib.optionalAttrs stdenv.cc.isClang {
# code tries to assign a unsigned long to an int in an initialized list
# leading to this error.
@@ -175,7 +177,6 @@ buildPythonPackage rec {
lrcalc-python
matplotlib
memory-allocator
meson-python
mpmath
networkx
numpy
@@ -186,8 +187,10 @@ buildPythonPackage rec {
pplpy
primecountpy
ptyprocess
pytest
requests
rpy2
sage-docbuild
scipy
sphinx
sympy
@@ -195,28 +198,7 @@ buildPythonPackage rec {
];
preBuild = ''
export SAGE_ROOT="$PWD"
export SAGE_LOCAL="$SAGE_ROOT"
export SAGE_SHARE="$SAGE_LOCAL/share"
# set locations of dependencies (needed for nbextensions like threejs)
. ${env-locations}/sage-env-locations
export JUPYTER_PATH="$SAGE_LOCAL/jupyter"
export PATH="$SAGE_ROOT/build/bin:$SAGE_ROOT/src/bin:$PATH"
export SAGE_NUM_THREADS="$NIX_BUILD_CORES"
mkdir -p "$SAGE_SHARE/sage/ext/notebook-ipython"
mkdir -p "var/lib/sage/installed"
sed -i "/sage-conf/d" src/{setup.cfg,pyproject.toml,requirements.txt}
cd build/pkgs/sagelib/src
'';
postInstall = ''
rm -r "$out/${python.sitePackages}/sage/cython_debug"
patchShebangs src/sage_setup/autogen/interpreters/__main__.py
'';
doCheck = false; # we will run tests in sage-tests.nix

View File

@@ -4,7 +4,9 @@
python,
fetchPypi,
pari,
pkg-config,
gmp,
meson-python,
cython,
cysignals,
@@ -15,26 +17,33 @@
buildPythonPackage rec {
pname = "cypari2";
# upgrade may break sage, please test the sage build or ping @timokau on upgrade
version = "2.2.2";
format = "setuptools";
version = "2.2.4";
pyproject = true;
src = fetchPypi {
inherit pname version;
hash = "sha256-E6M4c16iIcEGj4/EFVYb93fYxoclcCvHSVRyZP0JFyA=";
hash = "sha256-+fDplKmgsGRhkyBBHh2cMDFYhH4FW1gILv2t5ayX9hM=";
};
preBuild = ''
# generate cythonized extensions (auto_paridecl.pxd is crucial)
${python.pythonOnBuildForHost.interpreter} setup.py build_ext --inplace
preConfigure = ''
substituteInPlace cypari2/meson.build \
--replace-fail "'cypari2.py'" "'cypari2.pc'"
'';
nativeBuildInputs = [ pari ];
buildInputs = [ gmp ];
propagatedBuildInputs = [
cysignals
build-system = [
meson-python
cython
cysignals
];
nativeBuildInputs = [
pari
pkg-config
];
buildInputs = [
gmp
pari
];
checkPhase = ''