forked from tartiflette/tartiflette
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
94 lines (72 loc) · 2.45 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
93
94
import subprocess
import os
import sys
from setuptools import find_packages, setup
from setuptools.command.build_ext import build_ext
from setuptools.command.build_py import build_py
def _find_libgraphqlparser_artifact():
if os.path.exists("./libgraphqlparser/libgraphqlparser.so"):
return "./libgraphqlparser/libgraphqlparser.so"
if os.path.exists("./libgraphqlparser/libgraphqlparser.dylib"):
return "./libgraphqlparser/libgraphqlparser.dylib"
return None
def _build_libgraphqlparser():
os.chdir("./libgraphqlparser/.")
subprocess.run(["cmake", "."], stdout=subprocess.PIPE)
subprocess.run(["make"], stdout=subprocess.PIPE)
os.chdir("..")
artifact_path = _find_libgraphqlparser_artifact()
if not artifact_path:
print("Libgraphqlparser compilation has failed")
sys.exit(-1)
os.rename(
artifact_path,
"tartiflette/parser/cffi/%s" % os.path.basename(artifact_path),
)
class BuildExtCmd(build_ext):
def run(self):
_build_libgraphqlparser()
build_ext.run(self)
class BuildPyCmd(build_py):
def run(self):
_build_libgraphqlparser()
build_py.run(self)
_TEST_REQUIRE = [
"pytest==4.1.1",
"pytest-cov==2.6.1",
"pytest-asyncio==0.10.0",
"pytest-xdist",
"pylint==2.3.0",
"xenon",
"black==18.9b0",
"isort==4.3.4",
]
_BENCHMARK_REQUIRE = ["pytest-benchmark==3.2.2"]
_VERSION = "0.6.7"
_PACKAGES = find_packages(exclude=["tests*"])
def _read_file(filename):
with open(filename) as afile:
return afile.read()
setup(
name="tartiflette",
version=_VERSION,
description="GraphQL Engine for python",
long_description=_read_file("README.md"),
url="https://github.com/dailymotion/tartiflette",
author="Dailymotion Core API Team",
author_email="[email protected]",
license="MIT",
classifiers=[
"Intended Audience :: Developers",
"Topic :: Software Development :: Libraries",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: Implementation :: PyPy",
],
keywords="api graphql protocol api rest relay tartiflette dailymotion",
packages=_PACKAGES,
install_requires=["cffi>=1.0.0,<2.0.0", "lark-parser==0.6.4", "pytz"],
tests_require=_TEST_REQUIRE,
extras_require={"test": _TEST_REQUIRE, "benchmark": _BENCHMARK_REQUIRE},
cmdclass={"build_ext": BuildExtCmd, "build_py": BuildPyCmd},
include_package_data=True,
)