-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetup.py
executable file
·81 lines (66 loc) · 2.27 KB
/
setup.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import os
from distutils import log
from setuptools import setup
from setuptools.command.install import install
kernel_json = {"argv":["python3","-m","mochikernel", "-f", "{connection_file}"],
"display_name":"Mochi",
"language":"python",
"codemirror_mode":"python"
}
readme = open('README.rst').read()
history = open('HISTORY.rst').read().replace('.. :changelog:', '')
requirements = [
# TODO: put package requirements here
]
test_requirements = [
# TODO: put package test requirements here
]
#stolen from bash kernel
class install_with_kernelspec(install):
def run(self):
# Regular installation
install.run(self)
# Now write the kernelspec
from IPython.kernel.kernelspec import install_kernel_spec
from IPython.utils.tempdir import TemporaryDirectory
with TemporaryDirectory() as td:
os.chmod(td, 0o755) # Starts off as 700, not user readable
with open(os.path.join(td, 'kernel.json'), 'w') as f:
json.dump(kernel_json, f, sort_keys=True)
# TODO: Copy resources once they're specified
log.info('Installing IPython kernel spec')
install_kernel_spec(td, 'mochi', user=True, replace=True)
setup(
name='mochikernel',
version='0.2.2',
description='An IPython kernel for Mochi',
long_description=readme + '\n\n' + history,
author='Matthias Bussonnier, Mike Müller',
author_email='[email protected], [email protected]',
url='https://github.com/Carreau/mochi-kernel',
packages=[
'mochikernel',
],
package_dir={'mochikernel':
'mochikernel'},
include_package_data=True,
install_requires=requirements,
license="BSD",
zip_safe=False,
keywords='mochikernel',
cmdclass={'install': install_with_kernelspec},
classifiers=[
'Development Status :: 2 - Pre-Alpha',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Natural Language :: English',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
],
test_suite='tests',
tests_require=test_requirements
)