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

Commit

Permalink
pkgs/sagemath-gap: WIP setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
mkoeppe committed Dec 3, 2022
1 parent a73b489 commit 30112b2
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 35 deletions.
1 change: 0 additions & 1 deletion build/pkgs/sagemath_gap/spkg-install

This file was deleted.

30 changes: 30 additions & 0 deletions build/pkgs/sagemath_gap/spkg-install
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
# From sage-spkg.
# For type=script packages, the build rule in build/make/Makefile sources
# sage-env but not sage-dist-helpers.
lib="$SAGE_ROOT/build/bin/sage-dist-helpers"
source "$lib"
if [ $? -ne 0 ]; then
echo >&2 "Error: failed to source $lib"
echo >&2 "Is $SAGE_ROOT the correct SAGE_ROOT?"
exit 1
fi
cd src

export PIP_NO_INDEX=true
export PIP_FIND_LINKS="file://$SAGE_SPKG_WHEELS"

rm -Rf build
# First build the sdist, then build the wheel from the sdist.
# https://pypa-build.readthedocs.io/en/latest/#python--m-build
# (Important because sagemath-objects uses MANIFEST.in for filtering.)
# Do not install the wheel.
DIST_DIR="$(mktemp -d)"
python3 -m build --outdir "$DIST_DIR"/dist . || sdh_die "Failure building sdist and wheel"
ls -l "$DIST_DIR"/dist/*.tar.gz
wheel=$(cd "$DIST_DIR" && sdh_store_wheel . && echo $wheel)
ls -l "$wheel"

if [ "$SAGE_CHECK" != no ]; then
tox -r -v -e sagepython-sagewheels-nopypi-norequirements --installpkg $wheel
fi
12 changes: 10 additions & 2 deletions pkgs/sagemath-gap/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
include VERSION.txt

prune sage
global-include all__sagemath_gap.py
graft sage/libs/gap
graft sage/data_structures # FIXME
include sage/combinat/enumeration_mod_permgroup.pyx
graft sage/groups/perm_gps
include sage/matrix/matrix_gap.pyx

global-exclude *.c
global-exclude *.cpp

Expand All @@ -9,5 +19,3 @@ global-exclude *~
prune .tox
prune build
prune dist

include VERSION.txt
57 changes: 25 additions & 32 deletions pkgs/sagemath-gap/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,50 +19,43 @@
except ImportError:
pass

# PEP 517 builds do not have . in sys.path
import sys
sys.path.insert(0, os.path.dirname(__file__))
from sage_setup.excepthook import excepthook
sys.excepthook = excepthook

if len(sys.argv) > 1 and (sys.argv[1] == "sdist" or sys.argv[1] == "egg_info"):
sdist = True
else:
sdist = False
from sage_setup.setenv import setenv
setenv()

if sdist:
cmdclass = {}
else:
from sage_setup.excepthook import excepthook
sys.excepthook = excepthook
import sage.env
sage.env.default_required_modules = sage.env.default_optional_modules = ()

from sage_setup.setenv import setenv
setenv()
from sage_setup.command.sage_build_cython import sage_build_cython
from sage_setup.command.sage_build_ext import sage_build_ext
import os.path

import sage.env
sage.env.default_required_modules = sage.env.default_optional_modules = ()
sage_build_cython.built_distributions = ['sagemath-gap']

from sage_setup.command.sage_build_cython import sage_build_cython
from sage_setup.command.sage_build_ext import sage_build_ext
sage_build_cython.built_distributions = ['sagemath-gap']
cmdclass = dict(build_cython=sage_build_cython,
build_ext=sage_build_ext)

cmdclass = dict(build_cython=sage_build_cython,
build_ext=sage_build_ext)
from sage_setup.find import find_python_sources, find_extra_files
python_packages, python_modules, cython_modules = find_python_sources(
'.', ['sage'], distributions=['sagemath-gap'])
extra_files = find_extra_files(
'.', ['sage'], '/doesnotexist', distributions=['sagemath-gap'])
package_data = {"": [f
for pkg, files in extra_files.items()
for f in files ]}

if sdist:
python_packages = []
python_modules = []
cython_modules = []
else:
from sage_setup.find import find_python_sources
python_packages, python_modules, cython_modules = find_python_sources(
'.', ['sage'], distributions=['sagemath-gap'])

log.warn('python_packages = {0}'.format(python_packages))
log.warn('python_modules = {0}'.format(python_modules))
log.warn('cython_modules = {0}'.format(cython_modules))
log.warn('python_packages = {0}'.format(python_packages))
log.warn('python_modules = {0}'.format(python_modules))
log.warn('cython_modules = {0}'.format(cython_modules))
log.warn('package_data = {0}'.format(package_data))

setup(
cmdclass = cmdclass,
packages = python_packages,
py_modules = python_modules,
ext_modules = cython_modules,
package_data = package_data,
)

0 comments on commit 30112b2

Please sign in to comment.