File tree 2 files changed +32
-19
lines changed
2 files changed +32
-19
lines changed Original file line number Diff line number Diff line change 1
1
[build-system ]
2
- requires = [" setuptools" , " wheel" , " cython" ]
2
+ requires = [" setuptools" , " wheel" , " cython" , " pkgconfig " ]
3
3
build-backend = " setuptools.build_meta"
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env python3
2
2
3
+ import os
3
4
import platform
4
- import setuptools
5
5
import sys
6
6
7
+ import pkgconfig
8
+ from Cython .Build import cythonize
9
+ from pkgconfig import PackageNotFoundError
10
+ from setuptools import Extension , setup
7
11
8
12
extra_compile_args = [
9
13
'-std=c++11' ,
21
25
if sys .version_info < (3 , 0 ):
22
26
raise Exception ("python-rocksdb requires Python 3.x" )
23
27
24
- setuptools .setup (
25
- ext_modules = [
26
- setuptools .Extension (
27
- 'rocksdb._rocksdb' ,
28
- [
29
- 'rocksdb/_rocksdb.pyx' ,
30
- ],
31
- extra_compile_args = extra_compile_args ,
32
- language = 'c++' ,
33
- libraries = [
34
- 'rocksdb' ,
35
- 'snappy' ,
36
- 'bz2' ,
37
- 'z' ,
38
- 'lz4' ,
39
- ],
40
- ),
28
+ rocksdb_extension = Extension (
29
+ 'rocksdb._rocksdb' ,
30
+ [
31
+ 'rocksdb/_rocksdb.pyx' ,
41
32
],
33
+ extra_compile_args = extra_compile_args ,
34
+ language = 'c++' ,
35
+ libraries = ['rocksdb' ],
36
+ )
37
+
38
+ try :
39
+ pkgconfig .configure_extension (rocksdb_extension , "rocksdb" )
40
+ except PackageNotFoundError :
41
+ include_path = os .environ .get ("INCLUDE_PATH" )
42
+ library_path = os .environ .get ("LIBRARY_PATH" )
43
+
44
+ rocksdb_extension .include_dirs += include_path .split (os .pathsep ) if include_path else []
45
+ rocksdb_extension .library_dirs += library_path .split (os .pathsep ) if library_path else []
46
+ rocksdb_extension .libraries += [
47
+ 'snappy' ,
48
+ 'bz2' ,
49
+ 'z' ,
50
+ 'lz4' ,
51
+ ]
52
+
53
+ setup (
54
+ ext_modules = cythonize ([rocksdb_extension ]),
42
55
)
You can’t perform that action at this time.
0 commit comments