From 4473375c4a90dcb47c6c459cd9117f1571730bc3 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 18 May 2022 09:53:56 -0700 Subject: [PATCH] src/sage_setup/command/sage_install.py: Add sage_develop, use it in src/setup.py, pkgs/sagemath-standard/setup.py --- build/pkgs/sage_setup/dependencies | 2 +- pkgs/sagemath-standard/setup.py | 3 ++- src/sage_setup/command/sage_install.py | 21 +++++++++++++++++---- src/setup.py | 5 ++--- 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/build/pkgs/sage_setup/dependencies b/build/pkgs/sage_setup/dependencies index d99d4aed55e..3f2349474ac 100644 --- a/build/pkgs/sage_setup/dependencies +++ b/build/pkgs/sage_setup/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) cython pkgconfig $(SAGE_ROOT)/pkgs/sage-setup/sage_setup/autogen/interpreters/specs/*.py | $(PYTHON_TOOLCHAIN) +$(PYTHON) cython pkgconfig $(SAGE_ROOT)/pkgs/sage-setup/sage_setup/autogen/interpreters/specs/*.py $(SAGE_ROOT)/pkgs/sage-setup/sage_setup/command/*.py | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. diff --git a/pkgs/sagemath-standard/setup.py b/pkgs/sagemath-standard/setup.py index 8d3ed741c3f..7ac2294b609 100755 --- a/pkgs/sagemath-standard/setup.py +++ b/pkgs/sagemath-standard/setup.py @@ -47,11 +47,12 @@ from sage_setup.command.sage_build import sage_build from sage_setup.command.sage_build_cython import sage_build_cython from sage_setup.command.sage_build_ext import sage_build_ext - from sage_setup.command.sage_install import sage_install_and_clean + from sage_setup.command.sage_install import sage_develop, sage_install_and_clean cmdclass = dict(build=sage_build, build_cython=sage_build_cython, build_ext=sage_build_ext, + develop=sage_develop, install=sage_install_and_clean) ######################################################### diff --git a/src/sage_setup/command/sage_install.py b/src/sage_setup/command/sage_install.py index 65cd69ce700..74f580a3091 100644 --- a/src/sage_setup/command/sage_install.py +++ b/src/sage_setup/command/sage_install.py @@ -11,12 +11,10 @@ from distutils import log from distutils.command.install import install +from setuptools.command.develop import develop -class sage_install(install): - def run(self): - install.run(self) - self.install_kernel_spec() +class install_kernel_spec_mixin: def install_kernel_spec(self): """ @@ -34,6 +32,21 @@ def install_kernel_spec(self): SageKernelSpec.update(prefix=self.install_data) +class sage_install(install, install_kernel_spec_mixin): + + def run(self): + install.run(self) + self.install_kernel_spec() + + +class sage_develop(develop, install_kernel_spec_mixin): + + def run(self): + develop.run(self) + if not self.uninstall: + self.install_kernel_spec() + + class sage_clean(install): def run(self): diff --git a/src/setup.py b/src/setup.py index 2e8659d15da..0533fa44096 100755 --- a/src/setup.py +++ b/src/setup.py @@ -6,8 +6,6 @@ ## Distribution packaging should use build/pkgs/sagelib/src/setup.py ## instead. -from __future__ import print_function - import os import platform import sys @@ -23,7 +21,7 @@ from sage.misc.package import is_package_installed_and_updated from sage_setup.command.sage_build_ext_minimal import sage_build_ext_minimal -from sage_setup.command.sage_install import sage_install +from sage_setup.command.sage_install import sage_develop, sage_install from sage_setup.find import filter_cython_sources from sage_setup.cython_options import compiler_directives, compile_time_env_variables from sage_setup.extensions import create_extension @@ -126,6 +124,7 @@ packages=python_packages, cmdclass={ "build_ext": sage_build_ext_minimal, + "develop": sage_develop, "install": sage_install, }, ext_modules=extensions