setup.py 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. #!/usr/bin/env python
  2. # command to build pymcell
  3. # python setup.py build
  4. # command to create pymcell tarball
  5. # python setup.py sdist
  6. """
  7. setup.py file for pyMCell
  8. """
  9. from distutils.core import setup, Extension
  10. from distutils.command.build import build
  11. from distutils.command.sdist import sdist
  12. import os
  13. import shutil
  14. import sys
  15. def disallow_python2():
  16. if sys.version_info[0] == 2:
  17. sys.exit("Sorry, Python 2 is not supported.")
  18. class CustomBuild(build):
  19. def run(self):
  20. disallow_python2()
  21. os.system("mkdir build")
  22. shutil.copy("./requirements.py", "./build")
  23. os.system("cd build; python requirements.py; cd ..")
  24. shutil.copy("./appveyor_windows/config.h", "./src")
  25. shutil.copy("./appveyor_windows/version.h", "./src")
  26. shutil.copy("./src/pymcell_helpers.py", ".")
  27. shutil.copy("./src/data_model_import.py", ".")
  28. self.run_command('build_ext')
  29. shutil.copy("./src/pymcell.py", ".")
  30. build.run(self)
  31. class CustomSDist(sdist):
  32. def run(self):
  33. disallow_python2()
  34. sdist.run(self)
  35. mcell_module = Extension(
  36. '_pymcell',
  37. include_dirs=['./include'],
  38. libraries=['nfsim_c', 'NFsim'],
  39. library_dirs=['./build/lib'],
  40. sources=[
  41. './src/argparse.c',
  42. './src/chkpt.c',
  43. './src/count_util.c',
  44. './src/diffuse.c',
  45. './src/diffuse_trimol.c',
  46. './src/diffuse_util.c',
  47. './src/dyngeom.c',
  48. './src/dyngeom_lex.c',
  49. './src/dyngeom_parse_extras.c',
  50. './src/dyngeom_yacc.c',
  51. './src/grid_util.c',
  52. './src/hashmap.c',
  53. './src/init.c',
  54. './src/isaac64.c',
  55. './src/logging.c',
  56. './src/mcell_dyngeom.c',
  57. './src/mcell_init.c',
  58. './src/mcell_misc.c',
  59. './src/mcell_objects.c',
  60. './src/mcell_react_out.c',
  61. './src/mcell_reactions.c',
  62. './src/mcell_release.c',
  63. './src/mcell_run.c',
  64. './src/mcell_species.c',
  65. './src/mcell_surfclass.c',
  66. './src/mcell_viz.c',
  67. './src/mem_util.c',
  68. './src/nfsim_func.c',
  69. './src/pymcell.i',
  70. './src/react_cond.c',
  71. './src/react_outc.c',
  72. './src/react_outc_nfsim.c',
  73. './src/react_outc_trimol.c',
  74. './src/react_output.c',
  75. './src/react_trig.c',
  76. './src/react_trig_nfsim.c',
  77. './src/react_util.c',
  78. './src/react_util_nfsim.c',
  79. './src/rng.c',
  80. './src/sched_util.c',
  81. './src/strfunc.c',
  82. './src/sym_table.c',
  83. './src/triangle_overlap.c',
  84. './src/util.c',
  85. './src/vector.c',
  86. './src/version_info.c',
  87. './src/viz_output.c',
  88. './src/vol_util.c',
  89. './src/volume_output.c',
  90. './src/wall_util.c',
  91. ],
  92. swig_opts=['-py3'],
  93. extra_compile_args=['-O2'])
  94. setup(name='pymcell',
  95. version='0.1',
  96. author="The MCell team",
  97. description="""Python bindings to libmcell""",
  98. author_email="[email protected]",
  99. url="https://github.com/mcellteam/mcell",
  100. download_url="https://github.com/mcellteam/mcell/archive/pymcell_0.1.tar.gz",
  101. ext_modules=[mcell_module],
  102. license='GPL v2',
  103. py_modules=["pymcell"],
  104. cmdclass={'build': CustomBuild, 'sdist': CustomSDist},
  105. )