Skip to content
Snippets Groups Projects
Commit 11fde3f8 authored by Alexander Regueiro's avatar Alexander Regueiro Committed by Jan Segre
Browse files

Use pkgconfig in `setup.py` script.

parent 4be57723
No related branches found
No related tags found
No related merge requests found
[build-system] [build-system]
requires = ["setuptools", "wheel", "cython"] requires = ["setuptools", "wheel", "cython", "pkgconfig"]
build-backend = "setuptools.build_meta" build-backend = "setuptools.build_meta"
#!/usr/bin/env python3 #!/usr/bin/env python3
import os
import platform import platform
import setuptools
import sys import sys
import pkgconfig
from Cython.Build import cythonize
from pkgconfig import PackageNotFoundError
from setuptools import Extension, setup
extra_compile_args = [ extra_compile_args = [
'-std=c++11', '-std=c++11',
...@@ -21,22 +25,31 @@ if platform.system() == 'Darwin': ...@@ -21,22 +25,31 @@ if platform.system() == 'Darwin':
if sys.version_info < (3 , 0): if sys.version_info < (3 , 0):
raise Exception("python-rocksdb requires Python 3.x") raise Exception("python-rocksdb requires Python 3.x")
setuptools.setup( rocksdb_extension = Extension(
ext_modules=[ 'rocksdb._rocksdb',
setuptools.Extension( [
'rocksdb._rocksdb', 'rocksdb/_rocksdb.pyx',
[
'rocksdb/_rocksdb.pyx',
],
extra_compile_args=extra_compile_args,
language='c++',
libraries=[
'rocksdb',
'snappy',
'bz2',
'z',
'lz4',
],
),
], ],
extra_compile_args=extra_compile_args,
language='c++',
libraries=['rocksdb'],
)
try:
pkgconfig.configure_extension(rocksdb_extension, "rocksdb")
except PackageNotFoundError:
include_path = os.environ.get("INCLUDE_PATH")
library_path = os.environ.get("LIBRARY_PATH")
rocksdb_extension.include_dirs += include_path.split(os.pathsep) if include_path else []
rocksdb_extension.library_dirs += library_path.split(os.pathsep) if library_path else []
rocksdb_extension.libraries += [
'snappy',
'bz2',
'z',
'lz4',
]
setup(
ext_modules=cythonize([rocksdb_extension]),
) )
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment