From bfac057d8fa119a63ea0daf7c66f4ab94109b149 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Fri, 20 Oct 2023 10:06:16 +0000 Subject: [PATCH 01/15] Use meson instead of configure for conda install --- .github/workflows/ci-conda.yml | 2 +- .vscode/settings.json | 3 +- meson.build | 40 +++++++++++++++++++ pkgs/sage-conf/pyproject.toml | 7 ++++ pkgs/sage-conf_meson/.gitignore | 7 ++++ pkgs/sage-conf_meson/README.rst | 1 + pkgs/sage-conf_meson/VERSION.txt | 1 + pkgs/sage-conf_meson/_sage_conf | 1 + pkgs/sage-conf_meson/pyproject.toml | 1 + pkgs/sage-conf_meson/sage_conf.py | 6 +++ pkgs/sage-conf_meson/setup.py | 62 +++++++++++++++++++++++++++++ src/doc/en/installation/conda.rst | 5 ++- 12 files changed, 133 insertions(+), 3 deletions(-) create mode 100644 meson.build create mode 100644 pkgs/sage-conf_meson/.gitignore create mode 120000 pkgs/sage-conf_meson/README.rst create mode 100644 pkgs/sage-conf_meson/VERSION.txt create mode 120000 pkgs/sage-conf_meson/_sage_conf create mode 120000 pkgs/sage-conf_meson/pyproject.toml create mode 100644 pkgs/sage-conf_meson/sage_conf.py create mode 100644 pkgs/sage-conf_meson/setup.py diff --git a/.github/workflows/ci-conda.yml b/.github/workflows/ci-conda.yml index e520fa17104..961cd439d18 100644 --- a/.github/workflows/ci-conda.yml +++ b/.github/workflows/ci-conda.yml @@ -91,7 +91,7 @@ jobs: shell: bash -l {0} run: | # Use --no-deps and pip check below to verify that all necessary dependencies are installed via conda. - pip install --no-build-isolation --no-deps -v -v -e ./pkgs/sage-conf ./pkgs/sage-setup + pip install --no-build-isolation --no-deps -v -v -e ./pkgs/sage-conf_meson ./pkgs/sage-setup pip install --no-build-isolation --no-deps -v -v -e ./src env: SAGE_NUM_THREADS: 2 diff --git a/.vscode/settings.json b/.vscode/settings.json index b3079a7c4ee..fc6789fe0e6 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -34,5 +34,6 @@ "sagemath", "Cython" ], - "editor.formatOnType": true + "editor.formatOnType": true, + "esbonio.sphinx.confDir": "" } diff --git a/meson.build b/meson.build new file mode 100644 index 00000000000..5cfb720d243 --- /dev/null +++ b/meson.build @@ -0,0 +1,40 @@ +project('sage', 'c') +cc = meson.get_compiler('c') +conf_data = configuration_data() + +conf_data.set('PACKAGE_VERSION', '1.2.3') + +maxima = find_program('maxima', required: true) +conf_data.set('SAGE_MAXIMA', maxima.path()) +# Conda's ecl does not have any problems with Maxima, so nothing needs to be set here: +conf_data.set('SAGE_MAXIMA_FAS', '') + +# Kenzo cannot yet be provided by the system, so we always use the SAGE_LOCAL path for now. +conf_data.set('SAGE_KENZO_FAS', '\'${prefix}\'/lib/ecl/kenzo.fas') + +conf_data.set('SAGE_ARB_LIBRARY', 'arb') + +#ntl = dependency('ntl', required: true) doesn't work, so ask the compiler directly: +ntl = cc.find_library('ntl', required: true) +# It can be found, so we don't have to set anything here: +conf_data.set('NTL_INCDIR', '') +conf_data.set('NTL_LIBDIR', '') + +ecl_config = find_program('ecl-config', required: true) +conf_data.set('SAGE_ECL_CONFIG', ecl_config.path()) + +conf_data.set('SAGE_ARCHFLAGS', 'unset') + +# not needed when using conda, as we then don't build any pc files +conf_data.set('SAGE_PKG_CONFIG_PATH', '') + +openmp = dependency('openmp', required : false) +if openmp.found() + conf_data.set('OPENMP_CFLAGS', '-fopenmp') + conf_data.set('OPENMP_CXXFLAGS', '-fopenmp') +endif + +configure_file(input : 'pkgs/sage-conf_conda/_sage_conf/_conf.py.in', + output : '_conf.py', + configuration : conf_data) + diff --git a/pkgs/sage-conf/pyproject.toml b/pkgs/sage-conf/pyproject.toml index 9787c3bdf00..9b39d5d8816 100644 --- a/pkgs/sage-conf/pyproject.toml +++ b/pkgs/sage-conf/pyproject.toml @@ -1,3 +1,10 @@ [build-system] requires = ["setuptools", "wheel"] build-backend = "setuptools.build_meta" + +[project] +name = "sage-conf" +dynamic = ["version"] + +[tool.setuptools.dynamic] +version = {file = ["VERSION.txt"]} diff --git a/pkgs/sage-conf_meson/.gitignore b/pkgs/sage-conf_meson/.gitignore new file mode 100644 index 00000000000..ff1f6bd336e --- /dev/null +++ b/pkgs/sage-conf_meson/.gitignore @@ -0,0 +1,7 @@ +/_sage_conf/_conf.py +/builddir +/build +/dist +/*.egg-info +/.tox +/bin/sage-env-config diff --git a/pkgs/sage-conf_meson/README.rst b/pkgs/sage-conf_meson/README.rst new file mode 120000 index 00000000000..feda886cd36 --- /dev/null +++ b/pkgs/sage-conf_meson/README.rst @@ -0,0 +1 @@ +../sage-conf/README.rst \ No newline at end of file diff --git a/pkgs/sage-conf_meson/VERSION.txt b/pkgs/sage-conf_meson/VERSION.txt new file mode 100644 index 00000000000..e3fab2e6628 --- /dev/null +++ b/pkgs/sage-conf_meson/VERSION.txt @@ -0,0 +1 @@ +10.2.beta7 diff --git a/pkgs/sage-conf_meson/_sage_conf b/pkgs/sage-conf_meson/_sage_conf new file mode 120000 index 00000000000..d92a91bef8c --- /dev/null +++ b/pkgs/sage-conf_meson/_sage_conf @@ -0,0 +1 @@ +../sage-conf/_sage_conf \ No newline at end of file diff --git a/pkgs/sage-conf_meson/pyproject.toml b/pkgs/sage-conf_meson/pyproject.toml new file mode 120000 index 00000000000..52c93c824e2 --- /dev/null +++ b/pkgs/sage-conf_meson/pyproject.toml @@ -0,0 +1 @@ +../sage-conf/pyproject.toml \ No newline at end of file diff --git a/pkgs/sage-conf_meson/sage_conf.py b/pkgs/sage-conf_meson/sage_conf.py new file mode 100644 index 00000000000..1b09bb76a83 --- /dev/null +++ b/pkgs/sage-conf_meson/sage_conf.py @@ -0,0 +1,6 @@ +from _sage_conf.__main__ import _main + +from builddir._conf import * +from builddir.build_info import CONDA_PREFIX, SAGE_ROOT + +SAGE_LOCAL = CONDA_PREFIX diff --git a/pkgs/sage-conf_meson/setup.py b/pkgs/sage-conf_meson/setup.py new file mode 100644 index 00000000000..34ce471d429 --- /dev/null +++ b/pkgs/sage-conf_meson/setup.py @@ -0,0 +1,62 @@ +import os +import sys +from distutils.command.build_scripts import \ + build_scripts as distutils_build_scripts +from pathlib import Path + +from setuptools import setup +from setuptools.command.build_py import build_py as setuptools_build_py +from setuptools.command.editable_wheel import \ + editable_wheel as setuptools_editable_wheel +from setuptools.errors import SetupError + + +class build_py(setuptools_build_py): + def run(self): + here = Path(__file__).parent + if self.editable_mode: + root = here.parent.parent + else: + raise SetupError('Not supported') + + conda_prefix = os.environ.get('CONDA_PREFIX', '') + if not conda_prefix: + raise SetupError( + 'No conda environment is active. ' + 'See https://doc.sagemath.org/html/en/installation/conda.html on how to get started.' + ) + + builddir = here / "builddir" + cmd = f"cd {root} && meson setup {builddir} --wipe" + print(f"Running {cmd}") + sys.stdout.flush() + if os.system(cmd) != 0: + raise SetupError("configure failed") + + # Write build info + with open(builddir / 'build_info.py', 'w', encoding="utf-8") as build_info: + build_info.write(f'SAGE_ROOT = "{root}"\n') + build_info.write(f'CONDA_PREFIX = "{conda_prefix}"\n') + + +class build_scripts(distutils_build_scripts): + def run(self): + self.distribution.scripts.append(os.path.join('bin', 'sage-env-config')) + if not self.distribution.entry_points: + self.entry_points = self.distribution.entry_points = dict() + distutils_build_scripts.run(self) + + +class editable_wheel(setuptools_editable_wheel): + r""" + Customized so that exceptions raised by our build_py + do not lead to the "Customization incompatible with editable install" message + """ + _safely_run = setuptools_editable_wheel.run_command + + +setup( + cmdclass=dict( + build_py=build_py, build_scripts=build_scripts, editable_wheel=editable_wheel + ) +) diff --git a/src/doc/en/installation/conda.rst b/src/doc/en/installation/conda.rst index 14fe52ad2e2..dd6f02810ab 100644 --- a/src/doc/en/installation/conda.rst +++ b/src/doc/en/installation/conda.rst @@ -138,9 +138,12 @@ Here we assume that you are using a git checkout. - Install the build prerequisites and the Sage library:: - $ pip install --no-build-isolation -v -v --editable ./pkgs/sage-conf_conda ./pkgs/sage-setup + $ pip install --no-build-isolation -v -v --editable ./pkgs/sage-conf_meson ./pkgs/sage-setup $ pip install --no-build-isolation --config-settings editable_mode=compat -v -v --editable ./src + In case of errors, try to use `sage-conf_conda` instead of `sage-conf_meson`, + and please report the problem by opening an issue on GitHub. + - Verify that Sage has been installed:: $ sage -c 'print(version())' From 96940465d99ac7215e5382bc56527ceb941dcd4e Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Fri, 20 Oct 2023 11:10:19 +0000 Subject: [PATCH 02/15] remove editable wheel customization --- pkgs/sage-conf_meson/setup.py | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/pkgs/sage-conf_meson/setup.py b/pkgs/sage-conf_meson/setup.py index 34ce471d429..f2bbe98b8ff 100644 --- a/pkgs/sage-conf_meson/setup.py +++ b/pkgs/sage-conf_meson/setup.py @@ -6,8 +6,6 @@ from setuptools import setup from setuptools.command.build_py import build_py as setuptools_build_py -from setuptools.command.editable_wheel import \ - editable_wheel as setuptools_editable_wheel from setuptools.errors import SetupError @@ -47,16 +45,8 @@ def run(self): distutils_build_scripts.run(self) -class editable_wheel(setuptools_editable_wheel): - r""" - Customized so that exceptions raised by our build_py - do not lead to the "Customization incompatible with editable install" message - """ - _safely_run = setuptools_editable_wheel.run_command - - setup( cmdclass=dict( - build_py=build_py, build_scripts=build_scripts, editable_wheel=editable_wheel + build_py=build_py, build_scripts=build_scripts ) ) From 376742a50e9807269cdaa4476ea59ca587d8a8fd Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Fri, 20 Oct 2023 11:11:25 +0000 Subject: [PATCH 03/15] remove configure from conda ci --- .github/workflows/ci-conda.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci-conda.yml b/.github/workflows/ci-conda.yml index 961cd439d18..78af8eed170 100644 --- a/.github/workflows/ci-conda.yml +++ b/.github/workflows/ci-conda.yml @@ -77,15 +77,9 @@ jobs: conda info conda list - - name: Configure + - name: Bootstrap shell: bash -l {0} - continue-on-error: true - run: | - ./bootstrap - echo "::add-matcher::.github/workflows/configure-systempackage-problem-matcher.json" - ./configure --enable-build-as-root --with-python=$CONDA_PREFIX/bin/python --prefix=$CONDA_PREFIX --enable-system-site-packages $(for pkg in $(./sage -package list :standard: --has-file spkg-configure.m4 --has-file distros/conda.txt --exclude rpy2); do echo --with-system-$pkg=force; done) - echo "::remove-matcher owner=configure-system-package-warning::" - echo "::remove-matcher owner=configure-system-package-error::" + run: ./bootstrap - name: Build shell: bash -l {0} From 84ff7ffe0d5a9e06bd5a20b41ef59b26f92e933b Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Fri, 20 Oct 2023 12:44:23 +0000 Subject: [PATCH 04/15] Revert "remove editable wheel customization" This reverts commit 96940465d99ac7215e5382bc56527ceb941dcd4e. --- pkgs/sage-conf_meson/setup.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pkgs/sage-conf_meson/setup.py b/pkgs/sage-conf_meson/setup.py index f2bbe98b8ff..34ce471d429 100644 --- a/pkgs/sage-conf_meson/setup.py +++ b/pkgs/sage-conf_meson/setup.py @@ -6,6 +6,8 @@ from setuptools import setup from setuptools.command.build_py import build_py as setuptools_build_py +from setuptools.command.editable_wheel import \ + editable_wheel as setuptools_editable_wheel from setuptools.errors import SetupError @@ -45,8 +47,16 @@ def run(self): distutils_build_scripts.run(self) +class editable_wheel(setuptools_editable_wheel): + r""" + Customized so that exceptions raised by our build_py + do not lead to the "Customization incompatible with editable install" message + """ + _safely_run = setuptools_editable_wheel.run_command + + setup( cmdclass=dict( - build_py=build_py, build_scripts=build_scripts + build_py=build_py, build_scripts=build_scripts, editable_wheel=editable_wheel ) ) From 885e2b4cb478785702a3e1d5aa48ececefe0caf6 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Fri, 20 Oct 2023 12:48:14 +0000 Subject: [PATCH 05/15] split setup and conf for cleaner display --- .github/workflows/ci-conda.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-conda.yml b/.github/workflows/ci-conda.yml index c859b7d68e6..ccafb4af359 100644 --- a/.github/workflows/ci-conda.yml +++ b/.github/workflows/ci-conda.yml @@ -74,7 +74,12 @@ jobs: shell: bash -l {0} run: | # Use --no-deps and pip check below to verify that all necessary dependencies are installed via conda. - pip install --no-build-isolation --no-deps -v -v -e ./pkgs/sage-conf_meson ./pkgs/sage-setup + echo "::group::sage-setup" + pip install --no-build-isolation --no-deps -v -v -e ./pkgs/sage-setup + echo "::endgroup::" + echo "::group::sage-conf" + pip install --no-build-isolation --no-deps -v -v -e ./pkgs/sage-conf_meson + echo "::endgroup::" pip install --no-build-isolation --no-deps --config-settings editable_mode=compat -v -v -e ./src env: SAGE_NUM_THREADS: 2 From f755a8eb5b0b3b04855bde18012cc71a86b7d460 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Fri, 20 Oct 2023 14:01:01 +0000 Subject: [PATCH 06/15] add meson to conda env --- bootstrap-conda | 1 + 1 file changed, 1 insertion(+) diff --git a/bootstrap-conda b/bootstrap-conda index faa29513db4..ba007779b8a 100755 --- a/bootstrap-conda +++ b/bootstrap-conda @@ -95,6 +95,7 @@ echo >&2 $0:$LINENO: generate conda environment files for pkg in $BOOTSTRAP_SYSTEM_PACKAGES; do echo " - $pkg" done + echo " - meson" ) > environment-template.yml ( sed 's/name: sage-build/name: sage/' environment-template.yml From 4406868d891c9dd57f9dc8d6a633fb79ac1e3033 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Sat, 21 Oct 2023 23:32:48 +0800 Subject: [PATCH 07/15] Fix style in conda docs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Matthias Köppe --- src/doc/en/installation/conda.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/en/installation/conda.rst b/src/doc/en/installation/conda.rst index 009c71946a7..8f1712ffa33 100644 --- a/src/doc/en/installation/conda.rst +++ b/src/doc/en/installation/conda.rst @@ -142,7 +142,7 @@ Here we assume that you are using a git checkout. $ pip install --no-build-isolation -v -v --editable ./pkgs/sage-conf_meson ./pkgs/sage-setup $ pip install --no-build-isolation --config-settings editable_mode=compat -v -v --editable ./src - In case of errors, try to use `sage-conf_conda` instead of `sage-conf_meson`, + In case of errors, try to use ``sage-conf_conda`` instead of ``sage-conf_meson``, and please report the problem by opening an issue on GitHub. - Verify that Sage has been installed:: From c0cdb5f95e1816cd31807c6687f7e6085e128b37 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Sat, 21 Oct 2023 15:44:14 +0000 Subject: [PATCH 08/15] add meson only in src env files --- bootstrap-conda | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-conda b/bootstrap-conda index ba007779b8a..d50e39499cc 100755 --- a/bootstrap-conda +++ b/bootstrap-conda @@ -95,10 +95,10 @@ echo >&2 $0:$LINENO: generate conda environment files for pkg in $BOOTSTRAP_SYSTEM_PACKAGES; do echo " - $pkg" done - echo " - meson" ) > environment-template.yml ( sed 's/name: sage-build/name: sage/' environment-template.yml + echo " - meson" echo " # Additional packages providing all dependencies for the Sage library" for pkg in $SAGELIB_SYSTEM_PACKAGES; do echo " - $pkg" From b40831138e67581b2dfb8639bdd42988c6d73b16 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Sat, 21 Oct 2023 15:49:09 +0000 Subject: [PATCH 09/15] keep configure around in the ci --- .github/workflows/ci-conda.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/ci-conda.yml b/.github/workflows/ci-conda.yml index ccafb4af359..2d29839367a 100644 --- a/.github/workflows/ci-conda.yml +++ b/.github/workflows/ci-conda.yml @@ -94,6 +94,14 @@ jobs: shell: bash -l {0} run: ./sage -t --all -p0 + # We keep this step for now to make sure that the configure-based setup still works. + - name: Test configure + run: + echo "::add-matcher::.github/workflows/configure-systempackage-problem-matcher.json" + ./configure --enable-build-as-root --with-python=$CONDA_PREFIX/bin/python --prefix=$CONDA_PREFIX --enable-system-site-packages $(for pkg in $(./sage -package list :standard: --has-file spkg-configure.m4 --has-file distros/conda.txt --exclude rpy2); do echo --with-system-$pkg=force; done) + echo "::remove-matcher owner=configure-system-package-warning::" + echo "::remove-matcher owner=configure-system-package-error::" + - name: Print logs if: always() run: | From f6f27d97c6183da3376ab36545d179e44f2ac7ac Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Sat, 21 Oct 2023 16:21:18 +0000 Subject: [PATCH 10/15] fix conda-ci --- .github/workflows/ci-conda.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-conda.yml b/.github/workflows/ci-conda.yml index 2d29839367a..df331cf99c0 100644 --- a/.github/workflows/ci-conda.yml +++ b/.github/workflows/ci-conda.yml @@ -96,7 +96,8 @@ jobs: # We keep this step for now to make sure that the configure-based setup still works. - name: Test configure - run: + shell: bash -l {0} + run: | echo "::add-matcher::.github/workflows/configure-systempackage-problem-matcher.json" ./configure --enable-build-as-root --with-python=$CONDA_PREFIX/bin/python --prefix=$CONDA_PREFIX --enable-system-site-packages $(for pkg in $(./sage -package list :standard: --has-file spkg-configure.m4 --has-file distros/conda.txt --exclude rpy2); do echo --with-system-$pkg=force; done) echo "::remove-matcher owner=configure-system-package-warning::" From 73e8c86be4048de55deb04e2c4f7ca2052a7efa0 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Wed, 25 Oct 2023 13:24:42 +0000 Subject: [PATCH 11/15] remove version specifier from setup.cfg --- pkgs/sage-conf/setup.cfg | 1 - 1 file changed, 1 deletion(-) diff --git a/pkgs/sage-conf/setup.cfg b/pkgs/sage-conf/setup.cfg index dac401c303d..06f36099bd5 100644 --- a/pkgs/sage-conf/setup.cfg +++ b/pkgs/sage-conf/setup.cfg @@ -1,6 +1,5 @@ [metadata] name = sage-conf -version = file: VERSION.txt description = Sage: Open Source Mathematics Software: Configuration module for the SageMath library long_description = file: README.rst license = GNU General Public License (GPL) v3 or later From 1b61d63ec4f65b43cd0288f7ed5209ce0a677a70 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Thu, 26 Oct 2023 01:36:07 +0000 Subject: [PATCH 12/15] increase version --- pkgs/sage-conf_meson/VERSION.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/sage-conf_meson/VERSION.txt b/pkgs/sage-conf_meson/VERSION.txt index e3fab2e6628..66f8b2a93e1 100644 --- a/pkgs/sage-conf_meson/VERSION.txt +++ b/pkgs/sage-conf_meson/VERSION.txt @@ -1 +1 @@ -10.2.beta7 +10.2.beta8 From 3ff66b8cd730e3d0192fce81efeb6ea1a6947534 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Sat, 28 Oct 2023 01:48:28 +0000 Subject: [PATCH 13/15] fix conf package --- .gitignore | 3 +++ pkgs/sage-conf_meson/.gitignore | 3 +-- pkgs/sage-conf_meson/_sage_conf | 1 - pkgs/sage-conf_meson/sage_conf.py | 6 ------ pkgs/sage-conf_meson/sage_conf/__init__.py | 4 ++++ pkgs/sage-conf_meson/setup.py | 19 +++++-------------- 6 files changed, 13 insertions(+), 23 deletions(-) delete mode 120000 pkgs/sage-conf_meson/_sage_conf delete mode 100644 pkgs/sage-conf_meson/sage_conf.py create mode 100644 pkgs/sage-conf_meson/sage_conf/__init__.py diff --git a/.gitignore b/.gitignore index 43f58abcafe..aa04337d12a 100644 --- a/.gitignore +++ b/.gitignore @@ -284,3 +284,6 @@ src/.coverage/ # git worktree worktree* **/worktree* + +# meson build directory +builddir diff --git a/pkgs/sage-conf_meson/.gitignore b/pkgs/sage-conf_meson/.gitignore index ff1f6bd336e..c345b916765 100644 --- a/pkgs/sage-conf_meson/.gitignore +++ b/pkgs/sage-conf_meson/.gitignore @@ -1,5 +1,4 @@ -/_sage_conf/_conf.py -/builddir +/sage_conf/builddir /build /dist /*.egg-info diff --git a/pkgs/sage-conf_meson/_sage_conf b/pkgs/sage-conf_meson/_sage_conf deleted file mode 120000 index d92a91bef8c..00000000000 --- a/pkgs/sage-conf_meson/_sage_conf +++ /dev/null @@ -1 +0,0 @@ -../sage-conf/_sage_conf \ No newline at end of file diff --git a/pkgs/sage-conf_meson/sage_conf.py b/pkgs/sage-conf_meson/sage_conf.py deleted file mode 100644 index 1b09bb76a83..00000000000 --- a/pkgs/sage-conf_meson/sage_conf.py +++ /dev/null @@ -1,6 +0,0 @@ -from _sage_conf.__main__ import _main - -from builddir._conf import * -from builddir.build_info import CONDA_PREFIX, SAGE_ROOT - -SAGE_LOCAL = CONDA_PREFIX diff --git a/pkgs/sage-conf_meson/sage_conf/__init__.py b/pkgs/sage-conf_meson/sage_conf/__init__.py new file mode 100644 index 00000000000..bcc9d7d2393 --- /dev/null +++ b/pkgs/sage-conf_meson/sage_conf/__init__.py @@ -0,0 +1,4 @@ +from .builddir._conf import * +from .builddir.build_info import CONDA_PREFIX + +SAGE_LOCAL = CONDA_PREFIX diff --git a/pkgs/sage-conf_meson/setup.py b/pkgs/sage-conf_meson/setup.py index 34ce471d429..5af1f5bae4e 100644 --- a/pkgs/sage-conf_meson/setup.py +++ b/pkgs/sage-conf_meson/setup.py @@ -1,13 +1,12 @@ import os import sys -from distutils.command.build_scripts import \ - build_scripts as distutils_build_scripts from pathlib import Path from setuptools import setup from setuptools.command.build_py import build_py as setuptools_build_py -from setuptools.command.editable_wheel import \ - editable_wheel as setuptools_editable_wheel +from setuptools.command.editable_wheel import ( + editable_wheel as setuptools_editable_wheel, +) from setuptools.errors import SetupError @@ -26,7 +25,7 @@ def run(self): 'See https://doc.sagemath.org/html/en/installation/conda.html on how to get started.' ) - builddir = here / "builddir" + builddir = here / "sage_conf" / "builddir" cmd = f"cd {root} && meson setup {builddir} --wipe" print(f"Running {cmd}") sys.stdout.flush() @@ -39,14 +38,6 @@ def run(self): build_info.write(f'CONDA_PREFIX = "{conda_prefix}"\n') -class build_scripts(distutils_build_scripts): - def run(self): - self.distribution.scripts.append(os.path.join('bin', 'sage-env-config')) - if not self.distribution.entry_points: - self.entry_points = self.distribution.entry_points = dict() - distutils_build_scripts.run(self) - - class editable_wheel(setuptools_editable_wheel): r""" Customized so that exceptions raised by our build_py @@ -57,6 +48,6 @@ class editable_wheel(setuptools_editable_wheel): setup( cmdclass=dict( - build_py=build_py, build_scripts=build_scripts, editable_wheel=editable_wheel + build_py=build_py, editable_wheel=editable_wheel ) ) From 6c78eaaaf16debd9893289b51cace3ce40a6e8fe Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Sat, 28 Oct 2023 01:49:35 +0000 Subject: [PATCH 14/15] ignore errors of configure in ci --- .github/workflows/ci-conda.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/ci-conda.yml b/.github/workflows/ci-conda.yml index df331cf99c0..2a8adcb7149 100644 --- a/.github/workflows/ci-conda.yml +++ b/.github/workflows/ci-conda.yml @@ -98,10 +98,7 @@ jobs: - name: Test configure shell: bash -l {0} run: | - echo "::add-matcher::.github/workflows/configure-systempackage-problem-matcher.json" - ./configure --enable-build-as-root --with-python=$CONDA_PREFIX/bin/python --prefix=$CONDA_PREFIX --enable-system-site-packages $(for pkg in $(./sage -package list :standard: --has-file spkg-configure.m4 --has-file distros/conda.txt --exclude rpy2); do echo --with-system-$pkg=force; done) - echo "::remove-matcher owner=configure-system-package-warning::" - echo "::remove-matcher owner=configure-system-package-error::" + ./configure --enable-build-as-root --with-python=$CONDA_PREFIX/bin/python --prefix=$CONDA_PREFIX --enable-system-site-packages $(for pkg in $(./sage -package list :standard: --has-file spkg-configure.m4 --has-file distros/conda.txt --exclude rpy2); do echo --with-system-$pkg=force; done) || true - name: Print logs if: always() From d9e0d49bf4798a1e1ac904cb988b2aaab02882f3 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Sat, 28 Oct 2023 04:43:08 +0000 Subject: [PATCH 15/15] move config stuff to meson file in pkgs --- meson.build | 36 ++-------------------- pkgs/sage-conf_meson/meson.build | 32 +++++++++++++++++++ pkgs/sage-conf_meson/sage_conf/__init__.py | 7 ++++- 3 files changed, 41 insertions(+), 34 deletions(-) create mode 100644 pkgs/sage-conf_meson/meson.build diff --git a/meson.build b/meson.build index 5cfb720d243..ffd4348aa4c 100644 --- a/meson.build +++ b/meson.build @@ -1,40 +1,10 @@ project('sage', 'c') cc = meson.get_compiler('c') -conf_data = configuration_data() - -conf_data.set('PACKAGE_VERSION', '1.2.3') maxima = find_program('maxima', required: true) -conf_data.set('SAGE_MAXIMA', maxima.path()) -# Conda's ecl does not have any problems with Maxima, so nothing needs to be set here: -conf_data.set('SAGE_MAXIMA_FAS', '') - -# Kenzo cannot yet be provided by the system, so we always use the SAGE_LOCAL path for now. -conf_data.set('SAGE_KENZO_FAS', '\'${prefix}\'/lib/ecl/kenzo.fas') - -conf_data.set('SAGE_ARB_LIBRARY', 'arb') - -#ntl = dependency('ntl', required: true) doesn't work, so ask the compiler directly: -ntl = cc.find_library('ntl', required: true) -# It can be found, so we don't have to set anything here: -conf_data.set('NTL_INCDIR', '') -conf_data.set('NTL_LIBDIR', '') - ecl_config = find_program('ecl-config', required: true) -conf_data.set('SAGE_ECL_CONFIG', ecl_config.path()) - -conf_data.set('SAGE_ARCHFLAGS', 'unset') - -# not needed when using conda, as we then don't build any pc files -conf_data.set('SAGE_PKG_CONFIG_PATH', '') - openmp = dependency('openmp', required : false) -if openmp.found() - conf_data.set('OPENMP_CFLAGS', '-fopenmp') - conf_data.set('OPENMP_CXXFLAGS', '-fopenmp') -endif - -configure_file(input : 'pkgs/sage-conf_conda/_sage_conf/_conf.py.in', - output : '_conf.py', - configuration : conf_data) +#ntl = dependency('ntl', required: true) doesn't work, so ask the compiler directly: +ntl = cc.find_library('ntl', required: true) +subdir('pkgs/sage-conf_meson') diff --git a/pkgs/sage-conf_meson/meson.build b/pkgs/sage-conf_meson/meson.build new file mode 100644 index 00000000000..852eb4c0607 --- /dev/null +++ b/pkgs/sage-conf_meson/meson.build @@ -0,0 +1,32 @@ +conf_data = configuration_data() + +conf_data.set('PACKAGE_VERSION', '1.2.3') + +conf_data.set('SAGE_MAXIMA', maxima.path()) +# Conda's ecl does not have any problems with Maxima, so nothing needs to be set here: +conf_data.set('SAGE_MAXIMA_FAS', '') + +# Kenzo cannot yet be provided by the system, so we always use the SAGE_LOCAL path for now. +conf_data.set('SAGE_KENZO_FAS', '\'${prefix}\'/lib/ecl/kenzo.fas') + +conf_data.set('SAGE_ARB_LIBRARY', 'arb') + +# It can be found, so we don't have to set anything here: +conf_data.set('NTL_INCDIR', '') +conf_data.set('NTL_LIBDIR', '') + +conf_data.set('SAGE_ECL_CONFIG', ecl_config.path()) + +conf_data.set('SAGE_ARCHFLAGS', 'unset') + +# not needed when using conda, as we then don't build any pc files +conf_data.set('SAGE_PKG_CONFIG_PATH', '') + +if openmp.found() + conf_data.set('OPENMP_CFLAGS', '-fopenmp') + conf_data.set('OPENMP_CXXFLAGS', '-fopenmp') +endif + +configure_file(input : '../sage-conf_conda/_sage_conf/_conf.py.in', + output : '_conf.py', + configuration : conf_data) diff --git a/pkgs/sage-conf_meson/sage_conf/__init__.py b/pkgs/sage-conf_meson/sage_conf/__init__.py index bcc9d7d2393..ab98a51f0c6 100644 --- a/pkgs/sage-conf_meson/sage_conf/__init__.py +++ b/pkgs/sage-conf_meson/sage_conf/__init__.py @@ -1,4 +1,9 @@ -from .builddir._conf import * +import importlib + from .builddir.build_info import CONDA_PREFIX +conf = importlib.import_module('.builddir.pkgs.sage-conf_meson._conf', 'sage_conf') +conf_options = [x for x in conf.__dict__ if not x.startswith("_")] +globals().update({k: getattr(conf, k) for k in conf_options}) + SAGE_LOCAL = CONDA_PREFIX