Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit 72c5040

Browse files
author
Matthias Koeppe
committed
Merge branch 't/29950/build_sagelib_using_installed_sage_setup' into t/30010/split_sage_setup_docbuild_out_to_a_separate_package
2 parents 467fbc7 + 4344f89 commit 72c5040

18 files changed

+256
-84
lines changed

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,12 @@ gitlab-build-docker.log
101101
/src/bin/sage-env-config
102102
/build/bin/sage-build-env-config
103103

104+
/build/pkgs/*/src/build
105+
/build/pkgs/*/src/dist
106+
/build/pkgs/*/src/MANIFEST
107+
/build/pkgs/*/src/*.egg-info
108+
/build/pkgs/*/src/.tox
109+
104110
#######################
105111
# tox generated files #
106112
#######################

build/pkgs/sagelib/spkg-install

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
2-
cd "$SAGE_SRC"
2+
cd src
33
## All sagelib-building is done by setup.py.
44
## This is so that sagelib can be installed by standard Python procedures,
55
## such as "./setup.py install" or "pip install ."

build/pkgs/sagelib/spkg-src

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Script to prepare an sdist tarball for sagelib
4+
# This script is not used during build.
5+
#
6+
# HOW TO MAKE THE TARBALL:
7+
# ./sage --sh build/pkgs/sagelib/spkg-src
8+
9+
if [ -z "$SAGE_ROOT" ] ; then
10+
echo >&2 "Error - SAGE_ROOT undefined ... exiting"
11+
echo >&2 "Maybe run 'sage -sh'?"
12+
exit 1
13+
fi
14+
15+
# Exit on failure
16+
set -e
17+
18+
cd build/pkgs/sagelib
19+
20+
cd src
21+
sage-python23 -u setup.py --no-user-cfg sdist --dist-dir "$SAGE_DISTFILES"

build/pkgs/sagelib/src/MANIFEST.in

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
global-include *.c *.cc *.cpp *.h *.hh *.hpp *.inc *.py *.pyx *.pxd *.pxi *.rst *.txt *.tex
2+
3+
include MANIFEST.in
4+
5+
prune .tox
6+
7+
graft sage/libs/gap/test
8+
prune sage/ext/interpreters # In particular, __init__.py must not be present in the distribution; or sage_setup.autogen.interpreters.rebuild will not generate the code

build/pkgs/sagelib/src/bin

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../src/bin
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#sage_conf
2+
#sage_setup
3+
six # use of six should be removed from sage_setup
4+
Cython==0.29.17
5+
pkgconfig
6+
cysignals
7+
gmpy2==2.1.0b1
8+
9+
numpy # already needed by sage.env
10+
jinja2 # sage_setup.autogen.interpreters
11+
12+
cypari2 # but building bdist_wheel of cypari2 fails with recent pip... https://github.com/sagemath/cypari2/issues/93
13+
14+
########## Runtime
15+
16+
psutil
17+
pexpect
18+
pplpy
19+
ipython<=5.8

build/pkgs/sagelib/src/sage

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../src/sage

build/pkgs/sagelib/src/sage_setup

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../src/sage_setup

build/pkgs/sagelib/src/setup.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../src/setup.py

build/pkgs/sagelib/src/tox.ini

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# First pip-install tox:
2+
#
3+
# ./sage -pip install tox
4+
#
5+
# To build and test in the tox environment:
6+
#
7+
# ./sage -sh -c '(cd build/pkgs/sagelib/src && tox -v -v)'
8+
#
9+
# To test interactively:
10+
#
11+
# build/pkgs/sagelib/src/.tox/python/bin/python
12+
#
13+
[tox]
14+
15+
[testenv]
16+
deps = -rrequirements.txt
17+
18+
passenv =
19+
SAGE_LOCAL
20+
21+
setenv =
22+
# Sage scripts such as sage-runtests like to use $HOME/.sage
23+
HOME={envdir}
24+
25+
whitelist_externals =
26+
bash
27+
28+
commands =
29+
# Beware of the treacherous non-src layout. "./sage/" shadows the install sage package.
30+
python -c 'import sys; "" in sys.path and sys.path.remove(""); import sage.all; print(sage.all.__file__)'
31+
32+
# FIXME: The following loads sage-env, which loads the wrong Python.
33+
sage -c 'import sys; print("sys.path =", sys.path); import sage.all; print(sage.all.__file__)'
34+
35+
#sage -t --all

src/MANIFEST.in

-38
This file was deleted.

src/module_list.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
#########################################################
2+
###
3+
### OBSOLETE FILE - DO NOT ADD TO IT
4+
###
5+
### See https://trac.sagemath.org/ticket/29701
6+
###
7+
#########################################################
8+
19
import os
210
from distutils.extension import Extension
311
from sage.env import SAGE_LOCAL
@@ -306,8 +314,7 @@
306314
sources = ['sage/graphs/strongly_regular_db.pyx']),
307315

308316
Extension('sage.graphs.graph_decompositions.rankwidth',
309-
sources = ['sage/graphs/graph_decompositions/rankwidth.pyx'],
310-
libraries=['rw']),
317+
sources = ['sage/graphs/graph_decompositions/rankwidth.pyx']),
311318

312319
Extension('sage.graphs.graph_decompositions.bandwidth',
313320
sources = ['sage/graphs/graph_decompositions/bandwidth.pyx']),
@@ -317,7 +324,6 @@
317324

318325
OptionalExtension('sage.graphs.graph_decompositions.tdlib',
319326
sources = ['sage/graphs/graph_decompositions/tdlib.pyx'],
320-
language="c++",
321327
package = 'tdlib'),
322328

323329
Extension('sage.graphs.graph_decompositions.clique_separators',

src/sage/graphs/graph_decompositions/rankwidth.pyx

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# cython: binding=True
2+
# distutils: libraries = rw
23
r"""
34
Rank Decompositions of graphs
45

src/sage/graphs/graph_decompositions/tdlib.pyx

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# distutils: language = c++
2+
# sage_setup: distribution = sage-tdlib
3+
14
r"""
25
Interface with TdLib (algorithms for tree decompositions)
36

src/sage_setup/command/sage_build.py

+13-2
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,21 @@ def run_autogen(self):
1212
see :trac:`22106`.
1313
"""
1414
from sage_setup.autogen import autogen_all
15+
from sage_setup.find import find_python_sources
16+
from sage.env import SAGE_SRC
17+
1518
log.info("Generating auto-generated sources")
16-
for pkg in autogen_all():
19+
20+
pkgs = autogen_all()
21+
python_packages, python_modules, cython_modules = find_python_sources(
22+
SAGE_SRC, [ pkg.replace('.', '/') for pkg in pkgs])
23+
24+
for pkg in python_packages:
1725
if pkg not in self.distribution.packages:
18-
self.distribution.packages.append(pkg)
26+
self.distribution.packages.append(pkg)
27+
28+
for cython_module in cython_modules:
29+
self.distribution.ext_modules.append(cython_module)
1930

2031
def run(self):
2132
self.run_autogen()

0 commit comments

Comments
 (0)