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

Commit

Permalink
sage_setup.command.sage_install.sage_install: Rename to sage_install_…
Browse files Browse the repository at this point in the history
…and_clean, update use it in src/setup.py; refactor through new class sage_install
  • Loading branch information
Matthias Koeppe committed Sep 15, 2020
1 parent 1d88afe commit e83725f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions build/pkgs/sagelib/src/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
print("Discovered Python/Cython sources, time: %.2f seconds." % (time.time() - t))


from sage_setup.command.sage_install import sage_install
from sage_setup.command.sage_install import sage_install_and_clean

#########################################################
### Distutils
Expand Down Expand Up @@ -177,5 +177,5 @@
cmdclass = dict(build=sage_build,
build_cython=sage_build_cython,
build_ext=sage_build_ext,
install=sage_install),
install=sage_install_and_clean),
ext_modules = cython_modules)
9 changes: 9 additions & 0 deletions src/sage_setup/command/sage_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from distutils.command.install import install

class sage_install(install):

def run(self):
install.run(self)
self.install_kernel_spec()
Expand All @@ -31,6 +32,14 @@ def install_kernel_spec(self):
# the install_data directory for installing our Jupyter files.
SageKernelSpec.update(prefix=self.install_data)

class sage_install_and_clean(sage_install):

def run(self):
sage_install.run(self)
t = time.time()
self.clean_stale_files()
log.info('Finished cleaning, time: %.2f seconds.' % (time.time() - t))

def clean_stale_files(self):
"""
Remove stale installed files.
Expand Down
3 changes: 1 addition & 2 deletions src/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,5 @@
cmdclass = dict(build=sage_build,
build_cython=sage_build_cython,
build_ext=sage_build_ext,
#install=sage_install
),
install=sage_install),
ext_modules = cython_modules)

0 comments on commit e83725f

Please sign in to comment.