|
1 | 1 | # -*- coding: utf-8 -*-
|
2 | 2 |
|
3 | 3 | from __future__ import print_function
|
4 |
| -from setuptools import setup, find_packages |
5 | 4 | import os
|
6 | 5 | import sys
|
7 | 6 |
|
8 | 7 | from setupbase import (
|
| 8 | + setup, |
| 9 | + log, |
9 | 10 | create_cmdclass,
|
10 | 11 | install_npm,
|
| 12 | + combine_commands, |
| 13 | + ensure_targets, |
| 14 | + get_version, |
11 | 15 | )
|
12 | 16 |
|
13 | 17 |
|
14 |
| -from distutils import log |
15 | 18 | log.set_verbosity(log.DEBUG)
|
16 | 19 | log.info('setup.py entered')
|
17 | 20 | log.info('$PATH=%s' % os.environ['PATH'])
|
18 | 21 |
|
19 | 22 | LONG_DESCRIPTION = 'A Python/ThreeJS bridge utilizing the Jupyter widget infrastructure.'
|
20 | 23 |
|
21 |
| - |
22 | 24 | here = os.path.abspath(os.path.dirname(sys.argv[0]))
|
| 25 | +name = 'pythreejs' |
| 26 | +version = get_version(os.path.join(here, name, '_version.py')) |
23 | 27 |
|
24 | 28 |
|
25 |
| -version_ns = {} |
26 |
| -with open(os.path.join(here, 'pythreejs', '_version.py')) as f: |
27 |
| - exec(f.read(), {}, version_ns) |
28 |
| - |
29 |
| - |
30 |
| -cmdclass = create_cmdclass(['js']) |
31 |
| -cmdclass['js'] = install_npm( |
32 |
| - path=os.path.join(here, 'js'), |
33 |
| - build_dir=os.path.join(here, 'pythreejs', 'static'), |
34 |
| - source_dir=os.path.join(here, 'js'), |
| 29 | +cmdclass = create_cmdclass('js', |
| 30 | + data_files_spec=[ |
| 31 | + ('share/jupyter/nbextensions/jupyter-threejs', [ |
| 32 | + name + '/static/*.js', |
| 33 | + name + '/static/*.js.map', |
| 34 | + ]), |
| 35 | + ], |
| 36 | +) |
| 37 | +cmdclass['js'] = combine_commands( |
| 38 | + install_npm( |
| 39 | + path=os.path.join(here, 'js'), |
| 40 | + build_dir=os.path.join(here, name, 'static'), |
| 41 | + source_dir=os.path.join(here, 'js'), |
| 42 | + ), |
| 43 | + ensure_targets([ |
| 44 | + name + '/static/extension.js', |
| 45 | + name + '/static/index.js', |
| 46 | + 'js/src/core/BufferAttribute.autogen.js', |
| 47 | + name + '/core/BufferAttribute_autogen.py', |
| 48 | + ]), |
35 | 49 | )
|
36 | 50 |
|
37 | 51 | setup_args = {
|
38 |
| - 'name': 'pythreejs', |
39 |
| - 'version': version_ns['__version__'], |
| 52 | + 'name': name, |
| 53 | + 'version': version, |
40 | 54 | 'description': 'Interactive 3d graphics for the Jupyter notebook, using Three.js from Jupyter interactive widgets.',
|
41 | 55 | 'long_description': LONG_DESCRIPTION,
|
42 | 56 | 'license': 'BSD',
|
43 | 57 | 'include_package_data': True,
|
44 |
| - 'data_files': [ |
45 |
| - ('share/jupyter/nbextensions/jupyter-threejs', [ |
46 |
| - 'pythreejs/static/extension.js', |
47 |
| - 'pythreejs/static/index.js', |
48 |
| - 'pythreejs/static/index.js.map', |
49 |
| - ]), |
50 |
| - ], |
51 | 58 | 'install_requires': [
|
52 | 59 | 'ipywidgets>=7,<8',
|
53 | 60 | 'ipydatawidgets>=1.1.1',
|
|
64 | 71 | 'scikit-image'
|
65 | 72 | ],
|
66 | 73 | },
|
67 |
| - 'packages': ['pythreejs'], # Manually specify here, update after autogen |
| 74 | + 'packages': [name], # Manually specify here, update after autogen |
68 | 75 | 'zip_safe': False,
|
69 | 76 | 'cmdclass': cmdclass,
|
70 | 77 | 'author': 'PyThreejs Development Team',
|
|
0 commit comments