Skip to content

Commit

Permalink
make check: Get rid of practices predating PEP 517/518
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Oct 8, 2023
1 parent 6c78418 commit 14118e2
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 102 deletions.
42 changes: 12 additions & 30 deletions .github/workflows/ci-sage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,9 @@ env:
TARGETS_PRE: build/make/Makefile
TARGETS: SAGE_CHECK=no SAGE_CHECK_PACKAGES="cysignals,cypari" cysignals cypari
TARGETS_OPTIONAL: build/make/Makefile
# Standard setting: Test the current beta release of Sage:
# Temporarily test with https://github.com/sagemath/sage/pull/36110
# Standard setting: Test the current beta release of Sage
SAGE_REPO: sagemath/sage
SAGE_REF: refs/pull/36110/merge
SAGE_REF: develop
REMOVE_PATCHES: "*"

jobs:
Expand Down Expand Up @@ -106,29 +105,24 @@ jobs:
with:
submodules: recursive
fetch-depth: 0
- name: install cygwin and minimal prerequisites with choco
- name: Install cygwin and minimal prerequisites with choco
shell: bash {0}
run: |
choco --version
choco install make autoconf gcc-core gcc-g++ python3${{ matrix.python-version }}-devel --source cygwin
- name: install dependencies
run: |
C:\\tools\\cygwin\\bin\\bash -l -x -c 'export PATH=/usr/local/bin:/usr/bin && cd $(cygpath -u "$GITHUB_WORKSPACE") && python3.${{ matrix.python-version }} -m pip install -U --no-build-isolation -r requirements.txt'
- name: install
- name: Install dependencies
run: |
C:\\tools\\cygwin\\bin\\bash -l -x -c 'export PATH=/usr/local/bin:/usr/bin && cd $(cygpath -u "$GITHUB_WORKSPACE") && python3.${{ matrix.python-version }} setup.py build_ext -i'
- name: test
C:\\tools\\cygwin\\bin\\bash -l -x -c 'export PATH=/usr/local/bin:/usr/bin && cd $(cygpath -u "$GITHUB_WORKSPACE") && python3.${{ matrix.python-version }} -m pip install --upgrade pip'
- name: Build and check
run: |
C:\\tools\\cygwin\\bin\\bash -l -x -c 'export PATH=/usr/local/bin:/usr/bin && cd $(cygpath -u "$GITHUB_WORKSPACE") && make install PYTHON=python3.${{ matrix.python-version }}'
C:\\tools\\cygwin\\bin\\bash -l -x -c 'export PATH=/usr/local/bin:/usr/bin && cd $(cygpath -u "$GITHUB_WORKSPACE") && make check-all PYTHON=python3.${{ matrix.python-version }}'
C:\\tools\\cygwin\\bin\\bash -l -x -c 'export PATH=/usr/local/bin:/usr/bin && cd $(cygpath -u "$GITHUB_WORKSPACE") && make distcheck PYTHON=python3.${{ matrix.python-version }}'
C:\\tools\\cygwin\\bin\\bash -l -x -c 'export PATH=/usr/local/bin:/usr/bin && cd $(cygpath -u "$GITHUB_WORKSPACE") && make check PYTHON=python3.${{ matrix.python-version }}'
ubuntu-without-sage:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12-dev']
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
steps:
- name: Set up the repository
uses: actions/checkout@v4
Expand All @@ -142,15 +136,9 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U --no-build-isolation -r requirements.txt
- name: Freeze pip
- name: Build and check
run: |
pip freeze
- name: Local build
run: |
make -j4 install
make -j4 check-all
make -j4 distcheck
make -j4 check
linux:
uses: sagemath/sage/.github/workflows/docker.yml@develop
Expand Down Expand Up @@ -210,15 +198,9 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U --no-build-isolation -r requirements.txt
- name: Freeze pip
run: |
pip freeze
- name: Local build
- name: Build and check
run: |
make -j4 install
make -j4 check-all
make -j4 distcheck
make -j4 check
macos:
uses: sagemath/sage/.github/workflows/macos.yml@develop
Expand Down
79 changes: 9 additions & 70 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ DOCTEST = $(PYTHON) -B rundoctests.py
all: build doc

build: configure
$(PYTHON) setup.py build
$(PIP) install build
$(PYTHON) -m build

install: configure
$(PIP) install --no-build-isolation --no-index --ignore-installed --no-deps .
$(PIP) install .

dist: configure
$(PIP) install build
Expand Down Expand Up @@ -56,9 +57,9 @@ distclean: clean

test: check

check: check-tmp
check: check-all

check-all: check-tmp
check-all:
$(MAKE) check-install

