uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead
https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948 this can do it nicely. Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
commit
56de2bcd43
30691 changed files with 3076956 additions and 0 deletions
78
pkgs/applications/science/math/sage/README.md
Normal file
78
pkgs/applications/science/math/sage/README.md
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
# Sage on nixos
|
||||
|
||||
Sage is a pretty complex package that depends on many other complex packages and patches some of those. As a result, the sage nix package is also quite complex.
|
||||
|
||||
Don't feel discouraged to fix, simplify or improve things though. The individual files have comments explaining their purpose. The most importent ones are `default.nix` linking everything together, `sage-src.nix` adding patches and `sagelib.nix` building the actual sage package.
|
||||
|
||||
## The sage build is broken
|
||||
|
||||
First you should find out which change to nixpkgs is at fault (if you don't already know). You can use `git-bisect` for that (see the manpage).
|
||||
|
||||
If the build broke as a result of a package update, try those solutions in order:
|
||||
|
||||
- search the [sage trac](https://trac.sagemath.org/) for keywords like "Upgrade <package>". Maybe somebody has already proposed a patch that fixes the issue. You can then add a `fetchpatch` to `sage-src.nix`.
|
||||
|
||||
- check if [gentoo](https://github.com/cschwan/sage-on-gentoo/tree/master/sci-mathematics/sage), [debian](https://salsa.debian.org/science-team/sagemath/tree/master/debian) or [arch linux](https://git.archlinux.org/svntogit/community.git/tree/trunk?h=packages/sagemath) already solved the problem. You can then again add a `fetchpatch` to `sage-src.nix`. If applicable you should also [propose the patch upstream](#proposing-a-sage-patch).
|
||||
|
||||
- fix the problem yourself. First clone the sagemath source and then check out the sage version you want to patch:
|
||||
|
||||
```
|
||||
[user@localhost ~]$ git clone https://github.com/sagemath/sage.git
|
||||
[user@localhost ~]$ cd sage
|
||||
[user@localhost sage]$ git checkout 8.2 # substitute the relevant version here
|
||||
```
|
||||
|
||||
Then make the needed changes and generate a patch with `git diff`:
|
||||
|
||||
```
|
||||
[user@localhost ~]$ <make changes>
|
||||
[user@localhost ~]$ git diff -u > /path/to/nixpkgs/pkgs/applications/science/math/sage/patches/name-of-patch.patch
|
||||
```
|
||||
|
||||
Now just add the patch to `sage-src.nix` and test your changes. If they fix the problem, [propose them upstream](#proposing-a-sage-patch) and add a link to the trac ticket.
|
||||
|
||||
- pin the package version in `default.nix` and add a note that explains why that is necessary.
|
||||
|
||||
|
||||
## Proposing a sage patch
|
||||
|
||||
You can [login the sage trac using GitHub](https://trac.sagemath.org/login). Your username will then be `gh-<your-github-name>`. The only other way is to request a trac account via email. After that refer to [git the hard way](http://doc.sagemath.org/html/en/developer/manual_git.html#chapter-manual-git) in the sage documentation. The "easy way" requires a non-GitHub account (requested via email) and a special tool. The "hard way" is really not all that hard if you're a bit familiar with git.
|
||||
|
||||
Here's the gist, assuming you want to use ssh key authentication. First, [add your public ssh key](https://trac.sagemath.org/prefs/sshkeys). Then:
|
||||
|
||||
```
|
||||
[user@localhost ~]$ git clone https://github.com/sagemath/sage.git
|
||||
[user@localhost ~]$ cd sage
|
||||
[user@localhost sage]$ git remote add trac git@trac.sagemath.org:sage.git -t master
|
||||
[user@localhost sage]$ git checkout -b u/gh-<your-github-username>/<your-branch-name> develop
|
||||
[user@localhost sage]$ <make changes>
|
||||
[user@localhost sage]$ git add .
|
||||
[user@localhost sage]$ git commit
|
||||
[user@localhost sage]$ git show # review your changes
|
||||
[user@localhost sage]$ git push --set-upstream trac u/gh-<your-github-username>/<your-branch-name>
|
||||
```
|
||||
|
||||
You now created a branch on the trac server (you *must* follow the naming scheme as you only have push access to branches with the `u/gh-<your-github-username>/` prefix).
|
||||
Now you can [create a new trac ticket](https://trac.sagemath.org/newticket).
|
||||
- Write a description of the change
|
||||
- set the type and component as appropriate
|
||||
- write your real name in the "Authors" field
|
||||
- write `u/gh-<your-github-username>/<your-branch-name>` in the "Branch" field
|
||||
- click "Create ticket"
|
||||
- click "Modify" on the top right of your ticket (for some reason you can only change the ticket status after you have created it)
|
||||
- set the ticket status from `new` to `needs_review`
|
||||
- click "Save changes"
|
||||
|
||||
Refer to sages [Developer's Guide](http://doc.sagemath.org/html/en/developer/index.html) for further details.
|
||||
|
||||
## I want to update sage
|
||||
|
||||
You'll need to change the `version` field in `sage-src.nix`. Afterwards just try to build and let nix tell you which patches no longer apply (hopefully because they were adopted upstream). Remove those.
|
||||
|
||||
Hopefully the build will succeed now. If it doesn't and the problem is obvious, fix it as described in [The sage build is broken](#the-sage-build-is-broken).
|
||||
If the problem is not obvious, you can try to first update sage to an intermediate version (remember that you can also set the `version` field to any git revision of sage) and locate the sage commit that introduced the issue. You can even use `git-bisect` for that (it will only be a bit tricky to keep track of which patches to apply). Hopefully after that the issue will be obvious.
|
||||
|
||||
## Well, that didn't help!
|
||||
|
||||
If you couldn't fix the problem, create a GitHub issue on the nixpkgs repo and ping @timokau (or whoever is listed in the `maintainers` list of the sage package).
|
||||
Describe what you did and why it didn't work. Afterwards it would be great if you help the next guy out and improve this documentation!
|
||||
177
pkgs/applications/science/math/sage/default.nix
Normal file
177
pkgs/applications/science/math/sage/default.nix
Normal file
|
|
@ -0,0 +1,177 @@
|
|||
{ pkgs
|
||||
, withDoc ? false
|
||||
, requireSageTests ? true
|
||||
, extraPythonPackages ? ps: []
|
||||
}:
|
||||
|
||||
# Here sage and its dependencies are put together. Some dependencies may be pinned
|
||||
# as a last resort. Patching sage for compatibility with newer dependency versions
|
||||
# is always preferred, see `sage-src.nix` for that.
|
||||
|
||||
let
|
||||
inherit (pkgs) symlinkJoin callPackage nodePackages;
|
||||
|
||||
python3 = pkgs.python3.override {
|
||||
packageOverrides = self: super: {
|
||||
# `sagelib`, i.e. all of sage except some wrappers and runtime dependencies
|
||||
sagelib = self.callPackage ./sagelib.nix {
|
||||
inherit flint arb;
|
||||
inherit sage-src env-locations singular;
|
||||
inherit (maxima) lisp-compiler;
|
||||
linbox = pkgs.linbox.override { withSage = true; };
|
||||
pkg-config = pkgs.pkg-config; # not to confuse with pythonPackages.pkg-config
|
||||
};
|
||||
|
||||
sage-docbuild = self.callPackage ./python-modules/sage-docbuild.nix {
|
||||
inherit sage-src;
|
||||
};
|
||||
|
||||
sage-setup = self.callPackage ./python-modules/sage-setup.nix {
|
||||
inherit sage-src;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
jupyter-kernel-definition = {
|
||||
displayName = "SageMath ${sage-src.version}";
|
||||
argv = [
|
||||
"${sage-with-env}/bin/sage" # FIXME which sage
|
||||
"--python"
|
||||
"-m"
|
||||
"sage.repl.ipython_kernel"
|
||||
"-f"
|
||||
"{connection_file}"
|
||||
];
|
||||
language = "sagemath";
|
||||
# just one 16x16 logo is available
|
||||
logo32 = "${sage-src}/src/doc/common/themes/sage/static/sageicon.png";
|
||||
logo64 = "${sage-src}/src/doc/common/themes/sage/static/sageicon.png";
|
||||
};
|
||||
|
||||
jupyter-kernel-specs = pkgs.jupyter-kernel.create {
|
||||
definitions = pkgs.jupyter-kernel.default // {
|
||||
sagemath = jupyter-kernel-definition;
|
||||
};
|
||||
};
|
||||
|
||||
three = callPackage ./threejs-sage.nix { };
|
||||
|
||||
# A bash script setting various environment variables to tell sage where
|
||||
# the files its looking fore are located. Also see `sage-env`.
|
||||
env-locations = callPackage ./env-locations.nix {
|
||||
inherit pari_data;
|
||||
inherit singular maxima;
|
||||
inherit three;
|
||||
cysignals = python3.pkgs.cysignals;
|
||||
mathjax = nodePackages.mathjax;
|
||||
};
|
||||
|
||||
# The shell file that gets sourced on every sage start. Will also source
|
||||
# the env-locations file.
|
||||
sage-env = callPackage ./sage-env.nix {
|
||||
sagelib = python3.pkgs.sagelib;
|
||||
sage-docbuild = python3.pkgs.sage-docbuild;
|
||||
inherit env-locations;
|
||||
inherit python3 singular palp flint pythonEnv maxima;
|
||||
pkg-config = pkgs.pkg-config; # not to confuse with pythonPackages.pkg-config
|
||||
};
|
||||
|
||||
# The documentation for sage, building it takes a lot of ram.
|
||||
sagedoc = callPackage ./sagedoc.nix {
|
||||
inherit sage-with-env jupyter-kernel-specs;
|
||||
};
|
||||
|
||||
# sagelib with added wrappers and a dependency on sage-tests to make sure thet tests were run.
|
||||
sage-with-env = callPackage ./sage-with-env.nix {
|
||||
inherit python3 pythonEnv;
|
||||
inherit sage-env;
|
||||
inherit singular maxima;
|
||||
inherit three;
|
||||
pkg-config = pkgs.pkg-config; # not to confuse with pythonPackages.pkg-config
|
||||
};
|
||||
|
||||
# Doesn't actually build anything, just runs sages testsuite. This is a
|
||||
# separate derivation to make it possible to re-run the tests without
|
||||
# rebuilding sagelib (which takes ~30 minutes).
|
||||
# Running the tests should take something in the order of 1h.
|
||||
sage-tests = callPackage ./sage-tests.nix {
|
||||
inherit sage-with-env;
|
||||
};
|
||||
|
||||
sage-src = callPackage ./sage-src.nix {};
|
||||
|
||||
pythonRuntimeDeps = with python3.pkgs; [
|
||||
sagelib
|
||||
sage-docbuild
|
||||
cvxopt
|
||||
networkx
|
||||
service-identity
|
||||
psutil
|
||||
sympy
|
||||
fpylll
|
||||
matplotlib
|
||||
tkinter # optional, as a matplotlib backend (use with `%matplotlib tk`)
|
||||
scipy
|
||||
ipywidgets
|
||||
rpy2
|
||||
sphinx
|
||||
pillow
|
||||
] ++ extraPythonPackages python3.pkgs;
|
||||
|
||||
pythonEnv = python3.buildEnv.override {
|
||||
extraLibs = pythonRuntimeDeps;
|
||||
ignoreCollisions = true;
|
||||
} // { extraLibs = pythonRuntimeDeps; }; # make the libs accessible
|
||||
|
||||
arb = pkgs.arb.override { inherit flint; };
|
||||
|
||||
singular = pkgs.singular.override { inherit flint; };
|
||||
|
||||
maxima = pkgs.maxima.override {
|
||||
lisp-compiler = pkgs.ecl.override {
|
||||
# "echo syntax error | ecl > /dev/full 2>&1" segfaults in
|
||||
# ECL. We apply a patch to fix it (write_error.patch), but it
|
||||
# only works if threads are disabled. sage 9.2 tests this
|
||||
# (src/sage/interfaces/tests.py) and ships ecl like so.
|
||||
# https://gitlab.com/embeddable-common-lisp/ecl/-/merge_requests/1#note_1657275
|
||||
threadSupport = false;
|
||||
|
||||
# if we don't use the system boehmgc, sending a SIGINT to ecl
|
||||
# can segfault if we it happens during memory allocation.
|
||||
# src/sage/libs/ecl.pyx would intermittently fail in this case.
|
||||
useBoehmgc = true;
|
||||
};
|
||||
};
|
||||
|
||||
# With openblas (64 bit), the tests fail the same way as when sage is build with
|
||||
# openblas instead of openblasCompat. Apparently other packages somehow use flints
|
||||
# blas when it is available. Alternative would be to override flint to use
|
||||
# openblasCompat.
|
||||
flint = pkgs.flint.override { withBlas = false; };
|
||||
|
||||
# Multiple palp dimensions need to be available and sage expects them all to be
|
||||
# in the same folder.
|
||||
palp = symlinkJoin {
|
||||
name = "palp-${pkgs.palp.version}";
|
||||
paths = [
|
||||
(pkgs.palp.override { dimensions = 4; doSymlink = false; })
|
||||
(pkgs.palp.override { dimensions = 5; doSymlink = false; })
|
||||
(pkgs.palp.override { dimensions = 6; doSymlink = true; })
|
||||
(pkgs.palp.override { dimensions = 11; doSymlink = false; })
|
||||
];
|
||||
};
|
||||
|
||||
# Sage expects those in the same directory.
|
||||
pari_data = symlinkJoin {
|
||||
name = "pari_data";
|
||||
paths = with pkgs; [
|
||||
pari-galdata
|
||||
pari-seadata-small
|
||||
];
|
||||
};
|
||||
in
|
||||
# A wrapper around sage that makes sure sage finds its docs (if they were build).
|
||||
callPackage ./sage.nix {
|
||||
inherit sage-tests sage-with-env sagedoc jupyter-kernel-definition jupyter-kernel-specs;
|
||||
inherit withDoc requireSageTests;
|
||||
}
|
||||
17
pkgs/applications/science/math/sage/dist-tests.nix
Normal file
17
pkgs/applications/science/math/sage/dist-tests.nix
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# Lists past failures and files associated with it. The intention is to build
|
||||
# up a subset of a testsuite that catches 95% of failures that are relevant for
|
||||
# distributions while only taking ~5m to run. This in turn makes it more
|
||||
# reasonable to re-test sage on dependency changes and makes it easier for
|
||||
# users to override the sage derivation.
|
||||
# This is an experiment for now. If it turns out that there really is a small
|
||||
# subset of files responsible for the vast majority of packaging tests, we can
|
||||
# think about moving this upstream.
|
||||
[
|
||||
"src/sage/env.py" # [1]
|
||||
"src/sage/misc/persist.pyx" # [1]
|
||||
"src/sage/misc/inline_fortran.py" # [1]
|
||||
"src/sage/repl/ipython_extension.py" # [1]
|
||||
]
|
||||
|
||||
# Numbered list of past failures to annotate files with
|
||||
# [1] PYTHONPATH related issue https://github.com/NixOS/nixpkgs/commit/ec7f569211091282410050e89e68832d4fe60528
|
||||
48
pkgs/applications/science/math/sage/env-locations.nix
Normal file
48
pkgs/applications/science/math/sage/env-locations.nix
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
{ writeTextFile
|
||||
, pari_data
|
||||
, pari
|
||||
, singular
|
||||
, maxima
|
||||
, conway_polynomials
|
||||
, graphs
|
||||
, elliptic_curves
|
||||
, polytopes_db
|
||||
, gap
|
||||
, combinatorial_designs
|
||||
, jmol
|
||||
, mathjax
|
||||
, three
|
||||
, cysignals
|
||||
}:
|
||||
|
||||
# A bash script setting various environment variables to tell sage where
|
||||
# the files its looking fore are located. Also see `sage-env`.
|
||||
writeTextFile rec {
|
||||
name = "sage-env-locations";
|
||||
destination = "/${name}";
|
||||
text = ''
|
||||
export GP_DATA_DIR="${pari_data}/share/pari"
|
||||
export PARI_DATA_DIR="${pari_data}"
|
||||
export GPHELP="${pari}/bin/gphelp"
|
||||
export GPDOCDIR="${pari}/share/pari/doc"
|
||||
export SINGULARPATH='${singular}/share/singular'
|
||||
export SINGULAR_SO='${singular}/lib/libSingular.so'
|
||||
export GAP_SO='${gap}/lib/libgap.so'
|
||||
export SINGULAR_EXECUTABLE='${singular}/bin/Singular'
|
||||
export MAXIMA_FAS='${maxima}/lib/maxima/${maxima.version}/binary-ecl/maxima.fas'
|
||||
export MAXIMA_PREFIX="${maxima}"
|
||||
export CONWAY_POLYNOMIALS_DATA_DIR='${conway_polynomials}/share/conway_polynomials'
|
||||
export GRAPHS_DATA_DIR='${graphs}/share/graphs'
|
||||
export ELLCURVE_DATA_DIR='${elliptic_curves}/share/ellcurves'
|
||||
export POLYTOPE_DATA_DIR='${polytopes_db}/share/reflexive_polytopes'
|
||||
export GAP_ROOT_DIR='${gap}/share/gap/build-dir'
|
||||
export ECLDIR='${maxima.lisp-compiler}/lib/${maxima.lisp-compiler.pname}-${maxima.lisp-compiler.version}/'
|
||||
export COMBINATORIAL_DESIGN_DATA_DIR="${combinatorial_designs}/share/combinatorial_designs"
|
||||
export CREMONA_MINI_DATA_DIR="${elliptic_curves}/share/cremona"
|
||||
export JMOL_DIR="${jmol}/share/jmol" # point to the directory that contains JmolData.jar
|
||||
export JSMOL_DIR="${jmol}/share/jsmol"
|
||||
export MATHJAX_DIR="${mathjax}/lib/node_modules/mathjax"
|
||||
export THREEJS_DIR="${three}/lib/node_modules/three"
|
||||
export SAGE_INCLUDE_DIRECTORIES="${cysignals}/${cysignals.pythonModule.sitePackages}"
|
||||
'';
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
diff --git a/src/sage/repl/configuration.py b/src/sage/repl/configuration.py
|
||||
index 67d7d2accf..18279581e2 100644
|
||||
--- a/src/sage/repl/configuration.py
|
||||
+++ b/src/sage/repl/configuration.py
|
||||
@@ -9,10 +9,11 @@ the IPython simple prompt is being used::
|
||||
sage: cmd = 'print([sys.stdin.isatty(), sys.stdout.isatty()])'
|
||||
sage: import pexpect
|
||||
sage: output = pexpect.run(
|
||||
- ....: 'bash -c \'echo "{0}" | sage\''.format(cmd),
|
||||
+ ....: 'bash -c \'export SAGE_BANNER=no; echo "{0}" | sage\''.format(cmd),
|
||||
....: ).decode('utf-8', 'surrogateescape')
|
||||
- sage: 'sage: [False, True]' in output
|
||||
- True
|
||||
+ sage: print(output)
|
||||
+ sage...[False, True]
|
||||
+ ...
|
||||
"""
|
||||
|
||||
#*****************************************************************************
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
diff --git a/src/sage/env.py b/src/sage/env.py
|
||||
index c4953cfa65..47b880f9ad 100644
|
||||
--- a/src/sage/env.py
|
||||
+++ b/src/sage/env.py
|
||||
@@ -244,81 +244,8 @@ os.environ['MPMATH_SAGE'] = '1'
|
||||
SAGE_BANNER = var("SAGE_BANNER", "")
|
||||
SAGE_IMPORTALL = var("SAGE_IMPORTALL", "yes")
|
||||
|
||||
-
|
||||
-def _get_shared_lib_path(*libnames: str) -> Optional[str]:
|
||||
- """
|
||||
- Return the full path to a shared library file installed in
|
||||
- ``$SAGE_LOCAL/lib`` or the directories associated with the
|
||||
- Python sysconfig.
|
||||
-
|
||||
- This can also be passed more than one library name (e.g. for cases where
|
||||
- some library may have multiple names depending on the platform) in which
|
||||
- case the first one found is returned.
|
||||
-
|
||||
- This supports most *NIX variants (in which ``lib<libname>.so`` is found
|
||||
- under ``$SAGE_LOCAL/lib``), macOS (same, but with the ``.dylib``
|
||||
- extension), and Cygwin (under ``$SAGE_LOCAL/bin/cyg<libname>.dll``,
|
||||
- or ``$SAGE_LOCAL/bin/cyg<libname>-*.dll`` for versioned DLLs).
|
||||
-
|
||||
- For distributions like Debian that use a multiarch layout, we also try the
|
||||
- multiarch lib paths (i.e. ``/usr/lib/<arch>/``).
|
||||
-
|
||||
- This returns ``None`` if no matching library file could be found.
|
||||
-
|
||||
- EXAMPLES::
|
||||
-
|
||||
- sage: from sage.env import _get_shared_lib_path
|
||||
- sage: "gap" in _get_shared_lib_path("gap")
|
||||
- True
|
||||
- sage: _get_shared_lib_path("an_absurd_lib") is None
|
||||
- True
|
||||
-
|
||||
- """
|
||||
-
|
||||
- for libname in libnames:
|
||||
- search_directories: List[Path] = []
|
||||
- patterns: List[str] = []
|
||||
- if sys.platform == 'cygwin':
|
||||
- # Later down we take the first matching DLL found, so search
|
||||
- # SAGE_LOCAL first so that it takes precedence
|
||||
- if SAGE_LOCAL:
|
||||
- search_directories.append(Path(SAGE_LOCAL) / 'bin')
|
||||
- search_directories.append(Path(sysconfig.get_config_var('BINDIR')))
|
||||
- # Note: The following is not very robust, since if there are multible
|
||||
- # versions for the same library this just selects one more or less
|
||||
- # at arbitrary. However, practically speaking, on Cygwin, there
|
||||
- # will only ever be one version
|
||||
- patterns = [f'cyg{libname}.dll', f'cyg{libname}-*.dll']
|
||||
- else:
|
||||
- if sys.platform == 'darwin':
|
||||
- ext = 'dylib'
|
||||
- else:
|
||||
- ext = 'so'
|
||||
-
|
||||
- if SAGE_LOCAL:
|
||||
- search_directories.append(Path(SAGE_LOCAL) / 'lib')
|
||||
- libdir = sysconfig.get_config_var('LIBDIR')
|
||||
- if libdir is not None:
|
||||
- libdir = Path(libdir)
|
||||
- search_directories.append(libdir)
|
||||
-
|
||||
- multiarchlib = sysconfig.get_config_var('MULTIARCH')
|
||||
- if multiarchlib is not None:
|
||||
- search_directories.append(libdir / multiarchlib),
|
||||
-
|
||||
- patterns = [f'lib{libname}.{ext}']
|
||||
-
|
||||
- for directory in search_directories:
|
||||
- for pattern in patterns:
|
||||
- path = next(directory.glob(pattern), None)
|
||||
- if path is not None:
|
||||
- return str(path.resolve())
|
||||
-
|
||||
- # Just return None if no files were found
|
||||
- return None
|
||||
-
|
||||
# locate libgap shared object
|
||||
-GAP_SO = var("GAP_SO", _get_shared_lib_path("gap", ""))
|
||||
+GAP_SO = var("GAP_SO", '/default')
|
||||
|
||||
# post process
|
||||
if DOT_SAGE is not None and ' ' in DOT_SAGE:
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
diff --git a/src/sage/misc/sagedoc.py b/src/sage/misc/sagedoc.py
|
||||
index 08c4225b87..3a9bbe4ed0 100644
|
||||
--- a/src/sage/misc/sagedoc.py
|
||||
+++ b/src/sage/misc/sagedoc.py
|
||||
@@ -1402,6 +1402,8 @@ class _sage_doc:
|
||||
sage: identity_matrix.__doc__ in browse_sage_doc(identity_matrix, 'rst')
|
||||
True
|
||||
sage: browse_sage_doc(identity_matrix, 'html', False) # optional - sphinx sagemath_doc_html
|
||||
+ ...
|
||||
+ FutureWarning: The configuration setting "embed_images" will be removed in Docutils 1.2. Use "image_loading: link".
|
||||
'...div...File:...Type:...Definition:...identity_matrix...'
|
||||
|
||||
In the 'text' version, double colons have been replaced with
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
diff --git a/src/sage/doctest/forker.py b/src/sage/doctest/forker.py
|
||||
index 02e18e67e7..2ebf6eb35f 100644
|
||||
--- a/src/sage/doctest/forker.py
|
||||
+++ b/src/sage/doctest/forker.py
|
||||
@@ -1075,6 +1075,14 @@ class SageDocTestRunner(doctest.DocTestRunner, object):
|
||||
sage: set(ex2.predecessors) == set([ex0,ex1])
|
||||
True
|
||||
"""
|
||||
+
|
||||
+ # Fix ECL dir race conditions by using a separate dir for each process
|
||||
+ # (https://trac.sagemath.org/ticket/26968)
|
||||
+ os.environ['MAXIMA_USERDIR'] = "{}/sage-maxima-{}".format(
|
||||
+ tempfile.gettempdir(),
|
||||
+ os.getpid()
|
||||
+ )
|
||||
+
|
||||
if isinstance(globs, RecordingDict):
|
||||
globs.start()
|
||||
example.sequence_number = len(self.history)
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
diff --git a/src/sage/libs/linbox/conversion.pxd b/src/sage/libs/linbox/conversion.pxd
|
||||
index 7794c9edc3..1753277b1f 100644
|
||||
--- a/src/sage/libs/linbox/conversion.pxd
|
||||
+++ b/src/sage/libs/linbox/conversion.pxd
|
||||
@@ -177,9 +177,8 @@ cdef inline Vector_integer_dense new_sage_vector_integer_dense(P, DenseVector_in
|
||||
- v -- linbox vector
|
||||
"""
|
||||
cdef Vector_integer_dense res = P()
|
||||
- cdef cppvector[Integer] * vec = &v.refRep()
|
||||
cdef size_t i
|
||||
for i in range(<size_t> res._degree):
|
||||
- mpz_set(res._entries[i], vec[0][i].get_mpz_const())
|
||||
+ mpz_set(res._entries[i], v.getEntry(i).get_mpz_const())
|
||||
|
||||
return res
|
||||
diff --git a/src/sage/libs/linbox/linbox.pxd b/src/sage/libs/linbox/linbox.pxd
|
||||
index 9112d151f8..dcc482960c 100644
|
||||
--- a/src/sage/libs/linbox/linbox.pxd
|
||||
+++ b/src/sage/libs/linbox/linbox.pxd
|
||||
@@ -32,7 +32,7 @@ cdef extern from "linbox/matrix/dense-matrix.h":
|
||||
ctypedef Modular_double Field
|
||||
ctypedef double Element
|
||||
DenseMatrix_Modular_double(Field F, size_t m, size_t n)
|
||||
- DenseMatrix_Modular_double(Field F, Element*, size_t m, size_t n)
|
||||
+ DenseMatrix_Modular_double(Field F, size_t m, size_t n, Element*)
|
||||
void setEntry(size_t i, size_t j, Element& a)
|
||||
Element &getEntry(size_t i, size_t j)
|
||||
|
||||
@@ -42,7 +42,7 @@ cdef extern from "linbox/matrix/dense-matrix.h":
|
||||
ctypedef Modular_float Field
|
||||
ctypedef float Element
|
||||
DenseMatrix_Modular_float(Field F, size_t m, size_t n)
|
||||
- DenseMatrix_Modular_float(Field F, Element*, size_t m, size_t n)
|
||||
+ DenseMatrix_Modular_float(Field F, size_t m, size_t n, Element*)
|
||||
void setEntry(size_t i, size_t j, Element& a)
|
||||
Element &getEntry(size_t i, size_t j)
|
||||
|
||||
@@ -101,7 +101,6 @@ cdef extern from "linbox/vector/vector.h":
|
||||
DenseVector_integer (Field &F)
|
||||
DenseVector_integer (Field &F, long& m)
|
||||
DenseVector_integer (Field &F, cppvector[Integer]&)
|
||||
- cppvector[Element]& refRep()
|
||||
size_t size()
|
||||
void resize(size_t)
|
||||
void resize(size_t n, const Element&)
|
||||
diff --git a/src/sage/matrix/matrix_modn_dense_template.pxi b/src/sage/matrix/matrix_modn_dense_template.pxi
|
||||
index 010365d76f..3d60726ff9 100644
|
||||
--- a/src/sage/matrix/matrix_modn_dense_template.pxi
|
||||
+++ b/src/sage/matrix/matrix_modn_dense_template.pxi
|
||||
@@ -219,7 +219,7 @@ cdef inline linbox_echelonize_efd(celement modulus, celement* entries, Py_ssize_
|
||||
return 0,[]
|
||||
|
||||
cdef ModField *F = new ModField(<long>modulus)
|
||||
- cdef DenseMatrix *A = new DenseMatrix(F[0], <ModField.Element*>entries,<Py_ssize_t>nrows, <Py_ssize_t>ncols)
|
||||
+ cdef DenseMatrix *A = new DenseMatrix(F[0], <Py_ssize_t>nrows, <Py_ssize_t>ncols, <ModField.Element*>entries)
|
||||
cdef Py_ssize_t r = reducedRowEchelonize(A[0])
|
||||
cdef Py_ssize_t i,j
|
||||
for i in range(nrows):
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
diff --git a/src/sage_docbuild/__init__.py b/src/sage_docbuild/__init__.py
|
||||
index b12d56a3c9..df9d949ed1 100644
|
||||
--- a/src/sage_docbuild/__init__.py
|
||||
+++ b/src/sage_docbuild/__init__.py
|
||||
@@ -88,30 +88,6 @@ def builder_helper(type):
|
||||
"""
|
||||
Return a function which builds the documentation for
|
||||
output type ``type``.
|
||||
-
|
||||
- TESTS:
|
||||
-
|
||||
- Check that :trac:`25161` has been resolved::
|
||||
-
|
||||
- sage: from sage_docbuild import DocBuilder, setup_parser
|
||||
- sage: DocBuilder._options = setup_parser().parse_args([]) # builder_helper needs _options to be set
|
||||
-
|
||||
- sage: import sage_docbuild.sphinxbuild
|
||||
- sage: def raiseBaseException():
|
||||
- ....: raise BaseException("abort pool operation")
|
||||
- sage: original_runsphinx, sage_docbuild.sphinxbuild.runsphinx = sage_docbuild.sphinxbuild.runsphinx, raiseBaseException
|
||||
-
|
||||
- sage: from sage.misc.temporary_file import tmp_dir
|
||||
- sage: os.environ['SAGE_DOC'] = tmp_dir()
|
||||
- sage: sage.env.var('SAGE_DOC') # random
|
||||
- sage: from sage_docbuild import builder_helper, build_ref_doc
|
||||
- sage: from sage_docbuild import _build_many as build_many
|
||||
- sage: helper = builder_helper("html")
|
||||
- sage: try: # optional - sagemath_doc_html
|
||||
- ....: build_many(build_ref_doc, [("docname", "en", "html", {})])
|
||||
- ....: except Exception as E:
|
||||
- ....: "Non-exception during docbuild: abort pool operation" in str(E)
|
||||
- True
|
||||
"""
|
||||
def f(self, *args, **kwds):
|
||||
output_dir = self._output_dir(type)
|
||||
@@ -139,10 +115,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 ABORT_ON_ERROR:
|
||||
raise
|
||||
diff --git a/src/sage_docbuild/sphinxbuild.py b/src/sage_docbuild/sphinxbuild.py
|
||||
index a39c99ffe9..73be823684 100644
|
||||
--- a/src/sage_docbuild/sphinxbuild.py
|
||||
+++ b/src/sage_docbuild/sphinxbuild.py
|
||||
@@ -330,3 +330,8 @@ def runsphinx():
|
||||
sys.stderr = saved_stderr
|
||||
sys.stdout.flush()
|
||||
sys.stderr.flush()
|
||||
+
|
||||
+if __name__ == '__main__':
|
||||
+ import sys
|
||||
+ sys.argv[0] = "sphinx-build"
|
||||
+ runsphinx()
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
diff --git a/src/sage/lfunctions/sympow.py b/src/sage/lfunctions/sympow.py
|
||||
index 92cb01fd73..b123e6accc 100644
|
||||
--- a/src/sage/lfunctions/sympow.py
|
||||
+++ b/src/sage/lfunctions/sympow.py
|
||||
@@ -50,6 +50,7 @@ from __future__ import print_function, absolute_import
|
||||
|
||||
import os
|
||||
|
||||
+from sage.env import DOT_SAGE
|
||||
from sage.structure.sage_object import SageObject
|
||||
from sage.misc.all import pager
|
||||
from sage.misc.verbose import verbose
|
||||
@@ -78,7 +79,7 @@ class Sympow(SageObject):
|
||||
"""
|
||||
Used to call sympow with given args
|
||||
"""
|
||||
- cmd = 'sympow %s' % args
|
||||
+ cmd = 'env SYMPOW_CACHEDIR="%s/sympow///" sympow %s' % (DOT_SAGE, args)
|
||||
with os.popen(cmd) as f:
|
||||
v = f.read().strip()
|
||||
verbose(v, level=2)
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
diff --git a/src/sage/interfaces/tachyon.py b/src/sage/interfaces/tachyon.py
|
||||
index 3f1dcdb538..b6fa8d1fbd 100644
|
||||
--- a/src/sage/interfaces/tachyon.py
|
||||
+++ b/src/sage/interfaces/tachyon.py
|
||||
@@ -261,13 +261,13 @@ written in the sequence they are listed in the examples in this section.
|
||||
The {\bf PROJECTION} keyword must be followed by one of the supported
|
||||
camera projection mode identifiers {\bf PERSPECTIVE}, {\bf PERSPECTIVE_DOF},
|
||||
{\bf ORTHOGRAPHIC}, or {\bf FISHEYE}. The {\bf FISHEYE} projection mode
|
||||
-requires two extra parameters {\bf FOCALLENGTH} and {\bf APERTURE}
|
||||
+requires two extra parameters {\bf FOCALDIST} and {\bf APERTURE}
|
||||
which precede the regular camera options.
|
||||
|
||||
\begin{verbatim}
|
||||
Camera
|
||||
projection perspective_dof
|
||||
- focallength 0.75
|
||||
+ focaldist 0.75
|
||||
aperture 0.02
|
||||
Zoom 0.666667
|
||||
Aspectratio 1.000000
|
||||
diff --git a/src/sage/plot/plot3d/tachyon.py b/src/sage/plot/plot3d/tachyon.py
|
||||
index 08caf38d67..3e827411ce 100644
|
||||
--- a/src/sage/plot/plot3d/tachyon.py
|
||||
+++ b/src/sage/plot/plot3d/tachyon.py
|
||||
@@ -92,7 +92,7 @@ angle, right angle)::
|
||||
Finally there is the ``projection='perspective_dof'`` option. ::
|
||||
|
||||
sage: T = Tachyon(xres=800, antialiasing=4, raydepth=10,
|
||||
- ....: projection='perspective_dof', focallength='1.0', aperture='.0025')
|
||||
+ ....: projection='perspective_dof', focaldist='1.0', aperture='.0025')
|
||||
sage: T.light((0,5,7), 1.0, (1,1,1))
|
||||
sage: T.texture('t1', opacity=1, specular=.3)
|
||||
sage: T.texture('t2', opacity=1, specular=.3, color=(0,0,1))
|
||||
@@ -186,7 +186,7 @@ class Tachyon(WithEqualityById, SageObject):
|
||||
or ``'fisheye'``.
|
||||
- ``frustum`` - (default ''), otherwise list of four numbers. Only
|
||||
used with projection='fisheye'.
|
||||
- - ``focallength`` - (default ''), otherwise a number. Only used
|
||||
+ - ``focaldist`` - (default ''), otherwise a number. Only used
|
||||
with projection='perspective_dof'.
|
||||
- ``aperture`` - (default ''), otherwise a number. Only used
|
||||
with projection='perspective_dof'.
|
||||
@@ -331,7 +331,7 @@ class Tachyon(WithEqualityById, SageObject):
|
||||
Use of the ``projection='perspective_dof'`` option. This may not be
|
||||
implemented correctly. ::
|
||||
|
||||
- sage: T = Tachyon(xres=800,antialiasing=4, raydepth=10, projection='perspective_dof', focallength='1.0', aperture='.0025')
|
||||
+ sage: T = Tachyon(xres=800,antialiasing=4, raydepth=10, projection='perspective_dof', focaldist='1.0', aperture='.0025')
|
||||
sage: T.light((0,5,7), 1.0, (1,1,1))
|
||||
sage: T.texture('t1', opacity=1, specular=.3)
|
||||
sage: T.texture('t2', opacity=1, specular=.3, color=(0,0,1))
|
||||
@@ -365,7 +365,7 @@ class Tachyon(WithEqualityById, SageObject):
|
||||
look_at=[0, 0, 0],
|
||||
viewdir=None,
|
||||
projection='PERSPECTIVE',
|
||||
- focallength='',
|
||||
+ focaldist='',
|
||||
aperture='',
|
||||
frustum=''):
|
||||
r"""
|
||||
@@ -391,7 +391,7 @@ class Tachyon(WithEqualityById, SageObject):
|
||||
self._camera_position = (-3, 0, 0) # default value
|
||||
self._updir = updir
|
||||
self._projection = projection
|
||||
- self._focallength = focallength
|
||||
+ self._focaldist = focaldist
|
||||
self._aperture = aperture
|
||||
self._frustum = frustum
|
||||
self._objects = []
|
||||
@@ -624,9 +624,9 @@ class Tachyon(WithEqualityById, SageObject):
|
||||
camera_out = r"""
|
||||
camera
|
||||
projection %s""" % (tostr(self._projection))
|
||||
- if self._focallength != '':
|
||||
+ if self._focaldist != '':
|
||||
camera_out = camera_out + r"""
|
||||
- focallength %s""" % (float(self._focallength))
|
||||
+ focaldist %s""" % (float(self._focaldist))
|
||||
if self._aperture != '':
|
||||
camera_out = camera_out + r"""
|
||||
aperture %s""" % (float(self._aperture))
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
{ lib
|
||||
, buildPythonPackage
|
||||
, sage-src
|
||||
, sphinx
|
||||
, jupyter-sphinx
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
version = src.version;
|
||||
pname = "sage-docbuild";
|
||||
src = sage-src;
|
||||
|
||||
propagatedBuildInputs = [
|
||||
sphinx
|
||||
jupyter-sphinx
|
||||
];
|
||||
|
||||
preBuild = ''
|
||||
cd pkgs/sage-docbuild
|
||||
'';
|
||||
|
||||
doCheck = false; # we will run tests in sagedoc.nix
|
||||
|
||||
meta = with lib; {
|
||||
description = "Build system of the Sage documentation";
|
||||
homepage = "https://www.sagemath.org";
|
||||
license = licenses.gpl2Plus;
|
||||
maintainers = teams.sage.members;
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
{ lib
|
||||
, buildPythonPackage
|
||||
, sage-src
|
||||
, pkgconfig # the python module, not the pkg-config alias
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
version = src.version;
|
||||
pname = "sage-setup";
|
||||
src = sage-src;
|
||||
|
||||
buildInputs = [
|
||||
pkgconfig
|
||||
];
|
||||
|
||||
preBuild = ''
|
||||
cd pkgs/sage-setup
|
||||
'';
|
||||
|
||||
doCheck = false; # sagelib depends on sage-setup, but sage-setup's tests depend on sagelib
|
||||
|
||||
meta = with lib; {
|
||||
description = "Build system of the Sage library";
|
||||
homepage = "https://www.sagemath.org";
|
||||
license = licenses.gpl2Plus;
|
||||
maintainers = teams.sage.members;
|
||||
};
|
||||
}
|
||||
194
pkgs/applications/science/math/sage/sage-env.nix
Normal file
194
pkgs/applications/science/math/sage/sage-env.nix
Normal file
|
|
@ -0,0 +1,194 @@
|
|||
{ stdenv
|
||||
, lib
|
||||
, writeTextFile
|
||||
, sagelib
|
||||
, sage-docbuild
|
||||
, env-locations
|
||||
, gfortran
|
||||
, bash
|
||||
, coreutils
|
||||
, gnused
|
||||
, gnugrep
|
||||
, binutils
|
||||
, pythonEnv
|
||||
, python3
|
||||
, pkg-config
|
||||
, pari
|
||||
, gap
|
||||
, maxima
|
||||
, singular
|
||||
, fflas-ffpack
|
||||
, givaro
|
||||
, gd
|
||||
, libpng
|
||||
, linbox
|
||||
, m4ri
|
||||
, giac
|
||||
, palp
|
||||
, rWrapper
|
||||
, gfan
|
||||
, cddlib
|
||||
, jmol
|
||||
, tachyon
|
||||
, glpk
|
||||
, eclib
|
||||
, sympow
|
||||
, nauty
|
||||
, sqlite
|
||||
, ppl
|
||||
, ecm
|
||||
, lcalc
|
||||
, rubiks
|
||||
, flintqs
|
||||
, blas
|
||||
, lapack
|
||||
, flint
|
||||
, gmp
|
||||
, mpfr
|
||||
, zlib
|
||||
, gsl
|
||||
, ntl
|
||||
, jdk
|
||||
, less
|
||||
}:
|
||||
|
||||
assert (!blas.isILP64) && (!lapack.isILP64);
|
||||
|
||||
# This generates a `sage-env` shell file that will be sourced by sage on startup.
|
||||
# It sets up various environment variables, telling sage where to find its
|
||||
# dependencies.
|
||||
|
||||
let
|
||||
runtimepath = (lib.makeBinPath ([
|
||||
"@sage-local@"
|
||||
"@sage-local@/build"
|
||||
pythonEnv
|
||||
gfortran # for inline fortran
|
||||
stdenv.cc # for cython
|
||||
bash
|
||||
coreutils
|
||||
gnused
|
||||
gnugrep
|
||||
binutils.bintools
|
||||
pkg-config
|
||||
pari
|
||||
gap
|
||||
maxima.lisp-compiler
|
||||
maxima
|
||||
singular
|
||||
giac
|
||||
palp
|
||||
# needs to be rWrapper since the default `R` doesn't include R's default libraries
|
||||
rWrapper
|
||||
gfan
|
||||
cddlib
|
||||
jmol
|
||||
tachyon
|
||||
glpk
|
||||
eclib
|
||||
sympow
|
||||
nauty
|
||||
sqlite
|
||||
ppl
|
||||
ecm
|
||||
lcalc
|
||||
rubiks
|
||||
flintqs
|
||||
jdk # only needed for `jmol` which may be replaced in the future
|
||||
less # needed to prevent transient test errors until https://github.com/ipython/ipython/pull/11864 is resolved
|
||||
]
|
||||
));
|
||||
in
|
||||
writeTextFile rec {
|
||||
name = "sage-env";
|
||||
destination = "/${name}";
|
||||
text = ''
|
||||
export PKG_CONFIG_PATH='${lib.makeSearchPathOutput "dev" "lib/pkgconfig" [
|
||||
# This should only be needed during build. However, since the doctests
|
||||
# also test the cython build (for example in src/sage/misc/cython.py),
|
||||
# it is also needed for the testsuite to pass. We could fix the
|
||||
# testsuite instead, but since all the packages are also runtime
|
||||
# dependencies it doesn't really hurt to include them here.
|
||||
singular
|
||||
blas lapack
|
||||
fflas-ffpack givaro
|
||||
gd
|
||||
libpng zlib
|
||||
gsl
|
||||
linbox
|
||||
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 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 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
|
||||
|
||||
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}"
|
||||
|
||||
# set locations of dependencies
|
||||
. ${env-locations}/sage-env-locations
|
||||
|
||||
# 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
|
||||
jmol
|
||||
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]}''${DYLD_LIBRARY_PATH:+:}$DYLD_LIBRARY_PATH"
|
||||
'';
|
||||
} // { # equivalent of `passthru`, which `writeTextFile` doesn't support
|
||||
lib = sagelib;
|
||||
docbuild = sage-docbuild;
|
||||
}
|
||||
150
pkgs/applications/science/math/sage/sage-src.nix
Normal file
150
pkgs/applications/science/math/sage/sage-src.nix
Normal file
|
|
@ -0,0 +1,150 @@
|
|||
{ stdenv
|
||||
, fetchFromGitHub
|
||||
, fetchpatch
|
||||
, runtimeShell
|
||||
}:
|
||||
|
||||
# This file is responsible for fetching the sage source and adding necessary patches.
|
||||
# It does not actually build anything, it just copies the patched sources to $out.
|
||||
# This is done because multiple derivations rely on these sources and they should
|
||||
# all get the same sources with the same patches applied.
|
||||
|
||||
let
|
||||
# Fetch a diff between `base` and `rev` on sage's git server.
|
||||
# Used to fetch trac tickets by setting the `base` to the last release and the
|
||||
# `rev` to the last commit of the ticket.
|
||||
#
|
||||
# We don't use sage's own build system (which builds all its
|
||||
# dependencies), so we exclude changes to "build/" from patches by
|
||||
# default to avoid conflicts.
|
||||
fetchSageDiff = { base, name, rev, sha256, squashed ? false, excludes ? [ "build/*" ]
|
||||
, ...}@args: (
|
||||
fetchpatch ({
|
||||
inherit name sha256 excludes;
|
||||
|
||||
# There are three places to get changes from:
|
||||
#
|
||||
# 1) From Sage's Trac. Contains all release tags (like "9.4") and all developer
|
||||
# branches (wip patches from tickets), but exports each commit as a separate
|
||||
# patch, so merge commits can lead to conflicts. Used if squashed == false.
|
||||
#
|
||||
# The above is the preferred option. To use it, find a Trac ticket and pass the
|
||||
# "Commit" field from the ticket as "rev", choosing "base" as an appropriate
|
||||
# release tag, i.e. a tag that doesn't cause the patch to include a lot of
|
||||
# unrelated changes. If there is no such tag (due to nonlinear history, for
|
||||
# example), there are two other options, listed below.
|
||||
#
|
||||
# 2) From GitHub's sagemath/sage repo. This lets us use a GH feature that allows
|
||||
# us to choose between a .patch file, with one patch per commit, or a .diff file,
|
||||
# which squashes all commits into a single diff. This is used if squashed ==
|
||||
# true. This repo has all release tags. However, it has no developer branches, so
|
||||
# this option can't be used if a change wasn't yet shipped in a (possibly beta)
|
||||
# release.
|
||||
#
|
||||
# 3) From GitHub's sagemath/sagetrac-mirror repo. Mirrors all developer branches,
|
||||
# but has no release tags. The only use case not covered by 1 or 2 is when we need
|
||||
# to apply a patch from an open ticket that contains merge commits.
|
||||
#
|
||||
# Item 3 could cover all use cases if the sagemath/sagetrack-mirror repo had
|
||||
# release tags, but it requires a sha instead of a release number in "base", which
|
||||
# is inconvenient.
|
||||
urls = if squashed
|
||||
then [
|
||||
"https://github.com/sagemath/sage/compare/${base}...${rev}.diff"
|
||||
"https://github.com/sagemath/sagetrac-mirror/compare/${base}...${rev}.diff"
|
||||
]
|
||||
else [ "https://git.sagemath.org/sage.git/patch?id2=${base}&id=${rev}" ];
|
||||
} // builtins.removeAttrs args [ "rev" "base" "sha256" "squashed" "excludes" ])
|
||||
);
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
version = "9.6";
|
||||
pname = "sage-src";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "sagemath";
|
||||
repo = "sage";
|
||||
rev = version;
|
||||
sha256 = "sha256-QY8Yga3hD1WhSCtA2/PVry8hHlMmC31J8jCBFtWgIU0=";
|
||||
};
|
||||
|
||||
# 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 = [
|
||||
# Fixes a potential race condition which can lead to transient doctest failures.
|
||||
./patches/fix-ecl-race.patch
|
||||
|
||||
# Not necessary since library location is set explicitly
|
||||
# https://trac.sagemath.org/ticket/27660#ticket
|
||||
./patches/do-not-test-find-library.patch
|
||||
|
||||
# Parallelize docubuild using subprocesses, fixing an isolation issue. See
|
||||
# https://groups.google.com/forum/#!topic/sage-packaging/YGOm8tkADrE
|
||||
./patches/sphinx-docbuild-subprocesses.patch
|
||||
];
|
||||
|
||||
# Since sage unfortunately does not release bugfix releases, packagers must
|
||||
# fix those bugs themselves. This is for critical bugfixes, where "critical"
|
||||
# == "causes (transient) doctest failures / somebody complained".
|
||||
bugfixPatches = [
|
||||
# To help debug the transient error in
|
||||
# https://trac.sagemath.org/ticket/23087 when it next occurs.
|
||||
./patches/configurationpy-error-verbose.patch
|
||||
];
|
||||
|
||||
# Patches needed because of package updates. We could just pin the versions of
|
||||
# dependencies, but that would lead to rebuilds, confusion and the burdons of
|
||||
# maintaining multiple versions of dependencies. Instead we try to make sage
|
||||
# compatible with never dependency versions when possible. All these changes
|
||||
# should come from or be proposed to upstream. This list will probably never
|
||||
# be empty since dependencies update all the time.
|
||||
packageUpgradePatches = [
|
||||
# After updating smypow to (https://trac.sagemath.org/ticket/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
|
||||
|
||||
# Upstream will wait until Sage 9.7 to upgrade to linbox 1.7 because it
|
||||
# does not support gcc 6. We can upgrade earlier.
|
||||
# https://trac.sagemath.org/ticket/32959
|
||||
./patches/linbox-1.7-upgrade.patch
|
||||
|
||||
# adapted from https://trac.sagemath.org/ticket/23712#comment:22
|
||||
./patches/tachyon-renamed-focallength.patch
|
||||
|
||||
# docutils 0.18.1 now triggers Sphinx warnings. tolerate them for
|
||||
# now, because patching Sphinx is not feasible. remove when Sphinx
|
||||
# 5.0 hits nixpkgs.
|
||||
# https://github.com/sphinx-doc/sphinx/pull/10372
|
||||
./patches/docutils-0.18.1-deprecation.patch
|
||||
];
|
||||
|
||||
patches = nixPatches ++ bugfixPatches ++ packageUpgradePatches;
|
||||
|
||||
postPatch = ''
|
||||
# Make sure sage can at least be imported without setting any environment
|
||||
# variables. It won't be close to feature complete though.
|
||||
sed -i \
|
||||
"s|var(\"SAGE_ROOT\".*|var(\"SAGE_ROOT\", \"$out\")|" \
|
||||
src/sage/env.py
|
||||
|
||||
# src/doc/en/reference/spkg/conf.py expects index.rst in its directory,
|
||||
# a list of external packages in the sage distribution (build/pkgs)
|
||||
# generated by the bootstrap script (which we don't run). this is not
|
||||
# relevant for other distributions, so remove it.
|
||||
rm src/doc/en/reference/spkg/conf.py
|
||||
sed -i "/spkg/d" src/doc/en/reference/index.rst
|
||||
|
||||
# the bootstrap script also generates installation instructions for
|
||||
# arch, debian, fedora, cygwin and homebrew using data from build/pkgs.
|
||||
# we don't run the bootstrap script, so disable including the generated
|
||||
# files. docbuilding fails otherwise.
|
||||
sed -i "/literalinclude/d" src/doc/en/installation/source.rst
|
||||
'';
|
||||
|
||||
buildPhase = "# do nothing";
|
||||
|
||||
installPhase = ''
|
||||
cp -r . "$out"
|
||||
'';
|
||||
}
|
||||
61
pkgs/applications/science/math/sage/sage-tests.nix
Normal file
61
pkgs/applications/science/math/sage/sage-tests.nix
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
{ stdenv
|
||||
, lib
|
||||
, sage-with-env
|
||||
, makeWrapper
|
||||
, files ? null # "null" means run all tests
|
||||
, longTests ? true # run tests marked as "long time" (roughly doubles runtime)
|
||||
# Run as many tests as possible in approximately n seconds. This will give each
|
||||
# file to test a "time budget" and stop tests if it is exceeded. 300 is the
|
||||
# upstream default value.
|
||||
# https://trac.sagemath.org/ticket/25270 for details.
|
||||
, timeLimit ? null
|
||||
}:
|
||||
|
||||
# for a quick test of some source files:
|
||||
# nix-build -E 'with (import ./. {}); sage.tests.override { files = [ "src/sage/misc/cython.py" ];}'
|
||||
|
||||
let
|
||||
src = sage-with-env.env.lib.src;
|
||||
runAllTests = files == null;
|
||||
testArgs = if runAllTests then "--all" else testFileList;
|
||||
patienceSpecifier = if longTests then "--long" else "";
|
||||
timeSpecifier = if timeLimit == null then "" else "--short ${toString timeLimit}";
|
||||
relpathToArg = relpath: lib.escapeShellArg "${src}/${relpath}"; # paths need to be absolute
|
||||
testFileList = lib.concatStringsSep " " (map relpathToArg files);
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
version = src.version;
|
||||
pname = "sage-tests";
|
||||
inherit src;
|
||||
|
||||
buildInputs = [
|
||||
makeWrapper
|
||||
sage-with-env
|
||||
];
|
||||
|
||||
dontUnpack = true;
|
||||
configurePhase = "#do nothing";
|
||||
buildPhase = "#do nothing";
|
||||
|
||||
installPhase = ''
|
||||
# This output is not actually needed for anything, the package just
|
||||
# exists to decouple the sage build from its t ests.
|
||||
|
||||
mkdir -p "$out/bin"
|
||||
# Like a symlink, but make sure that $0 points to the original.
|
||||
makeWrapper "${sage-with-env}/bin/sage" "$out/bin/sage"
|
||||
'';
|
||||
|
||||
doInstallCheck = true;
|
||||
installCheckPhase = ''
|
||||
export HOME="$TMPDIR/sage-home"
|
||||
mkdir -p "$HOME"
|
||||
|
||||
# avoid running out of memory with many threads in subprocesses, see
|
||||
# https://github.com/NixOS/nixpkgs/pull/65802
|
||||
export GLIBC_TUNABLES=glibc.malloc.arena_max=4
|
||||
|
||||
echo "Running sage tests with arguments ${timeSpecifier} ${patienceSpecifier} ${testArgs}"
|
||||
"sage" -t --timeout=0 --nthreads "$NIX_BUILD_CORES" --optional=sage ${timeSpecifier} ${patienceSpecifier} ${testArgs}
|
||||
'';
|
||||
}
|
||||
139
pkgs/applications/science/math/sage/sage-with-env.nix
Normal file
139
pkgs/applications/science/math/sage/sage-with-env.nix
Normal file
|
|
@ -0,0 +1,139 @@
|
|||
{ stdenv
|
||||
, lib
|
||||
, makeWrapper
|
||||
, sage-env
|
||||
, blas
|
||||
, lapack
|
||||
, pkg-config
|
||||
, three
|
||||
, singular
|
||||
, gap
|
||||
, giac
|
||||
, maxima
|
||||
, pari
|
||||
, gmp
|
||||
, gfan
|
||||
, python3
|
||||
, flintqs
|
||||
, eclib
|
||||
, ntl
|
||||
, ecm
|
||||
, pythonEnv
|
||||
}:
|
||||
|
||||
# lots of segfaults with (64 bit) blas
|
||||
assert (!blas.isILP64) && (!lapack.isILP64);
|
||||
|
||||
# Wrapper that combined `sagelib` with `sage-env` to produce an actually
|
||||
# executable sage. No tests are run yet and no documentation is built.
|
||||
|
||||
let
|
||||
buildInputs = [
|
||||
pythonEnv # for patchShebangs
|
||||
makeWrapper
|
||||
pkg-config
|
||||
blas lapack
|
||||
singular
|
||||
three
|
||||
giac
|
||||
gap
|
||||
pari
|
||||
gmp
|
||||
gfan
|
||||
maxima
|
||||
eclib
|
||||
flintqs
|
||||
ntl
|
||||
ecm
|
||||
];
|
||||
|
||||
# remove python prefix, replace "-" in the name by "_", apply patch_names
|
||||
# python3.8-some-pkg-1.0 -> some_pkg-1.0
|
||||
pkg_to_spkg_name = pkg: patch_names: let
|
||||
parts = lib.splitString "-" pkg.name;
|
||||
# remove python3.8-
|
||||
stripped_parts = if (builtins.head parts) == python3.libPrefix then builtins.tail parts else parts;
|
||||
version = lib.last stripped_parts;
|
||||
orig_pkgname = lib.init stripped_parts;
|
||||
pkgname = patch_names (lib.concatStringsSep "_" orig_pkgname);
|
||||
in pkgname + "-" + version;
|
||||
|
||||
|
||||
# return the names of all dependencies in the transitive closure
|
||||
transitiveClosure = dep:
|
||||
if dep == null then
|
||||
# propagatedBuildInputs might contain null
|
||||
# (although that might be considered a programming error in the derivation)
|
||||
[]
|
||||
else
|
||||
[ dep ] ++ (
|
||||
if builtins.hasAttr "propagatedBuildInputs" dep then
|
||||
lib.unique (builtins.concatLists (map transitiveClosure dep.propagatedBuildInputs))
|
||||
else
|
||||
[]
|
||||
);
|
||||
|
||||
allInputs = lib.remove null (buildInputs ++ pythonEnv.extraLibs);
|
||||
transitiveDeps = lib.unique (builtins.concatLists (map transitiveClosure allInputs ));
|
||||
# fix differences between spkg and sage names
|
||||
# (could patch sage instead, but this is more lightweight and also works for packages depending on sage)
|
||||
patch_names = builtins.replaceStrings [
|
||||
"zope.interface"
|
||||
"node_three"
|
||||
] [
|
||||
"zope_interface"
|
||||
"threejs"
|
||||
];
|
||||
# spkg names (this_is_a_package-version) of all transitive deps
|
||||
input_names = map (dep: pkg_to_spkg_name dep patch_names) transitiveDeps;
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
version = src.version;
|
||||
pname = "sage-with-env";
|
||||
src = sage-env.lib.src;
|
||||
|
||||
inherit buildInputs;
|
||||
|
||||
configurePhase = "#do nothing";
|
||||
|
||||
buildPhase = ''
|
||||
mkdir installed
|
||||
for pkg in ${lib.concatStringsSep " " input_names}; do
|
||||
touch "installed/$pkg"
|
||||
done
|
||||
|
||||
# threejs version is in format 0.<version>.minor, but sage currently still
|
||||
# relies on installed_packages for the online version of threejs to work
|
||||
# and expects the format r<version>. This is a hotfix for now.
|
||||
# upstream: https://trac.sagemath.org/ticket/26434
|
||||
rm "installed/threejs"*
|
||||
touch "installed/threejs-r${lib.versions.minor three.version}"
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p "$out/var/lib/sage"
|
||||
cp -r installed "$out/var/lib/sage"
|
||||
|
||||
mkdir -p "$out/etc"
|
||||
# sage tests will try to create this file if it doesn't exist
|
||||
touch "$out/etc/sage-started.txt"
|
||||
|
||||
mkdir -p "$out/build"
|
||||
|
||||
# the scripts in src/bin will find the actual sage source files using environment variables set in `sage-env`
|
||||
cp -r src/bin "$out/bin"
|
||||
cp -r build/bin "$out/build/bin"
|
||||
|
||||
# sage assumes the existence of sage-src-env-config.in means it's being executed in-tree. in this case, it
|
||||
# adds SAGE_SRC/bin to PATH, breaking our wrappers
|
||||
rm "$out/bin"/*.in "$out/build/bin"/*.in
|
||||
|
||||
cp -f '${sage-env}/sage-env' "$out/bin/sage-env"
|
||||
substituteInPlace "$out/bin/sage-env" \
|
||||
--subst-var-by sage-local "$out"
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
env = sage-env;
|
||||
};
|
||||
}
|
||||
62
pkgs/applications/science/math/sage/sage.nix
Normal file
62
pkgs/applications/science/math/sage/sage.nix
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
{ lib, stdenv
|
||||
, makeWrapper
|
||||
, sage-tests
|
||||
, sage-with-env
|
||||
, jupyter-kernel-definition
|
||||
, jupyter-kernel-specs
|
||||
, sagedoc
|
||||
, withDoc
|
||||
, requireSageTests
|
||||
}:
|
||||
|
||||
# A wrapper that makes sure sage finds its docs (if they were build) and the
|
||||
# jupyter kernel spec.
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
version = src.version;
|
||||
pname = "sage";
|
||||
src = sage-with-env.env.lib.src;
|
||||
|
||||
buildInputs = [
|
||||
makeWrapper
|
||||
] ++ lib.optionals requireSageTests [
|
||||
# This is a hack to make sure sage-tests is evaluated. It doesn't acutally
|
||||
# produce anything of value, it just decouples the tests from the build.
|
||||
sage-tests
|
||||
];
|
||||
|
||||
dontUnpack = true;
|
||||
configurePhase = "#do nothing";
|
||||
buildPhase = "#do nothing";
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p "$out/bin"
|
||||
makeWrapper "${sage-with-env}/bin/sage" "$out/bin/sage" \
|
||||
--set SAGE_DOC_SRC_OVERRIDE "${src}/src/doc" ${
|
||||
lib.optionalString withDoc "--set SAGE_DOC_OVERRIDE ${sagedoc}/share/doc/sage"
|
||||
} \
|
||||
--prefix JUPYTER_PATH : "${jupyter-kernel-specs}"
|
||||
'';
|
||||
|
||||
doInstallCheck = withDoc;
|
||||
installCheckPhase = ''
|
||||
export HOME="$TMPDIR/sage-home"
|
||||
mkdir -p "$HOME"
|
||||
"$out/bin/sage" -c 'browse_sage_doc._open("reference", testing=True)'
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
tests = sage-tests;
|
||||
quicktest = sage-tests.override { longTests = false; timeLimit = 600; }; # as many tests as possible in ~10m
|
||||
doc = sagedoc;
|
||||
lib = sage-with-env.env.lib;
|
||||
kernelspec = jupyter-kernel-definition;
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
description = "Open Source Mathematics Software, free alternative to Magma, Maple, Mathematica, and Matlab";
|
||||
homepage = "https://www.sagemath.org";
|
||||
license = licenses.gpl2Plus;
|
||||
maintainers = teams.sage.members;
|
||||
};
|
||||
}
|
||||
71
pkgs/applications/science/math/sage/sagedoc.nix
Normal file
71
pkgs/applications/science/math/sage/sagedoc.nix
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
{ stdenv
|
||||
, sage-with-env
|
||||
, python3
|
||||
, jupyter-kernel-specs
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
version = src.version;
|
||||
pname = "sagedoc";
|
||||
src = sage-with-env.env.lib.src;
|
||||
|
||||
strictDeps = true;
|
||||
|
||||
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"
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
export SAGE_NUM_THREADS="$NIX_BUILD_CORES"
|
||||
export HOME="$TMPDIR/sage_home"
|
||||
mkdir -p "$HOME"
|
||||
|
||||
# needed to link them in the sage docs using intersphinx
|
||||
export PPLPY_DOCS=${python3.pkgs.pplpy.doc}/share/doc/pplpy
|
||||
|
||||
# adapted from src/doc/bootstrap (which we don't run)
|
||||
OUTPUT_DIR="$SAGE_DOC_SRC_OVERRIDE/en/reference/repl"
|
||||
mkdir -p "$OUTPUT_DIR"
|
||||
OUTPUT="$OUTPUT_DIR/options.txt"
|
||||
${sage-with-env}/bin/sage -advanced > "$OUTPUT"
|
||||
|
||||
# jupyter-sphinx calls the sagemath jupyter kernel during docbuild
|
||||
export JUPYTER_PATH=${jupyter-kernel-specs}
|
||||
|
||||
# sage --docbuild unsets JUPYTER_PATH, so we call sage_docbuild directly
|
||||
# https://trac.sagemath.org/ticket/33650#comment:32
|
||||
${sage-with-env}/bin/sage --python3 -m sage_docbuild \
|
||||
--mathjax \
|
||||
--no-pdf-links \
|
||||
all html < /dev/null
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
cd "$SAGE_DOC_OVERRIDE"
|
||||
|
||||
mkdir -p "$out/share/doc/sage"
|
||||
cp -r html "$out"/share/doc/sage
|
||||
|
||||
# Replace duplicated files by symlinks (Gentoo)
|
||||
cd "$out"/share/doc/sage
|
||||
mv html/en/_static{,.tmp}
|
||||
for _dir in `find -name _static` ; do
|
||||
rm -r $_dir
|
||||
ln -rs html/en/_static $_dir
|
||||
done
|
||||
mv html/en/_static{.tmp,}
|
||||
'';
|
||||
|
||||
doCheck = true;
|
||||
checkPhase = ''
|
||||
# sagemath_doc_html tests assume sage tests are being run, so we
|
||||
# compromise: we run standard tests, but only on files containing
|
||||
# relevant tests. as of Sage 9.6, there are only 4 such files.
|
||||
grep -PRl "#.*optional.*sagemath_doc_html" ${src}/src/sage{,_docbuild} | \
|
||||
xargs ${sage-with-env}/bin/sage -t --optional=sage,sagemath_doc_html
|
||||
'';
|
||||
}
|
||||
213
pkgs/applications/science/math/sage/sagelib.nix
Normal file
213
pkgs/applications/science/math/sage/sagelib.nix
Normal file
|
|
@ -0,0 +1,213 @@
|
|||
{ sage-src
|
||||
, env-locations
|
||||
, perl
|
||||
, buildPythonPackage
|
||||
, m4
|
||||
, arb
|
||||
, blas
|
||||
, lapack
|
||||
, brial
|
||||
, cliquer
|
||||
, cypari2
|
||||
, cysignals
|
||||
, cython
|
||||
, lisp-compiler
|
||||
, eclib
|
||||
, ecm
|
||||
, flint
|
||||
, gd
|
||||
, giac
|
||||
, givaro
|
||||
, glpk
|
||||
, gsl
|
||||
, iml
|
||||
, jinja2
|
||||
, lcalc
|
||||
, lrcalc
|
||||
, gap
|
||||
, linbox
|
||||
, m4ri
|
||||
, m4rie
|
||||
, memory-allocator
|
||||
, libmpc
|
||||
, mpfi
|
||||
, ntl
|
||||
, numpy
|
||||
, pari
|
||||
, pkgconfig # the python module, not the pkg-config alias
|
||||
, pkg-config
|
||||
, planarity
|
||||
, ppl
|
||||
, primecountpy
|
||||
, python
|
||||
, ratpoints
|
||||
, readline
|
||||
, rankwidth
|
||||
, symmetrica
|
||||
, zn_poly
|
||||
, fflas-ffpack
|
||||
, boost
|
||||
, singular
|
||||
, pip
|
||||
, jupyter_core
|
||||
, sage-setup
|
||||
, libhomfly
|
||||
, libbraiding
|
||||
, gmpy2
|
||||
, pplpy
|
||||
, sqlite
|
||||
, jupyter-client
|
||||
, ipywidgets
|
||||
, mpmath
|
||||
, rpy2
|
||||
, fpylll
|
||||
, scipy
|
||||
, sympy
|
||||
, matplotlib
|
||||
, pillow
|
||||
, ipykernel
|
||||
, networkx
|
||||
, ptyprocess
|
||||
, lrcalc-python
|
||||
, sphinx # TODO: this is in setup.cfg, should we override it?
|
||||
}:
|
||||
|
||||
assert (!blas.isILP64) && (!lapack.isILP64);
|
||||
|
||||
# This is the core sage python package. Everything else is just wrappers gluing
|
||||
# stuff together. It is not very useful on its own though, since it will not
|
||||
# find many of its dependencies without `sage-env`, will not be tested without
|
||||
# `sage-tests` and will not have html docs without `sagedoc`.
|
||||
|
||||
buildPythonPackage rec {
|
||||
version = src.version;
|
||||
pname = "sagelib";
|
||||
src = sage-src;
|
||||
|
||||
nativeBuildInputs = [
|
||||
iml
|
||||
perl
|
||||
jupyter_core
|
||||
pkg-config
|
||||
sage-setup
|
||||
pip # needed to query installed packages
|
||||
lisp-compiler
|
||||
m4
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
gd
|
||||
readline
|
||||
iml
|
||||
];
|
||||
|
||||
propagatedBuildInputs = [
|
||||
cypari2
|
||||
jinja2
|
||||
numpy
|
||||
pkgconfig
|
||||
boost
|
||||
arb
|
||||
brial
|
||||
cliquer
|
||||
lisp-compiler
|
||||
eclib
|
||||
ecm
|
||||
fflas-ffpack
|
||||
flint
|
||||
giac
|
||||
givaro
|
||||
glpk
|
||||
gsl
|
||||
lcalc
|
||||
gap
|
||||
libmpc
|
||||
linbox
|
||||
lrcalc
|
||||
m4ri
|
||||
m4rie
|
||||
memory-allocator
|
||||
mpfi
|
||||
ntl
|
||||
blas
|
||||
lapack
|
||||
pari
|
||||
planarity
|
||||
ppl
|
||||
primecountpy
|
||||
rankwidth
|
||||
ratpoints
|
||||
singular
|
||||
symmetrica
|
||||
zn_poly
|
||||
pip
|
||||
cython
|
||||
cysignals
|
||||
libhomfly
|
||||
libbraiding
|
||||
gmpy2
|
||||
pplpy
|
||||
sqlite
|
||||
mpmath
|
||||
rpy2
|
||||
scipy
|
||||
sympy
|
||||
matplotlib
|
||||
pillow
|
||||
ipykernel
|
||||
fpylll
|
||||
networkx
|
||||
jupyter-client
|
||||
ipywidgets
|
||||
ptyprocess
|
||||
lrcalc-python
|
||||
sphinx
|
||||
];
|
||||
|
||||
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"
|
||||
|
||||
cd build/pkgs/sagelib
|
||||
|
||||
# some files, like Pipfile, pyproject.toml, requirements.txt and setup.cfg
|
||||
# are generated by the bootstrap script using m4. these can fetch data from
|
||||
# build/pkgs, either directly or via sage-get-system-packages.
|
||||
sed -i '/sage_conf/d' src/setup.cfg.m4
|
||||
sed -i '/sage_conf/d' src/requirements.txt.m4
|
||||
|
||||
# version lower bounds are useful, but upper bounds are a hassle because
|
||||
# Sage tests already catch any relevant API breakage.
|
||||
# according to the discussion at https://trac.sagemath.org/ticket/33520,
|
||||
# upper bounds will be less noisy starting from Sage 9.6.
|
||||
sed -i 's/==0.5.1/>=0.5.1/' ../ptyprocess/install-requires.txt
|
||||
sed -i 's/, <[^, ]*//' ../*/install-requires.txt
|
||||
|
||||
for infile in src/*.m4; do
|
||||
if [ -f "$infile" ]; then
|
||||
outfile="src/$(basename $infile .m4)"
|
||||
m4 "$infile" > "$outfile"
|
||||
fi
|
||||
done
|
||||
|
||||
cd src
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
rm -r "$out/${python.sitePackages}/sage/cython_debug"
|
||||
'';
|
||||
|
||||
doCheck = false; # we will run tests in sage-tests.nix
|
||||
}
|
||||
19
pkgs/applications/science/math/sage/threejs-sage.nix
Normal file
19
pkgs/applications/science/math/sage/threejs-sage.nix
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
{ stdenv, fetchFromGitHub }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "threejs-sage";
|
||||
version = "r122";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "sagemath";
|
||||
repo = "threejs-sage";
|
||||
rev = version;
|
||||
sha256 = "sha256-xPAPt36Fon3hYQq6SOmGkIyUzAII2LMl10nqYG4UPI0=";
|
||||
};
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p "$out/lib/node_modules/three/"
|
||||
cp version "$out/lib/node_modules/three"
|
||||
cp -r build "$out/lib/node_modules/three/$(cat version)"
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue