forked from twmht/python-rocksdb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request twmht#21 from sileht/sileht/build-fix
Allow to compile the extension everywhere
- Loading branch information
Showing
13 changed files
with
141 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,11 @@ | ||
/build/ | ||
/docs/_build/ | ||
build | ||
docs/_build | ||
.pytest_cache | ||
.eggs/ | ||
.tox/ | ||
*.egg-info/ | ||
*.pyc | ||
*.so | ||
__pycache__ | ||
rocksdb/_rocksdb.cpp | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
sudo: required | ||
dist: trusty | ||
language: generic | ||
services: | ||
- docker | ||
|
||
cache: | ||
directories: | ||
- ~/.cache/pip | ||
|
||
install: | ||
docker build . -t ci-image; | ||
script: | ||
docker run -v ~/.cache/pip:/home/tester/.cache/pip -v $(pwd):/home/tester/src ci-image:latest tox -e ${TOXENV} ; | ||
env: | ||
- TOXENV=py27 | ||
- TOXENV=py36 | ||
- TOXENV=docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
FROM ubuntu:18.04 | ||
ENV SRC /home/tester/src | ||
ENV DEBIAN_FRONTEND noninteractive | ||
|
||
RUN apt-get update -y && apt-get install -qy \ | ||
locales \ | ||
git \ | ||
wget \ | ||
python \ | ||
python3 \ | ||
python-dev \ | ||
python3-dev \ | ||
python-pip \ | ||
librocksdb-dev \ | ||
libsnappy-dev \ | ||
zlib1g-dev \ | ||
libbz2-dev \ | ||
liblz4-dev \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
#NOTE(sileht): really no utf-8 in 2017 !? | ||
ENV LANG en_US.UTF-8 | ||
RUN update-locale | ||
RUN locale-gen $LANG | ||
|
||
#NOTE(sileht): Upgrade python dev tools | ||
RUN pip install -U pip tox virtualenv | ||
|
||
RUN groupadd --gid 2000 tester | ||
RUN useradd --uid 2000 --gid 2000 --create-home --shell /bin/bash tester | ||
USER tester | ||
|
||
WORKDIR $SRC |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,10 @@ | ||
[build_sphinx] | ||
source-dir = docs | ||
build-dir = docs/_build | ||
all_files = 1 | ||
|
||
[upload_sphinx] | ||
upload-dir = docs/_build/html | ||
|
||
[aliases] | ||
test=pytest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,22 @@ | ||
import platform | ||
from setuptools import setup | ||
from setuptools import find_packages | ||
from distutils.extension import Extension | ||
from setuptools import Extension | ||
|
||
try: | ||
from Cython.Build import cythonize | ||
except ImportError: | ||
def cythonize(extensions): return extensions | ||
sources = ['rocksdb/_rocksdb.cpp'] | ||
else: | ||
sources = ['rocksdb/_rocksdb.pyx'] | ||
|
||
extra_compile_args = [ | ||
'-std=c++11', | ||
'-O3', | ||
'-Wall', | ||
'-Wextra', | ||
'-Wconversion', | ||
'-fno-strict-aliasing' | ||
'-fno-strict-aliasing', | ||
'-fno-rtti', | ||
] | ||
|
||
if platform.system() == 'Darwin': | ||
extra_compile_args += ['-mmacosx-version-min=10.7', '-stdlib=libc++'] | ||
|
||
mod1 = Extension( | ||
'rocksdb._rocksdb', | ||
sources, | ||
extra_compile_args=extra_compile_args, | ||
language='c++', | ||
libraries=[ | ||
'rocksdb', | ||
'snappy', | ||
'bz2', | ||
'z' | ||
] | ||
) | ||
|
||
setup( | ||
name="python-rocksdb", | ||
|
@@ -45,11 +27,20 @@ def cythonize(extensions): return extensions | |
author_email="[email protected]", | ||
url="https://github.com/twmht/python-rocksdb", | ||
license='BSD License', | ||
install_requires=['setuptools'], | ||
setup_requires=['setuptools>=25', 'Cython>=0.20'], | ||
install_requires=['setuptools>=25'], | ||
package_dir={'rocksdb': 'rocksdb'}, | ||
packages=find_packages('.'), | ||
ext_modules=cythonize([mod1]), | ||
setup_requires=['pytest-runner'], | ||
tests_require=['pytest'], | ||
ext_modules=[Extension( | ||
'rocksdb._rocksdb', | ||
['rocksdb/_rocksdb.pyx'], | ||
extra_compile_args=extra_compile_args, | ||
language='c++', | ||
libraries=['rocksdb', 'snappy', 'bz2', 'z', 'lz4'], | ||
)], | ||
extras_require={ | ||
"doc": ['sphinx_rtd_theme', 'sphinx'], | ||
"test": ['pytest'], | ||
}, | ||
include_package_data=True | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[tox] | ||
envlist = py27,py35,py36 | ||
minversion = 2.0 | ||
skipsdist = True | ||
|
||
[testenv] | ||
skip_install = True | ||
deps = | ||
-e | ||
.[test] | ||
commands = pytest {posargs:rocksdb/tests} | ||
|
||
[testenv:docs] | ||
deps = .[doc] | ||
commands = python setup.py build_sphinx -W | ||
|
||
[pytest] | ||
addopts = --verbose | ||
norecursedirs = .tox |