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

Commit

Permalink
src/sage_setup/command/sage_install.py: Add sage_develop, use it in s…
Browse files Browse the repository at this point in the history
…rc/setup.py, pkgs/sagemath-standard/setup.py
  • Loading branch information
Matthias Koeppe committed May 18, 2022
1 parent 6c5903d commit 4473375
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 9 deletions.
2 changes: 1 addition & 1 deletion build/pkgs/sage_setup/dependencies
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
3 changes: 2 additions & 1 deletion pkgs/sagemath-standard/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

#########################################################
Expand Down
21 changes: 17 additions & 4 deletions src/sage_setup/command/sage_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand All @@ -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):
Expand Down
5 changes: 2 additions & 3 deletions src/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -126,6 +124,7 @@
packages=python_packages,
cmdclass={
"build_ext": sage_build_ext_minimal,
"develop": sage_develop,
"install": sage_install,
},
ext_modules=extensions
Expand Down

0 comments on commit 4473375

Please sign in to comment.