setup.py 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. # -*- coding: utf-8 -*-
  2. #!/usr/bin/env python3
  3. #
  4. # Copyright (C) 2019 Intel Corporation. All rights reserved.
  5. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. #
  7. # pylint: disable=missing-class-docstring
  8. # pylint: disable=missing-function-docstring
  9. # pylint: disable=missing-module-docstring
  10. import pathlib
  11. from setuptools import setup, find_packages
  12. from setuptools.command.develop import develop
  13. from setuptools.command.install import install
  14. from setuptools.command.egg_info import egg_info
  15. from subprocess import check_call
  16. def build_library():
  17. cur_path = pathlib.Path(__file__).parent
  18. check_call(f"{cur_path}/utils/create_lib.sh".split())
  19. class PreDevelopCommand(develop):
  20. def run(self):
  21. build_library()
  22. develop.run(self)
  23. class PreInstallCommand(install):
  24. def run(self):
  25. build_library()
  26. install.run(self)
  27. class PreEggInfoCommand(egg_info):
  28. def run(self):
  29. build_library()
  30. egg_info.run(self)
  31. with open("README.md") as f:
  32. readme = f.read()
  33. with open("LICENSE") as f:
  34. license = f.read()
  35. setup(
  36. name="wamr-python",
  37. version="0.1.0",
  38. description="A WebAssembly runtime powered by WAMR",
  39. long_description=readme,
  40. packages=find_packages(where="src"),
  41. package_dir={"": "src"},
  42. author="The WAMR Project Developers",
  43. author_email="hello@bytecodealliance.org",
  44. url="https://github.com/bytecodealliance/wasm-micro-runtime",
  45. license=license,
  46. include_package_data=True,
  47. cmdclass={
  48. 'develop': PreDevelopCommand,
  49. 'install': PreInstallCommand,
  50. 'egg_info': PreEggInfoCommand,
  51. },
  52. )