-
-
Notifications
You must be signed in to change notification settings - Fork 578
/
Copy pathsage_install.py
47 lines (33 loc) · 1.31 KB
/
sage_install.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#########################################################
### Install Jupyter kernel spec
#########################################################
import os
import time
# Import setuptools before importing distutils, so that setuptools
# can replace distutils by its own vendored copy.
import setuptools
from distutils import log
from distutils.command.install import install
from setuptools.command.develop import develop
class install_kernel_spec_mixin:
def install_kernel_spec(self):
"""
Install the Jupyter kernel spec.
.. NOTE::
The files are generated, not copied. Therefore, we cannot
use ``data_files`` for this.
"""
from sage.repl.ipython_kernel.install import SageKernelSpec
# Jupyter packages typically use the data_files option to
# setup() to install kernels and nbextensions. So we should use
# the install_data directory for installing our Jupyter files.
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()