-
Notifications
You must be signed in to change notification settings - Fork 75
Expand file tree
/
Copy pathsetup.py
More file actions
91 lines (83 loc) · 3.01 KB
/
setup.py
File metadata and controls
91 lines (83 loc) · 3.01 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
from __future__ import print_function
import os
import re
import sys
import platform
from distutils.sysconfig import get_config_var
from distutils.version import LooseVersion
from glob import glob
from setuptools import setup, Extension
sources = (glob("src/*.cpp") + ["libmc/_client.pyx"])
include_dirs = ["include"]
COMPILER_FLAGS = [
"-fno-strict-aliasing",
"-fno-exceptions",
"-fno-rtti",
"-Wall",
"-DMC_USE_SMALL_VECTOR",
"-O3",
"-DNDEBUG",
"-std=c++17",
]
# For mac, ensure extensions are built for macos 10.9 when compiling on a
# 10.9 system or above, overriding distuitls behaviour which is to target
# the version that python was built for. This may be overridden by setting
# MACOSX_DEPLOYMENT_TARGET before calling setup.py
# https://github.com/pandas-dev/pandas/issues/23424#issuecomment-446393981
if sys.platform == 'darwin' and 'MACOSX_DEPLOYMENT_TARGET' not in os.environ:
current_system = LooseVersion(platform.mac_ver()[0])
python_target = LooseVersion(get_config_var('MACOSX_DEPLOYMENT_TARGET'))
if python_target < LooseVersion('10.9') and current_system >= LooseVersion('10.9'):
os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.9'
def find_version(*file_paths):
with open(os.path.join(*file_paths)) as fhandler:
version_file = fhandler.read()
version_match = re.search(r"^__VERSION__ = ['\"]([^'\"]*)['\"]", version_file, re.M)
if version_match:
return version_match.group(1)
raise RuntimeError("Unable to find version string.")
setup(
name="libmc",
packages=["libmc"],
version=find_version("libmc", "__init__.py"),
license="BSD License",
description="Fast and light-weight memcached client for C++/Python",
author="PAN, Myautsai",
author_email="myautsai@gmail.com",
url="https://github.com/douban/libmc",
keywords=["memcached", "memcache", "client"],
long_description=open("README.rst").read(),
classifiers=[
"Programming Language :: C++",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"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",
"Development Status :: 5 - Production/Stable",
"Operating System :: POSIX :: Linux",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Topic :: Software Development :: Libraries",
],
setup_requires=[
# Support for the basestring type is new in Cython 0.20.
'Cython >= 0.20',
],
ext_modules=[
Extension(
"libmc._client",
sources,
include_dirs=include_dirs,
language="c++",
extra_compile_args=COMPILER_FLAGS,
)
],
tests_require=[
"pytest",
"future",
"numpy",
])