You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.6 KiB
Python

from distutils.core import setup
from distutils.command.install import install
import json
import os.path
import sys
kernel_json = {"argv":[sys.executable,"-m","bash_kernel", "-f", "{connection_file}"],
"display_name":"Bash",
"language":"bash",
"codemirror_mode":"shell"
}
class install_with_kernelspec(install):
def run(self):
# Regular installation
install.run(self)
# Now write the kernelspec
from IPython.kernel.kernelspec import KernelSpecManager
from IPython.utils.path import ensure_dir_exists
destdir = os.path.join(KernelSpecManager().user_kernel_dir, 'bash')
ensure_dir_exists(destdir)
with open(os.path.join(destdir, 'kernel.json'), 'w') as f:
json.dump(kernel_json, f, sort_keys=True)
# TODO: Copy resources once they're specified
with open('README.rst') as f:
readme = f.read()
svem_flag = '--single-version-externally-managed'
if svem_flag in sys.argv:
# Die, setuptools, die.
sys.argv.remove(svem_flag)
setup(name='bash_kernel',
version='0.2',
description='A bash kernel for IPython',
long_description=readme,
author='Thomas Kluyver',
author_email='thomas@kluyver.me.uk',
url='https://github.com/takluyver/bash_kernel',
py_modules=['bash_kernel'],
cmdclass={'install': install_with_kernelspec},
install_requires=['pexpect>=3.3'],
classifiers = [
'Framework :: IPython',
'License :: OSI Approved :: BSD License',
'Programming Language :: Python :: 3',
'Topic :: System :: Shells',
]
)