-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathsetup.py
More file actions
115 lines (100 loc) · 3.12 KB
/
Copy pathsetup.py
File metadata and controls
115 lines (100 loc) · 3.12 KB
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/usr/bin/env python3
try:
from setuptools import Extension, setup
except ImportError:
from distutils.core import setup, Extension
import glob
import importlib.util
import io
import sys
def version():
spec = importlib.util.spec_from_file_location(
"libvalkey.version", "libvalkey/version.py"
)
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
return module.__version__
def get_sources():
libvalkey_sources = (
"alloc",
"async",
"conn",
"dict",
"net",
"read",
"sds",
"sockcompat",
"valkey",
)
return sorted(
glob.glob("src/*.c")
+ ["vendor/libvalkey/src/%s.c" % src for src in libvalkey_sources]
)
def get_linker_args():
if "win32" in sys.platform or "darwin" in sys.platform:
return []
else:
return ["-Wl,-Bsymbolic"]
def get_compiler_args():
if "win32" in sys.platform:
return []
else:
return ["-std=c99"]
def get_libraries():
if "win32" in sys.platform:
return ["ws2_32"]
else:
return []
ext = Extension(
"libvalkey.libvalkey",
sources=get_sources(),
extra_compile_args=get_compiler_args(),
extra_link_args=get_linker_args(),
libraries=get_libraries(),
include_dirs=[
"vendor/libvalkey/include",
"vendor/libvalkey/include/valkey",
# We need to include the src directory because we are building libvalkey
# from source and not using the pre-built library. Therefore, we need to
# add the internal dependencies.
"vendor/libvalkey/src",
],
)
setup(
name="libvalkey",
version=version(),
description="Python wrapper for libvalkey",
long_description=io.open("README.md", "rt", encoding="utf-8").read(),
long_description_content_type="text/markdown",
url="https://github.com/valkey-io/libvalkey-py",
author="libvalkey-py authors",
author_email="libvalkey-py@lists.valkey.io",
keywords=["Valkey"],
license="MIT",
packages=["libvalkey"],
package_data={"libvalkey": ["libvalkey.pyi", "py.typed"]},
ext_modules=[ext],
python_requires=">=3.9",
project_urls={
"Changes": "https://github.com/valkey-io/libvalkey-py/releases",
"Issue tracker": "https://github.com/valkey-io/libvalkey-py/issues",
},
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: MacOS",
"Operating System :: POSIX",
"Programming Language :: C",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Software Development",
],
)