mirror of
https://github.com/ralsina/tartrazine.git
synced 2025-06-18 22:23:07 -03:00
Cover the rest of python bindings from shared library, add tests, add docstrings, add setup.py.
This commit is contained in:
43
python/setup.py
Normal file
43
python/setup.py
Normal file
@ -0,0 +1,43 @@
|
||||
from logging import getLogger
|
||||
import shutil
|
||||
import subprocess
|
||||
|
||||
from setuptools import setup, find_packages
|
||||
from setuptools.command.develop import develop
|
||||
from setuptools.command.install import install
|
||||
|
||||
logger = getLogger(__name__)
|
||||
|
||||
|
||||
def build_go_archive():
|
||||
logger.info("Building C archive with static library")
|
||||
if shutil.which("go") is None:
|
||||
raise EnvironmentError("You should have go installed and available on your path in order to build this module")
|
||||
subprocess.check_output(["make", "static"], cwd="../")
|
||||
logger.info("C archive successfully built")
|
||||
|
||||
|
||||
class build_static_and_develop(develop):
|
||||
|
||||
def run(self):
|
||||
build_go_archive()
|
||||
super(build_static_and_develop, self).run()
|
||||
|
||||
|
||||
class build_static_and_install(install):
|
||||
|
||||
def run(self):
|
||||
build_go_archive()
|
||||
super(build_static_and_install, self).run()
|
||||
|
||||
|
||||
setup(
|
||||
name="enry",
|
||||
version="0.1.1",
|
||||
description="Python bindings for go-enry package",
|
||||
setup_requires=["cffi>=1.0.0"],
|
||||
cffi_modules=["build_enry.py:ffibuilder"],
|
||||
packages=find_packages(),
|
||||
install_requires=["cffi>=1.0.0"],
|
||||
cmdclass={"develop": build_static_and_develop, "install": build_static_and_install}
|
||||
)
|
Reference in New Issue
Block a user