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

Commit

Permalink
Merge branch 't/29950/build_sagelib_using_installed_sage_setup' into …
Browse files Browse the repository at this point in the history
…t/30010/split_sage_setup_docbuild_out_to_a_separate_package
  • Loading branch information
Matthias Koeppe committed Jul 13, 2020
2 parents 467fbc7 + 4344f89 commit 72c5040
Show file tree
Hide file tree
Showing 18 changed files with 256 additions and 84 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ gitlab-build-docker.log
/src/bin/sage-env-config
/build/bin/sage-build-env-config

/build/pkgs/*/src/build
/build/pkgs/*/src/dist
/build/pkgs/*/src/MANIFEST
/build/pkgs/*/src/*.egg-info
/build/pkgs/*/src/.tox

#######################
# tox generated files #
#######################
Expand Down
2 changes: 1 addition & 1 deletion build/pkgs/sagelib/spkg-install
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
cd "$SAGE_SRC"
cd src
## All sagelib-building is done by setup.py.
## This is so that sagelib can be installed by standard Python procedures,
## such as "./setup.py install" or "pip install ."
Expand Down
21 changes: 21 additions & 0 deletions build/pkgs/sagelib/spkg-src
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
#
# Script to prepare an sdist tarball for sagelib
# This script is not used during build.
#
# HOW TO MAKE THE TARBALL:
# ./sage --sh build/pkgs/sagelib/spkg-src

if [ -z "$SAGE_ROOT" ] ; then
echo >&2 "Error - SAGE_ROOT undefined ... exiting"
echo >&2 "Maybe run 'sage -sh'?"
exit 1
fi

# Exit on failure
set -e

cd build/pkgs/sagelib

cd src
sage-python23 -u setup.py --no-user-cfg sdist --dist-dir "$SAGE_DISTFILES"
8 changes: 8 additions & 0 deletions build/pkgs/sagelib/src/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
global-include *.c *.cc *.cpp *.h *.hh *.hpp *.inc *.py *.pyx *.pxd *.pxi *.rst *.txt *.tex

include MANIFEST.in

prune .tox

graft sage/libs/gap/test
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
1 change: 1 addition & 0 deletions build/pkgs/sagelib/src/bin
19 changes: 19 additions & 0 deletions build/pkgs/sagelib/src/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#sage_conf
#sage_setup
six # use of six should be removed from sage_setup
Cython==0.29.17
pkgconfig
cysignals
gmpy2==2.1.0b1

numpy # already needed by sage.env
jinja2 # sage_setup.autogen.interpreters

cypari2 # but building bdist_wheel of cypari2 fails with recent pip... https://github.com/sagemath/cypari2/issues/93

########## Runtime

psutil
pexpect
pplpy
ipython<=5.8
1 change: 1 addition & 0 deletions build/pkgs/sagelib/src/sage
1 change: 1 addition & 0 deletions build/pkgs/sagelib/src/sage_setup
1 change: 1 addition & 0 deletions build/pkgs/sagelib/src/setup.py
35 changes: 35 additions & 0 deletions build/pkgs/sagelib/src/tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# First pip-install tox:
#
# ./sage -pip install tox
#
# To build and test in the tox environment:
#
# ./sage -sh -c '(cd build/pkgs/sagelib/src && tox -v -v)'
#
# To test interactively:
#
# build/pkgs/sagelib/src/.tox/python/bin/python
#
[tox]

[testenv]
deps = -rrequirements.txt

passenv =
SAGE_LOCAL

setenv =
# Sage scripts such as sage-runtests like to use $HOME/.sage
HOME={envdir}

whitelist_externals =
bash

commands =
# Beware of the treacherous non-src layout. "./sage/" shadows the install sage package.
python -c 'import sys; "" in sys.path and sys.path.remove(""); import sage.all; print(sage.all.__file__)'

# FIXME: The following loads sage-env, which loads the wrong Python.
sage -c 'import sys; print("sys.path =", sys.path); import sage.all; print(sage.all.__file__)'

#sage -t --all
38 changes: 0 additions & 38 deletions src/MANIFEST.in

This file was deleted.

12 changes: 9 additions & 3 deletions src/module_list.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
#########################################################
###
### OBSOLETE FILE - DO NOT ADD TO IT
###
### See https://trac.sagemath.org/ticket/29701
###
#########################################################

import os
from distutils.extension import Extension
from sage.env import SAGE_LOCAL
Expand Down Expand Up @@ -306,8 +314,7 @@
sources = ['sage/graphs/strongly_regular_db.pyx']),

Extension('sage.graphs.graph_decompositions.rankwidth',
sources = ['sage/graphs/graph_decompositions/rankwidth.pyx'],
libraries=['rw']),
sources = ['sage/graphs/graph_decompositions/rankwidth.pyx']),

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

OptionalExtension('sage.graphs.graph_decompositions.tdlib',
sources = ['sage/graphs/graph_decompositions/tdlib.pyx'],
language="c++",
package = 'tdlib'),

Extension('sage.graphs.graph_decompositions.clique_separators',
Expand Down
1 change: 1 addition & 0 deletions src/sage/graphs/graph_decompositions/rankwidth.pyx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# cython: binding=True
# distutils: libraries = rw
r"""
Rank Decompositions of graphs
Expand Down
3 changes: 3 additions & 0 deletions src/sage/graphs/graph_decompositions/tdlib.pyx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# distutils: language = c++
# sage_setup: distribution = sage-tdlib

r"""
Interface with TdLib (algorithms for tree decompositions)
Expand Down
15 changes: 13 additions & 2 deletions src/sage_setup/command/sage_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,21 @@ def run_autogen(self):
see :trac:`22106`.
"""
from sage_setup.autogen import autogen_all
from sage_setup.find import find_python_sources
from sage.env import SAGE_SRC

log.info("Generating auto-generated sources")
for pkg in autogen_all():

pkgs = autogen_all()
python_packages, python_modules, cython_modules = find_python_sources(
SAGE_SRC, [ pkg.replace('.', '/') for pkg in pkgs])

for pkg in python_packages:
if pkg not in self.distribution.packages:
self.distribution.packages.append(pkg)
self.distribution.packages.append(pkg)

for cython_module in cython_modules:
self.distribution.ext_modules.append(cython_module)

def run(self):
self.run_autogen()
Expand Down
Loading

0 comments on commit 72c5040

Please sign in to comment.