setup.py 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. """
  2. Lakesuperior setup script.
  3. Proudly ripped from https://github.com/pypa/sampleproject/blob/master/setup.py
  4. """
  5. import sys
  6. # Always prefer setuptools over distutils
  7. from setuptools import Extension, setup, find_packages
  8. # To use a consistent encoding
  9. from codecs import open
  10. from glob import glob
  11. from os import path
  12. import lakesuperior
  13. try:
  14. from Cython.Build import cythonize
  15. except ImportError:
  16. USE_CYTHON = False
  17. print('Not using Cython to compile extensions.')
  18. else:
  19. USE_CYTHON = True
  20. print('Using Cython to compile extensions.')
  21. # ``pytest_runner`` is referenced in ``setup_requires``.
  22. # See https://github.com/pytest-dev/pytest-runner#conditional-requirement
  23. needs_pytest = {'pytest', 'test', 'ptr'}.intersection(sys.argv)
  24. pytest_runner = ['pytest-runner'] if needs_pytest else []
  25. # Get the long description from the README file
  26. readme_fpath = path.join(path.dirname(lakesuperior.basedir), 'README.rst')
  27. with open(readme_fpath, encoding='utf-8') as f:
  28. long_description = f.read()
  29. # Extensions directory.
  30. #ext_dir = path.join(path.dirname(lakesuperior.basedir), 'ext')
  31. ext_dir = 'ext'
  32. include_dirs = [
  33. path.join(ext_dir, 'include'),
  34. ]
  35. if USE_CYTHON:
  36. include_dirs.append(path.join(lakesuperior.basedir, 'cy_include'))
  37. ext = 'pyx'
  38. else:
  39. ext = 'c'
  40. extensions = [
  41. Extension(
  42. 'lakesuperior.store.base_lmdb_store',
  43. [
  44. path.join(ext_dir, 'lib', 'mdb.c'),
  45. path.join(ext_dir, 'lib', 'midl.c'),
  46. path.join('lakesuperior', 'store', f'base_lmdb_store.{ext}'),
  47. ],
  48. include_dirs=include_dirs,
  49. ),
  50. Extension(
  51. 'lakesuperior.store.ldp_rs.term',
  52. [
  53. path.join(ext_dir, 'lib', 'tpl.c'),
  54. path.join('lakesuperior', 'store', 'ldp_rs', f'term.{ext}'),
  55. ],
  56. include_dirs=include_dirs,
  57. extra_compile_args=['-fopenmp'],
  58. extra_link_args=['-fopenmp'],
  59. libraries=['crypto']
  60. ),
  61. Extension(
  62. 'lakesuperior.store.ldp_rs.lmdb_triplestore',
  63. [
  64. path.join(ext_dir, 'lib', 'mdb.c'),
  65. path.join(ext_dir, 'lib', 'midl.c'),
  66. path.join(
  67. 'lakesuperior', 'store', 'ldp_rs', f'lmdb_triplestore.{ext}'),
  68. ],
  69. include_dirs=include_dirs,
  70. extra_compile_args=['-fopenmp'],
  71. extra_link_args=['-fopenmp'],
  72. libraries=['crypto']
  73. ),
  74. # For testing.
  75. #Extension(
  76. # '*',
  77. # [
  78. # #path.join(ext_dir, 'lib', 'tpl.c'),
  79. # path.join(
  80. # path.dirname(lakesuperior.basedir), 'sandbox', f'*.{ext}'),
  81. # ],
  82. # include_dirs=include_dirs,
  83. #),
  84. ]
  85. if USE_CYTHON:
  86. extensions = cythonize(extensions, compiler_directives={
  87. 'language_level': 3,
  88. 'boundscheck': False,
  89. 'wraparound': False,
  90. 'profile': True,
  91. })
  92. setup(
  93. name='lakesuperior',
  94. version=lakesuperior.release,
  95. description='A Linked Data Platform repository sever.',
  96. long_description=long_description,
  97. url='https://lakesuperior.readthedocs.io',
  98. author='Stefano Cossu <@scossu>',
  99. #author_email='',
  100. license='Apache License Version 2.0',
  101. ext_modules=extensions,
  102. # https://pypi.python.org/pypi?%3Aaction=list_classifiers
  103. classifiers=[
  104. 'Development Status :: 3 - Alpha',
  105. 'Environment :: Console',
  106. 'Environment :: Web Environment',
  107. 'Framework :: Flask',
  108. 'Intended Audience :: Developers',
  109. 'Intended Audience :: Information Technology',
  110. 'Intended Audience :: Science/Research',
  111. 'License :: OSI Approved :: Apache Software License',
  112. 'Natural Language :: English',
  113. 'Operating System :: MacOS',
  114. 'Operating System :: Microsoft :: Windows',
  115. 'Operating System :: POSIX :: Linux',
  116. 'Programming Language :: Python :: 3',
  117. 'Programming Language :: Python :: 3.6',
  118. 'Programming Language :: Python :: 3.7',
  119. 'Topic :: Database :: Database Engines/Servers',
  120. ],
  121. keywords='repository linked-data',
  122. python_requires='~=3.6',
  123. packages=find_packages(exclude=['contrib', 'docs', 'tests']),
  124. # Great reference read about dependency management:
  125. # https://caremad.io/posts/2013/07/setup-vs-requirement/
  126. install_requires=[
  127. 'CoilMQ',
  128. 'Flask',
  129. 'HiYaPyCo',
  130. 'PyYAML',
  131. 'arrow',
  132. 'cchardet',
  133. 'click',
  134. 'click-log',
  135. 'gevent',
  136. 'gunicorn',
  137. 'rdflib',
  138. 'rdflib-jsonld',
  139. 'requests',
  140. 'requests-toolbelt',
  141. 'sphinx-rtd-theme',
  142. 'stomp.py',
  143. ],
  144. setup_requires=[
  145. 'setuptools>=18.0',
  146. ] + pytest_runner,
  147. tests_require=[
  148. 'Pillow',
  149. 'numpy',
  150. 'pytest',
  151. 'pytest-flask',
  152. ],
  153. include_package_data=True,
  154. #extras_require={},
  155. #package_data={
  156. #},
  157. #data_files=[],
  158. entry_points={
  159. 'console_scripts': [
  160. 'lsup-admin=lakesuperior.lsup_admin:admin',
  161. 'lsup-benchmark=lakesuperior.util.benchmark:run',
  162. 'lsup-profiler=lakesuperior.profiler:run',
  163. 'lsup-server=lakesuperior.server:run',
  164. ],
  165. },
  166. scripts=['bin/fcrepo'],
  167. project_urls={
  168. 'Source Code': 'https://github.com/scossu/lakesuperior/',
  169. 'Documentation': 'https://lakesuperior.readthedocs.io',
  170. 'Discussion': 'https://groups.google.com/forum/#!forum/lakesuperior',
  171. 'Bug Reports': 'https://github.com/scossu/lakesuperior/issues',
  172. }
  173. )