Skip to content

Commit

Permalink
Trac #33803: Fixes for the distributions sagemath-objects, sagemath-c…
Browse files Browse the repository at this point in the history
…ategories

(from #29941, #33800)

These distributions do not need ECL, so we revise the unconditional
dependency of `sage.env.cython_aliases` on `ecl-config` introduced in
#30770.

We add some missing modules to the `MANIFEST` of '''sagemath-objects'''.

To test:
{{{
 ./bootstrap && ./sage -sh -c '(cd pkgs/sagemath-objects &&
SAGE_NUM_THREADS=16 tox -r -v -v -v -e py39)'
}}}

URL: https://trac.sagemath.org/33803
Reported by: mkoeppe
Ticket author(s): Matthias Koeppe
Reviewer(s): Dima Pasechnik
  • Loading branch information
Release Manager committed May 22, 2022
2 parents 3e6b41f + c5d43bd commit 955b5d9
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 12 deletions.
8 changes: 7 additions & 1 deletion pkgs/sagemath-categories/README.rst
Expand Up @@ -8,7 +8,7 @@ About SageMath
"Creating a Viable Open Source Alternative to
Magma, Maple, Mathematica, and MATLAB"

Copyright (C) 2005-2020 The Sage Development Team
Copyright (C) 2005-2022 The Sage Development Team

https://www.sagemath.org

Expand All @@ -23,6 +23,12 @@ About this experimental pip-installable source distribution
This pip-installable source distribution `sagemath-categories` is an experimental distribution of a small part of the Sage Library. Use at your own risk. It provides a small subset of the modules of the Sage library ("sagelib", `sagemath-standard`). It is a superset of the `sagemath-objects` (providing Sage objects, the element/parent framework, categories, the coercion system and the related metaclasses), making various additional categories available without introducing dependencies on additional mathematical libraries.


Dependencies
------------

When building from source, development packages of `gmp`, `mpfr`, and `mpc` are needed.


Documentation
-------------

Expand Down
2 changes: 2 additions & 0 deletions pkgs/sagemath-objects/MANIFEST.in
Expand Up @@ -53,6 +53,7 @@ include sage/misc/constant_function.*
include sage/misc/call.*
include sage/misc/bindable_class.*
include sage/misc/namespace_package.p*
include sage/misc/package_dir.py

include sage/misc/verbose.*
include sage/misc/repr.*
Expand Down Expand Up @@ -99,6 +100,7 @@ include sage/misc/randstate.*
include sage/misc/misc.* # walltime, cputime
# graft sage/features
include sage/misc/package.*
include sage/misc/sagedoc.py

graft sage/repl
graft sage/server
Expand Down
8 changes: 7 additions & 1 deletion pkgs/sagemath-objects/README.rst
Expand Up @@ -8,7 +8,7 @@ About SageMath
"Creating a Viable Open Source Alternative to
Magma, Maple, Mathematica, and MATLAB"

Copyright (C) 2005-2020 The Sage Development Team
Copyright (C) 2005-2022 The Sage Development Team

https://www.sagemath.org

Expand All @@ -23,6 +23,12 @@ About this experimental pip-installable source distribution
This pip-installable source distribution `sagemath-objects` is an experimental distribution of a small part of the Sage Library. Use at your own risk. It provides a small, fundamental subset of the modules of the Sage library ("sagelib", `sagemath-standard`), making Sage objects, the element/parent framework, categories, the coercion system and the related metaclasses available.


Dependencies
------------

When building from source, development packages of `gmp`, `mpfr`, and `mpc` are needed.


Documentation
-------------

Expand Down
27 changes: 17 additions & 10 deletions src/sage/env.py
Expand Up @@ -398,7 +398,7 @@ def get_cblas_pc_module_name() -> str:


default_required_modules = ('fflas-ffpack', 'givaro', 'gsl', 'linbox', 'Singular',
'libpng', 'gdlib', 'm4ri', 'zlib', 'cblas')
'libpng', 'gdlib', 'm4ri', 'zlib', 'cblas', 'ecl')


default_optional_modules = ('lapack',)
Expand Down Expand Up @@ -481,6 +481,22 @@ def cython_aliases(required_modules=None,
from collections import defaultdict
pc = defaultdict(list, {'libraries': ['z']})
libs = "-lz"
elif lib == 'ecl':
try:
# Determine ecl-specific compiler arguments using the ecl-config script
ecl_cflags = subprocess.run([ECL_CONFIG, "--cflags"], check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True).stdout.split()
ecl_libs = subprocess.run([ECL_CONFIG, "--libs"], check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True).stdout.split()
except subprocess.CalledProcessError:
if required:
raise
else:
continue
aliases["ECL_CFLAGS"] = list(filter(lambda s: not s.startswith('-I'), ecl_cflags))
aliases["ECL_INCDIR"] = list(map(lambda s: s[2:], filter(lambda s: s.startswith('-I'), ecl_cflags)))
aliases["ECL_LIBDIR"] = list(map(lambda s: s[2:], filter(lambda s: s.startswith('-L'), ecl_libs)))
aliases["ECL_LIBRARIES"] = list(map(lambda s: s[2:], filter(lambda s: s.startswith('-l'), ecl_libs)))
aliases["ECL_LIBEXTRA"] = list(filter(lambda s: not s.startswith(('-l','-L')), ecl_libs))
continue
else:
try:
aliases[var + "CFLAGS"] = pkgconfig.cflags(lib).split()
Expand Down Expand Up @@ -537,15 +553,6 @@ def uname_specific(name, value, alternative):
except (ValueError, KeyError):
pass

# Determine ecl-specific compiler arguments using the ecl-config script
ecl_cflags = subprocess.run([ECL_CONFIG, "--cflags"], check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True).stdout.split()
aliases["ECL_CFLAGS"] = list(filter(lambda s: not s.startswith('-I'), ecl_cflags))
aliases["ECL_INCDIR"] = list(map(lambda s: s[2:], filter(lambda s: s.startswith('-I'), ecl_cflags)))
ecl_libs = subprocess.run([ECL_CONFIG, "--libs"], check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True).stdout.split()
aliases["ECL_LIBDIR"] = list(map(lambda s: s[2:], filter(lambda s: s.startswith('-L'), ecl_libs)))
aliases["ECL_LIBRARIES"] = list(map(lambda s: s[2:], filter(lambda s: s.startswith('-l'), ecl_libs)))
aliases["ECL_LIBEXTRA"] = list(filter(lambda s: not s.startswith(('-l','-L')), ecl_libs))

# NTL
aliases["NTL_CFLAGS"] = ['-std=c++11']
aliases["NTL_INCDIR"] = [NTL_INCDIR] if NTL_INCDIR else []
Expand Down

0 comments on commit 955b5d9

Please sign in to comment.