You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

setup.py 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #!/usr/bin/env python
  2. import os
  3. import platform
  4. import sys
  5. from setuptools import Extension, setup
  6. if os.name == "nt":
  7. libdep = []
  8. extra_compile_args = []
  9. else:
  10. libdep = ["m"]
  11. if platform.processor() == "i386":
  12. extra_compile_args = ['-msse2', '-mfpmath=sse']
  13. else:
  14. extra_compile_args = []
  15. try:
  16. with open("src/pillowfight/_version.h", "r") as file_descriptor:
  17. version = file_descriptor.read().strip()
  18. version = version.split(" ")[2][1:-1]
  19. if "-" in version:
  20. version = version.split("-")[0]
  21. except FileNotFoundError:
  22. print("WARNING: version.txt file is missing")
  23. print("WARNING: Please run 'make version' first")
  24. sys.exit(1)
  25. setup(
  26. name="pypillowfight",
  27. version=version,
  28. description=("Library containing various image processing algorithms"),
  29. long_description=("Library containing various image processing algorithms:"
  30. " Automatic Color Equalization, Unpaper's algorithms,"
  31. " Stroke Width Transformation, etc"),
  32. keywords="image processing algorithm pillow pil",
  33. url="https://github.com/openpaperwork/libpillowfight#readme",
  34. download_url=(
  35. "https://github.com/openpaperwork/libpillowfight/archive/"
  36. "{}.zip".format(version)
  37. ),
  38. classifiers=[
  39. "Intended Audience :: Developers",
  40. "License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
  41. "Operating System :: POSIX :: Linux",
  42. "Programming Language :: Python",
  43. "Programming Language :: Python :: 3",
  44. "Programming Language :: Python :: 3.5",
  45. "Topic :: Multimedia :: Graphics :: Graphics Conversion",
  46. ],
  47. license="GPLv2",
  48. author="Jerome Flesch",
  49. author_email="jflesch@openpaper.work",
  50. packages=[
  51. 'pillowfight',
  52. ],
  53. package_dir={
  54. 'pillowfight': 'src/pillowfight',
  55. },
  56. ext_modules=[
  57. Extension(
  58. 'pillowfight._clib', [
  59. 'src/pillowfight/util.c',
  60. 'src/pillowfight/_ace.c',
  61. 'src/pillowfight/_blackfilter.c',
  62. 'src/pillowfight/_blurfilter.c',
  63. 'src/pillowfight/_border.c',
  64. 'src/pillowfight/_canny.c',
  65. 'src/pillowfight/_compare.c',
  66. 'src/pillowfight/_gaussian.c',
  67. 'src/pillowfight/_grayfilter.c',
  68. 'src/pillowfight/_masks.c',
  69. 'src/pillowfight/_noisefilter.c',
  70. 'src/pillowfight/_pymod.c',
  71. 'src/pillowfight/_sobel.c',
  72. 'src/pillowfight/_swt.c',
  73. 'src/pillowfight/_version.c',
  74. ],
  75. include_dirs=["include"],
  76. libraries=libdep,
  77. extra_compile_args=extra_compile_args,
  78. undef_macros=['NDEBUG'],
  79. ),
  80. ],
  81. data_files=[],
  82. scripts=[],
  83. install_requires=[
  84. "Pillow",
  85. ],
  86. setup_requires=['nose>=1.0'],
  87. )