예제 #1
0
파일: setup.py 프로젝트: tammojan/PyBDSF
    "dv7prm.f", "dv7scl.f", "dv7scp.f", "dv7swp.f", "i1mach.f", "i7mdcn.f",
    "stopx.f"
]
for src in port3src:
    subprocess.check_output(["gfortran", "-fPIC", "-c", src],
                            cwd=join(srcpath, "port3"))
subprocess.check_output("ar -cq libport3.a *.o",
                        cwd=join(srcpath, "port3"),
                        shell=True)

extensions = []

fext = Extension(
    name="bdsf._pytesselate",
    sources=["src/fortran/pytess_simple.f", "src/fortran/pytess_roundness.f"])
fext.f2py_options = [""]
extensions.append(fext)

extensions.append(
    Extension(name="bdsf._cbdsm",
              sources=[
                  "src/c++/Fitter_dn2g.cc", "src/c++/Fitter_dnsg.cc",
                  "src/c++/Fitter_lmder.cc", "src/c++/MGFunction1.cc",
                  "src/c++/MGFunction2.cc", "src/c++/cbdsm_main.cc",
                  "src/c++/stat.cc", "src/c++/num_util/num_util.cpp"
              ],
              libraries=['minpack', 'port3', 'gfortran', boost_python],
              include_dirs=["src/c++"],
              library_dirs=[join(srcpath, "minpack"),
                            join(srcpath, "port3")]))
예제 #2
0
def main():
    boost_python_libname, boost_python_libdir, boost_python_includedir = find_boost_python()
    boost_numpy_libname, boost_numpy_libdir, boost_numpy_includedir = find_boost_numpy()

    extensions = []

    fext = Extension(
        name="bdsf._pytesselate",
        sources=[
            "src/fortran/pytess_simple.f",
            "src/fortran/pytess_roundness.f"
        ]
    )
    fext.f2py_options = [""]
    extensions.append(fext)

    libraries = [
        'minpack', 'port3', 'gfortran', boost_python_libname
    ]
    if boost_numpy_libname is not None:
        libraries.append(boost_numpy_libname)

    extensions.append(Extension(
        name="bdsf._cbdsm",
        sources=[
            "src/c++/Fitter_dn2g.cc",
            "src/c++/Fitter_dnsg.cc",
            "src/c++/Fitter_lmder.cc",
            "src/c++/MGFunction1.cc",
            "src/c++/MGFunction2.cc",
            "src/c++/cbdsm_main.cc",
            "src/c++/stat.cc",
            "src/c++/num_util/num_util.cpp"
        ],
        libraries=libraries,
        include_dirs=["src/c++", boost_python_includedir, boost_numpy_includedir, numpy.get_include()],
        library_dirs=[join(srcpath, "minpack"), join(srcpath, "port3"), boost_python_libdir, boost_numpy_libdir]
    ))

    extensions.append(Extension(
        name="bdsf.nat.natgridmodule",
        sources=glob.glob("natgrid/Src/*.c"),
        include_dirs=["natgrid/Include"]
    ))

    # HACK for supporting older versions of NumPy
    for ext in extensions:
        ext.extra_f77_compile_args = []
        ext.extra_f90_compile_args = []

    setup(
        name='bdsf',
        version='1.9.2',
        author='David Rafferty',
        author_email='*****@*****.**',
        url='https://github.com/lofar-astron/PyBDSF',
        description='Blob Detection and Source Finder',
        long_description=open('README.rst', 'rt').read(),
        platforms='Linux, Mac OS X',
        packages=['bdsf', 'bdsf.nat'],
        package_dir={'bdsf.nat': join('bdsf', 'nat')},
        classifiers=[
            'Intended Audience :: Science/Research',
            'Programming Language :: C++',
            'Programming Language :: Fortran',
            'Programming Language :: Python :: 2.7',
            'Programming Language :: Python :: 3',
            'Topic :: Scientific/Engineering :: Astronomy'
        ],
        ext_modules=extensions,
        install_requires=['backports.shutil_get_terminal_size',
                          'numpy', 'scipy'],
        scripts=['bdsf/pybdsf', 'bdsf/pybdsm'],
        zip_safe=False,
        cmdclass={
            'mclean': CleanStatic,
            'mbuild': BuildStatic,
            'build_ext': BuildExt,
            'clean': Clean
        }
    )