-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
setup.py
72 lines (60 loc) · 1.92 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
from distutils.core import Command
from setuptools import setup
from subprocess import check_output
from wheel.bdist_wheel import bdist_wheel
import os
VERSION = "0.7a0"
ROOT = os.path.dirname(os.path.abspath(__file__))
def get_long_description():
with open(
os.path.join(os.path.dirname(os.path.abspath(__file__)), "README.md"),
encoding="utf8",
) as fp:
return fp.read()
class BdistWheelWithBuildStatic(bdist_wheel):
def run(self):
self.run_command("build_static")
return bdist_wheel.run(self)
class BuildStatic(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
check_output(["npm", "install"], cwd=ROOT)
check_output(["npm", "run", "build"], cwd=ROOT)
check_output(["mkdir", "-p", "datasette_vega/static"], cwd=ROOT)
check_output(
"mv build/static/js/* datasette_vega/static/", shell=True, cwd=ROOT
)
check_output(
"mv build/static/css/* datasette_vega/static/", shell=True, cwd=ROOT
)
setup(
name="datasette-vega",
description="A Datasette plugin that provides tools for generating charts using Vega",
long_description=get_long_description(),
long_description_content_type="text/markdown",
author="Simon Willison",
url="https://github.com/simonw/datasette-vega",
license="Apache License, Version 2.0",
version=VERSION,
packages=["datasette_vega"],
entry_points={
"datasette": ["vega = datasette_vega"],
},
package_data={
"datasette_vega": [
"static/*.js",
"static/*.css",
"static/*.map",
],
},
cmdclass={
"bdist_wheel": BdistWheelWithBuildStatic,
"build_static": BuildStatic,
},
install_requires=["datasette"],
extras_require={"test": ["pytest", "pytest-asyncio", "httpx"]},
)