Explorar el Código

Moved new Cython code to the right setup file. The new scattnlay.pyx is not compiling for me.

Ovidio Peña Rodríguez hace 10 años
padre
commit
d18be9992c
Se han modificado 2 ficheros con 28 adiciones y 30 borrados
  1. 22 27
      setup.py
  2. 6 3
      setup_cython.py

+ 22 - 27
setup.py

@@ -36,31 +36,26 @@ from distutils.core import setup
 from distutils.extension import Extension
 import numpy as np
 
-# setup(name = __mod__,
-#       version = __version__,
-#       description = __title__,
-#       long_description="""The Python version of scattnlay, a computer implementation of the algorithm for the calculation of electromagnetic \
-# radiation scattering by a multilayered sphere developed by Yang. It has been shown that the program is effective, \
-# resulting in very accurate values of scattering efficiencies for a wide range of size parameters, which is a \
-# considerable improvement over previous implementations of similar algorithms. For details see: \
-# O. Pena, U. Pal, Comput. Phys. Commun. 180 (2009) 2348-2354.""",
-#       author = __author__,
-#       author_email = __email__,
-#       maintainer = __author__,
-#       maintainer_email = __email__,
-#       keywords = ['Mie scattering', 'Multilayered sphere', 'Efficiency factors', 'Cross-sections'],
-#       url = __url__,
-#       license = 'GPL',
-#       platforms = 'any',
-#       ext_modules = [Extension("scattnlay", ["nmie.cc", "nmie-wrapper.cc", "py_nmie.cc", "scattnlay.cc"], language = "c++", include_dirs = [np.get_include()])], 
-#       extra_compile_args=['-std=c++11']
-# )
+setup(name = __mod__,
+      version = __version__,
+      description = __title__,
+      long_description="""The Python version of scattnlay, a computer implementation of the algorithm for the calculation of electromagnetic \
+radiation scattering by a multilayered sphere developed by Yang. It has been shown that the program is effective, \
+resulting in very accurate values of scattering efficiencies for a wide range of size parameters, which is a \
+considerable improvement over previous implementations of similar algorithms. For details see: \
+O. Pena, U. Pal, Comput. Phys. Commun. 180 (2009) 2348-2354.""",
+      author = __author__,
+      author_email = __email__,
+      maintainer = __author__,
+      maintainer_email = __email__,
+      keywords = ['Mie scattering', 'Multilayered sphere', 'Efficiency factors', 'Cross-sections'],
+      url = __url__,
+      license = 'GPL',
+      platforms = 'any',
+      ext_modules = [Extension("scattnlay",
+                               ["nmie.cc", "nmie-wrapper.cc", "py_nmie.cc", "scattnlay.cc"],
+                               language = "c++",
+                               include_dirs = [np.get_include()])], 
+      extra_compile_args=['-std=c++11']
+)
 
-from distutils.core import setup
-from Cython.Build import cythonize
-setup(ext_modules = cythonize(
-           "scattnlay.pyx",                 # our Cython source
-           sources=["nmie-wrapper.cc"],  # additional source file(s)
-           language="c++",             # generate C++ code
-           extra_compile_args=['-std=c++11'],
-      ))

+ 6 - 3
setup_cython.py

@@ -34,7 +34,7 @@ __url__ = 'http://scattering.sourceforge.net/'
 
 from distutils.core import setup
 from distutils.extension import Extension
-from Cython.Distutils import build_ext
+from Cython.Build import cythonize
 import numpy as np
 
 setup(name = __mod__,
@@ -53,7 +53,10 @@ O. Pena, U. Pal, Comput. Phys. Commun. 180 (2009) 2348-2354.""",
       url = __url__,
       license = 'GPL',
       platforms = 'any',
-      cmdclass = {'build_ext': build_ext},
-      ext_modules = [Extension("scattnlay", ["nmie.cc", "py_nmie.cc", "scattnlay.pyx"], language = "c++", include_dirs = [np.get_include()])]
+      ext_modules = cythonize("scattnlay.pyx",                       # our Cython source
+                              sources = ["nmie-wrapper.cc"],         # additional source file(s)
+                              language = "c++",                      # generate C++ code
+                              extra_compile_args = ['-std=c++11'],
+      )
 )