From 32eb8d990833bd2df0521fb24253a2077aec4f6d Mon Sep 17 00:00:00 2001 From: Dima Pasechnik Date: Wed, 27 Aug 2025 11:30:35 -0500 Subject: [PATCH 1/2] configure installs jupyter kerneldata to SAGE_LOCAL/share As well, we make consistent use of PACKAGE_VERSION (instead of SAGE_VERSION) in meson, and rename PACKAGE_VERSION in meson.build's to something more descriptive and non-clashing --- configure.ac | 5 +++++ src/sage/ext_data/notebook-ipython/kernel.json.in | 2 +- src/sage/meson.build | 4 ++-- subprojects/packagefiles/mpfi/meson.build | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index ebfba2433b1..fc274ef5b5a 100644 --- a/configure.ac +++ b/configure.ac @@ -575,6 +575,11 @@ AC_CONFIG_FILES([src/bin/sage-env-config src/bin/sage-src-env-config build/bin/s AC_CONFIG_FILES([pkgs/sage-conf/_sage_conf/_conf.py]) +# install jupyter kernel data +AC_CONFIG_FILES([$SAGE_LOCAL/share/notebook/kernel.json:src/sage/ext_data/notebook-ipython/kernel.json.in] + [$SAGE_LOCAL/share/notebook/logo.svg:src/sage/ext_data/notebook-ipython/logo.svg] + [$SAGE_LOCAL/share/notebook/logo-64x64.png:src/sage/ext_data/notebook-ipython/logo-64x64.png]) + dnl Create basic directories needed for Sage AC_CONFIG_COMMANDS(mkdirs, [ diff --git a/src/sage/ext_data/notebook-ipython/kernel.json.in b/src/sage/ext_data/notebook-ipython/kernel.json.in index 9bc28103240..e664e93429c 100644 --- a/src/sage/ext_data/notebook-ipython/kernel.json.in +++ b/src/sage/ext_data/notebook-ipython/kernel.json.in @@ -6,6 +6,6 @@ "-f", "{connection_file}" ], - "display_name": "SageMath @SAGE_VERSION@", + "display_name": "SageMath @PACKAGE_VERSION@", "language": "sage" } diff --git a/src/sage/meson.build b/src/sage/meson.build index d1d15cf6895..bff99e48da0 100644 --- a/src/sage/meson.build +++ b/src/sage/meson.build @@ -2,7 +2,7 @@ sage_install_dir = py.get_install_dir() / 'sage' # Generate the configuration file conf_data = configuration_data() -conf_data.set('PACKAGE_VERSION', '1.2.3') +conf_data.set('SAGE_MESON_PKG_VERSION', '1.2.3') # We use Python's prefix here to make it work with conda prefix = fs.as_posix(py.get_variable('prefix', '')) conf_data.set('prefix', prefix) @@ -144,7 +144,7 @@ kernel_dir = get_option('datadir') / 'share/jupyter/kernels/sagemath' install_data('ext_data/notebook-ipython/logo.svg', install_dir: kernel_dir) install_data('ext_data/notebook-ipython/logo-64x64.png', install_dir: kernel_dir) kernel_data = configuration_data() -kernel_data.set('SAGE_VERSION', meson.project_version()) +kernel_data.set('PACKAGE_VERSION', meson.project_version()) configure_file( input: 'ext_data/notebook-ipython/kernel.json.in', output: 'kernel.json', diff --git a/subprojects/packagefiles/mpfi/meson.build b/subprojects/packagefiles/mpfi/meson.build index 82c93a70ac2..8fe1820a7e5 100644 --- a/subprojects/packagefiles/mpfi/meson.build +++ b/subprojects/packagefiles/mpfi/meson.build @@ -12,7 +12,7 @@ mpfr = dependency('mpfr', version: '>= 4.0.1') # Configuration data conf = configuration_data() -conf.set('PACKAGE_VERSION', '"' + meson.project_version() + '"') +conf.set('SAGE_MESON_PKG_VERSION', '"' + meson.project_version() + '"') # Check for functions conf.set('HAVE_DUP2', c.has_function('dup2') ? 1 : 0) conf.set('HAVE_GETTIMEOFDAY', c.has_function('gettimeofday') ? 1 : 0) From 7df743004e7872a6fdb7a68a6662e4ee5b3040a8 Mon Sep 17 00:00:00 2001 From: Dima Pasechnik Date: Wed, 27 Aug 2025 11:47:10 -0500 Subject: [PATCH 2/2] install jupyter kernel data to the venv --- build/pkgs/sagelib/spkg-install.in | 1 + 1 file changed, 1 insertion(+) diff --git a/build/pkgs/sagelib/spkg-install.in b/build/pkgs/sagelib/spkg-install.in index 5c78e3459c8..254da23d02a 100644 --- a/build/pkgs/sagelib/spkg-install.in +++ b/build/pkgs/sagelib/spkg-install.in @@ -54,6 +54,7 @@ if [ "$SAGE_EDITABLE" = yes ]; then # Additionally build a wheel (for use in other venvs) cd $SAGE_PKGS/sagelib/src && time sdh_build_and_store_wheel --no-build-isolation . fi + jupyter kernelspec install --name=sagemath --sys-prefix $SAGE_LOCAL/share/notebook else # Now implied: "$SAGE_WHEELS" = yes # We should remove the egg-link that may have been installed previously.