# Install and check
Expand All @@ -68,73 +69,13 @@ check-doctest: install
$(DOCTEST) src/cysignals/*.pyx

check-example: install
cd example && $(PYTHON) setup.py clean build
$(PYTHON) -m pip install -U build setuptools Cython
cd example && $(PYTHON) -m build --no-isolation .

check-gdb: install
$(PYTHON) testgdb.py


#####################
# Check installation
#####################
#
# Test 2 installation scenarios without a real installation
# - prefix (with --prefix and --root)
# - user (with --user)

check-tmp:
$(MAKE) check-prefix
$(MAKE) check-user

prefix-install: configure
rm -rf tmp/local tmp/build tmp/site-packages
$(PYTHON) setup.py install --prefix="`pwd`/tmp/local" --root=tmp/build
cd tmp && mv "build/`pwd`/local" local
cd tmp && cp -R local/lib*/python*/site-packages site-packages

check-prefix: check-prefix-doctest check-prefix-example

check-prefix-doctest: prefix-install
export PYTHONPATH="`pwd`/tmp/site-packages" && $(DOCTEST) src/cysignals/*.pyx

check-prefix-example: prefix-install
rm -rf example/build
export PYTHONPATH="`pwd`/tmp/site-packages" && cd example && $(PYTHON) setup.py clean build

check-user: check-user-doctest check-user-example

user-install: configure
rm -rf tmp/user
export PYTHONUSERBASE="`pwd`/tmp/user" && $(PYTHON) setup.py install --user --old-and-unmanageable

check-user-doctest: user-install
export PYTHONUSERBASE="`pwd`/tmp/user" && $(DOCTEST) src/cysignals/*.pyx

check-user-example: user-install
export PYTHONUSERBASE="`pwd`/tmp/user" && cd example && $(PYTHON) setup.py clean build

distcheck: dist
rm -rf dist/check
mkdir -p dist/check
cd dist/check && tar xzf ../cysignals-$(VERSION).tar.gz
cd dist/check/cysignals-$(VERSION) && $(LS_R) >../dist0.ls
cd dist/check/cysignals-$(VERSION) && $(MAKE) all
cd dist/check/cysignals-$(VERSION) && $(MAKE) distclean
cd dist/check/cysignals-$(VERSION) && $(LS_R) >../dist1.ls
cd dist/check; diff -u dist0.ls dist1.ls || { echo >&2 "Error: distclean after all leaves garbage"; exit 1; }
cd dist/check/cysignals-$(VERSION) && $(MAKE) check-user
cd dist/check/cysignals-$(VERSION) && ./configure --enable-debug
cd dist/check/cysignals-$(VERSION) && $(MAKE) check-prefix
cd dist/check/cysignals-$(VERSION) && $(MAKE) distclean
cd dist/check/cysignals-$(VERSION) && $(LS_R) >../dist2.ls
cd dist/check; diff -u dist0.ls dist2.ls || { echo >&2 "Error: distclean after check-tmp leaves garbage"; exit 1; }
cd dist/check/cysignals-$(VERSION) && $(MAKE) dist
cd dist/check/cysignals-$(VERSION) && tar xzf dist/cysignals-$(VERSION).tar.gz
cd dist/check/cysignals-$(VERSION)/cysignals-$(VERSION) && $(LS_R) >../../dist3.ls
cd dist/check; diff -u dist0.ls dist3.ls || { echo >&2 "Error: sdist is not reproducible"; exit 1; }
rm -rf dist/check


#####################
# Maintain
#####################
Expand All @@ -145,7 +86,5 @@ configure: configure.ac
@rm -f src/config.h.in~

.PHONY: all build doc install dist doc clean clean-build clean-doc \
distclean test check check-all check-tmp check-install \
check-doctest check-example \
check-prefix prefix-install check-prefix-doctest check-prefix-example \
check-user user-install check-user-doctest check-user-example
distclean test check check-all check-install \
check-doctest check-example
3 changes: 3 additions & 0 deletions example/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ['setuptools', 'Cython>=0.28', 'cysignals']
build-backend = "setuptools.build_meta"
4 changes: 2 additions & 2 deletions example/setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python3

from setuptools import setup
from setuptools.extension import Extension
from distutils.command.build import build as _build


Expand All @@ -21,7 +22,6 @@ def cythonize(self, extensions):
name="cysignals_example",
version='1.0',
license='Public Domain',
setup_requires=["cysignals"],
ext_modules=["cysignals_example.pyx"],
ext_modules=[Extension("*", ["cysignals_example.pyx"])],
cmdclass=dict(build=build),
)

0 comments on commit 14118e2

Please sign in to comment.