gitlab.com/thomasboni/go-enry/v2@v2.8.3-0.20220418031202-30b0d7a3de98/python/setup.py (about) 1 from logging import getLogger 2 import shutil 3 import subprocess 4 5 from setuptools import setup, find_packages 6 from setuptools.command.develop import develop 7 from setuptools.command.install import install 8 9 logger = getLogger(__name__) 10 11 12 def build_go_archive(): 13 logger.info("Building C archive with static library") 14 if shutil.which("go") is None: 15 raise EnvironmentError("You should have Go installed and available on your path in order to build this module") 16 subprocess.check_output(["make", "static"], cwd="../") 17 logger.info("C archive successfully built") 18 19 20 class build_static_and_develop(develop): 21 22 def run(self): 23 build_go_archive() 24 super(build_static_and_develop, self).run() 25 26 27 class build_static_and_install(install): 28 29 def run(self): 30 build_go_archive() 31 super(build_static_and_install, self).run() 32 33 34 with open("README.md", "r") as fh: 35 long_description = fh.read() 36 37 setup( 38 name="enry", 39 version="0.1.1", 40 description="Python bindings for go-enry package", 41 setup_requires=["cffi>=1.0.0"], 42 cffi_modules=["build_enry.py:ffibuilder"], 43 packages=find_packages(), 44 install_requires=["cffi>=1.0.0"], 45 cmdclass={"develop": build_static_and_develop, "install": build_static_and_install} 46 )