setup.py 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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
  12. from setuptools.command.develop import develop
  13. from setuptools.command.install import install
  14. from subprocess import check_call
  15. def build_library():
  16. cur_path = pathlib.Path(__file__).parent
  17. check_call(f"{cur_path}/utils/create_lib.sh".split())
  18. class PreDevelopCommand(develop):
  19. """Pre-installation for development mode."""
  20. def run(self):
  21. build_library()
  22. develop.run(self)
  23. class PreInstallCommand(install):
  24. """Pre-installation for installation mode."""
  25. def run(self):
  26. build_library()
  27. install.run(self)
  28. with open("README.md") as f:
  29. readme = f.read()
  30. with open("LICENSE") as f:
  31. license = f.read()
  32. setup(
  33. name="wamr-python",
  34. version="0.1.0",
  35. description="A WebAssembly runtime powered by WAMR",
  36. long_description=readme,
  37. author="The WAMR Project Developers",
  38. author_email="hello@bytecodealliance.org",
  39. url="https://github.com/bytecodealliance/wasm-micro-runtime",
  40. license=license,
  41. include_package_data=True,
  42. cmdclass={
  43. 'develop': PreDevelopCommand,
  44. 'install': PreInstallCommand,
  45. },
  46. )