diff --git a/setup.py b/setup.py index 237e83a..85399d4 100755 --- a/setup.py +++ b/setup.py @@ -4,6 +4,7 @@ from glob import glob from setuptools import setup, Extension from setuptools.command.bdist_egg import bdist_egg as _bdist_egg +from subprocess import Popen, PIPE kernelpath = os.path.join("share", "jupyter", "kernels", "pari_jupyter") nbextpath = os.path.join("share", "jupyter", "nbextensions", "gp-mode") @@ -20,18 +21,17 @@ ext = ".pyx" cmdclass = dict(build_ext=build_ext) -extensions = [Extension("PARIKernel.kernel", ["PARIKernel/kernel"+ext], libraries=["pari", "readline"]), - Extension("PARIKernel.io", ["PARIKernel/io"+ext], libraries=["pari"])] +extensions = [Extension("PARIKernel.kernel", ["PARIKernel/kernel" + ext], libraries=["pari", "readline"]), + Extension("PARIKernel.io", ["PARIKernel/io" + ext], libraries=["pari"])] # Are SVG graphics available? -from subprocess import Popen, PIPE gp = Popen("gp -f -q", shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE) gp.communicate(b'''iferr(install(pari_set_plot_engine, "vL"), E, quit(1));''') HAVE_SVG = (gp.wait() == 0) if HAVE_SVG: - ext = Extension("PARIKernel.svg", ["PARIKernel/svg"+ext], libraries=["pari"]) + ext = Extension("PARIKernel.svg", ["PARIKernel/svg" + ext], libraries=["pari"]) extensions.append(ext) @@ -40,6 +40,7 @@ def run(self): from distutils.errors import DistutilsOptionError raise DistutilsOptionError("The package pari-jupyter will not function correctly when built as egg. Therefore, it cannot be installed using 'python setup.py install' or 'easy_install'. Instead, use 'pip install' to install this package.") + cmdclass['bdist_egg'] = no_egg @@ -49,6 +50,6 @@ def run(self): data_files=[(kernelpath, glob("spec/*")), (nbextpath, glob("gp-mode/*")), (nbconfpath, ["gp-mode.json"]), - ], + ], cmdclass=cmdclass, ) diff --git a/test/test_pari_jupyter_kernel.py b/test/test_pari_jupyter_kernel.py index efb38f0..c011715 100644 --- a/test/test_pari_jupyter_kernel.py +++ b/test/test_pari_jupyter_kernel.py @@ -6,6 +6,7 @@ import unittest import jupyter_kernel_test as jkt + class PARIKernelTests(jkt.KernelTests): # REQUIRED @@ -98,5 +99,6 @@ class PARIKernelTests(jkt.KernelTests): # the client # code_clear_output = "from IPython.display import clear_output; clear_output()" + if __name__ == '__main__': unittest.main(verbosity=2)