forked from vaexio/vaex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
92 lines (80 loc) · 2.89 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
82
83
84
85
86
87
88
89
90
91
92
from setuptools import setup
from setuptools.command.develop import develop
from setuptools.command.install import install
import pip
import os
import sys
import contextlib
@contextlib.contextmanager
def cwd(path):
curdir = os.getcwd()
try:
os.chdir(path)
yield
finally:
os.chdir(curdir)
# inspired by https://blog.shazam.com/python-microlibs-5be9461ad979
packages = ['vaex-core', 'vaex-viz', 'vaex-hdf5', 'vaex-server', 'vaex-astro', 'vaex-ui', 'vaex-jupyter', 'vaex-ml', 'vaex-meta', 'vaex-graphql', 'vaex-contrib']
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
class DevelopCmd(develop):
def run(self):
relative = os.path.abspath(os.path.join('packages', 'vaex-core', 'vaex'))
for package in packages:
with cwd(os.path.join('packages', package)):
err = os.system('python -m pip install -e .')
if err:
raise RuntimeError(f'Oops, failed to install {package}')
# we need to make symbolic links from vaex-core/vaex/<name> to vaex-<name>/vaex/<name>
# otherwise development install do not work
if package not in ['vaex-core']:
name = package.split('-')[1]
source = os.path.abspath(os.path.join('packages', package, 'vaex', name))
rel_source = os.path.relpath(source, relative)
with cwd(relative):
print('symlinking', source, name, rel_source)
if os.path.exists(name) and os.readlink(name) == rel_source:
print('symlink ok')
else:
if os.path.exists(name):
print('old symlink', os.readlink(name))
os.remove(name)
os.symlink(rel_source, name)
class InstallCmd(install):
""" Add custom steps for the install command """
def run(self):
for package in packages:
with cwd(os.path.join('packages', package)):
os.system('python -m pip install --no-deps .')
for package in packages:
with cwd(os.path.join('packages', package)):
os.system('python -m pip install --upgrade .')
setup(
name='vaex-meta',
version="0.1.0",
description="Convenience setup.py for when installing from the git repo",
classifiers=[
'Private :: Do Not Upload to pypi server',
],
install_requires=[
'pip',
],
extras_require={
'dev': [
'pytest',
'gcsfs',
's3fs',
'graphviz',
'myst_parser',
# For generating the documentation
'sphinx',
'nbsphinx',
'sphinx_gallery',
'sphinx_sitemap',
'sphinx_book_theme',
]
},
cmdclass={
'install': InstallCmd,
'develop': DevelopCmd,
},
)