示例#1
0
def get_extensions():

    med_sources = [
        str(os.path.join(UTIL_DIR, "median_utils.pyx")),
        str(os.path.join(UTIL_DIR, "medutils.c"))
    ]

    im_sources = [
        str(os.path.join(UTIL_DIR, "image_utils.pyx")),
        str(os.path.join(UTIL_DIR, "imutils.c"))
    ]

    include_dirs = ['numpy', UTIL_DIR]

    libraries = []
    if 'CFLAGS' in os.environ:
        extra_compile_args = os.environ['CFLAGS'].split()
    else:
        extra_compile_args = ['-g', '-O3', '-funroll-loops', '-ffast-math']
    ext_med = Extension(name=str('astroscrappy.utils.median_utils'),
                        sources=med_sources,
                        include_dirs=include_dirs,
                        libraries=libraries,
                        language="c",
                        extra_compile_args=extra_compile_args)
    ext_im = Extension(name=str("astroscrappy.utils.image_utils"),
                       sources=im_sources,
                       include_dirs=include_dirs,
                       libraries=libraries,
                       language="c",
                       extra_compile_args=extra_compile_args)

    has_openmp, outputs = check_openmp()
    if has_openmp:
        if setup_helpers.get_compiler_option() == 'msvc':
            ext_med.extra_compile_args.append('-openmp')
            ext_im.extra_compile_args.append('-openmp')
        else:
            ext_med.extra_compile_args.append('-fopenmp')
            ext_im.extra_compile_args.append('-fopenmp')
            ext_med.extra_link_args = ['-g', '-fopenmp']
            ext_im.extra_link_args = ['-g', '-fopenmp']
    else:
        log.warn('OpenMP was not found. '
                 'astroscrappy will be compiled without OpenMP. '
                 '(Use the "-v" option of setup.py for more details.)')
        log.debug(('(Start of OpenMP info)\n'
                   'compiler stdout:\n{0}\n'
                   'compiler stderr:\n{1}\n'
                   '(End of OpenMP info)').format(*outputs))

    return [ext_med, ext_im]
示例#2
0
def get_extensions():

    med_sources = [str(os.path.join(UTIL_DIR, "median_utils.pyx")),
                   str(os.path.join(UTIL_DIR, "quick_select.c"))]

    include_dirs = ['numpy', UTIL_DIR]

    libraries = []

    ext_med = Extension(name=str('banzai.utils.median_utils'),
                        sources=med_sources,
                        include_dirs=include_dirs,
                        libraries=libraries,
                        language="c",
                        extra_compile_args=['-g', '-O3', '-funroll-loops', '-ffast-math'])

    has_openmp, outputs = check_openmp()
    if has_openmp:
        if setup_helpers.get_compiler_option() == 'msvc':
            ext_med.extra_compile_args.append('-openmp')
        else:
            ext_med.extra_compile_args.append('-fopenmp')
            ext_med.extra_link_args = ['-g', '-fopenmp']
    else:
        log.warn('OpenMP was not found. '
                 'banzai will be compiled without OpenMP. '
                 '(Use the "-v" option of setup.py for more details.)')
        log.debug(('(Start of OpenMP info)\n'
                   'compiler stdout:\n{0}\n'
                   'compiler stderr:\n{1}\n'
                   '(End of OpenMP info)').format(*outputs))

    return [ext_med]
示例#3
0
def BuildExtension(sources, output_dir, extension_name):
  from distutils import log
  from distutils.core import Distribution, Extension
  import os
  import tempfile

  build_dir = tempfile.mkdtemp()
  # Source file paths must be relative to current path.
  cwd = os.getcwd()
  src_files = [os.path.relpath(filename, cwd) for filename in sources]

  ext = Extension(extension_name, src_files)

  if os.name == 'nt':
    _FixDistutilsMsvcCompiler()
    # VS 2010 does not generate manifest, see http://bugs.python.org/issue4431
    ext.extra_link_args = ['/MANIFEST']

  dist = Distribution({
    'ext_modules': [ext]
  })
  dist.script_args = ['build_ext', '--build-temp', build_dir,
                      '--build-lib', output_dir]
  dist.parse_command_line()
  log.set_threshold(log.DEBUG)
  dist.run_commands()
  dist.script_args = ['clean', '--build-temp', build_dir, '--all']
  dist.parse_command_line()
  log.set_threshold(log.DEBUG)
  dist.run_commands()
示例#4
0
def get_extensions():

    sources = ["lacosmicx/_lacosmicx.pyx", "lacosmicx/laxutils.c"]

    include_dirs = [numpy.get_include(), '.']

    libraries = []

    ext = Extension(
        name="_lacosmicx",
        sources=sources,
        include_dirs=include_dirs,
        libraries=libraries,
        language="c",
        extra_compile_args=['-g', '-O3', '-funroll-loops', '-ffast-math'])

    has_openmp, outputs = check_openmp()
    if has_openmp:
        ext.extra_compile_args.append('-fopenmp')
        ext.extra_link_args = ['-g', '-fopenmp']
    else:
        log.warn('OpenMP was not found. '
                 'lacosmicx will be compiled without OpenMP. '
                 '(Use the "-v" option of setup.py for more details.)')
        log.debug(('(Start of OpenMP info)\n'
                   'compiler stdout:\n{0}\n'
                   'compiler stderr:\n{1}\n'
                   '(End of OpenMP info)').format(*outputs))

    return [ext]
示例#5
0
def get_extensions():

    sources = ["lacosmicx/_lacosmicx.pyx", "lacosmicx/laxutils.c"]

    include_dirs = [numpy.get_include(), '.']

    libraries = []

    ext = Extension(name="_lacosmicx",
                    sources=sources,
                    include_dirs=include_dirs,
                    libraries=libraries,
                    language="c",
                    extra_compile_args=['-g', '-O3',
                                        '-funroll-loops', '-ffast-math'])

    has_openmp, outputs = check_openmp()
    if has_openmp:
        ext.extra_compile_args.append('-fopenmp')
        ext.extra_link_args = ['-g', '-fopenmp']
    else:
        log.warn('OpenMP was not found. '
                 'lacosmicx will be compiled without OpenMP. '
                 '(Use the "-v" option of setup.py for more details.)')
        log.debug(('(Start of OpenMP info)\n'
                   'compiler stdout:\n{0}\n'
                   'compiler stderr:\n{1}\n'
                   '(End of OpenMP info)').format(*outputs))

    return [ext]
示例#6
0
def get_extensions():

    med_sources = [str(os.path.join(UTIL_DIR, "median_utils.pyx")), str(os.path.join(UTIL_DIR, "medutils.c"))]

    im_sources = [str(os.path.join(UTIL_DIR, "image_utils.pyx")), str(os.path.join(UTIL_DIR, "imutils.c"))]

    include_dirs = ["numpy", UTIL_DIR]

    libraries = []

    ext_med = Extension(
        name=str("astroscrappy.utils.median_utils"),
        sources=med_sources,
        include_dirs=include_dirs,
        libraries=libraries,
        language="c",
        extra_compile_args=["-g", "-O3", "-funroll-loops", "-ffast-math"],
    )
    ext_im = Extension(
        name=str("astroscrappy.utils.image_utils"),
        sources=im_sources,
        include_dirs=include_dirs,
        libraries=libraries,
        language="c",
        extra_compile_args=["-g", "-O3", "-funroll-loops", "-ffast-math"],
    )

    has_openmp, outputs = check_openmp()
    if has_openmp:
        ext_med.extra_compile_args.append("-fopenmp")
        ext_im.extra_compile_args.append("-fopenmp")
        ext_med.extra_link_args = ["-g", "-fopenmp"]
        ext_im.extra_link_args = ["-g", "-fopenmp"]
    else:
        log.warn(
            "OpenMP was not found. "
            "astroscrappy will be compiled without OpenMP. "
            '(Use the "-v" option of setup.py for more details.)'
        )
        log.debug(
            (
                "(Start of OpenMP info)\n" "compiler stdout:\n{0}\n" "compiler stderr:\n{1}\n" "(End of OpenMP info)"
            ).format(*outputs)
        )

    return [ext_med, ext_im]
示例#7
0
def get_extensions():

    sources = [os.path.join(LACOSMICX_ROOT, "lacosmicx.pyx"),
               os.path.join(LACOSMICX_ROOT, "laxutils.c")]

    include_dirs = ['numpy', LACOSMICX_ROOT]

    libraries = []

    ext = Extension(name="imageutils.lacosmicx.lacosmicx",
                    sources=sources,
                    include_dirs=include_dirs,
                    libraries=libraries,
                    language="c",
                    extra_compile_args=['-g', '-O3',
                                        '-funroll-loops', '-ffast-math'])

    if USE_OPENMP:
        ext.extra_compile_args.append('-fopenmp')
        ext.extra_link_args = ['-g', '-fopenmp']

    return [ext]
示例#8
0
                include_dirs  = include_dirs,
                define_macros = define_macros,
                sources       = sources )

# OSX needs to hide all the normal AST symbols to prevent
# name clashes when loaded alongside libast itself (eg from pyndf)
symbol_list = "public_symbols.txt"
if sys.platform.startswith("darwin"):
   symfile = open( symbol_list, "w" )
   if sys.version_info[0] > 2:
      symname = "_PyInit_Ast"
   else:
      symname = "_initAst"
   print(symname,file=symfile)
   symfile.close()
   Ast.extra_link_args = [ "-exported_symbols_list", symbol_list]


setup (name = 'starlink-pyast',
       version = '2.5',
       description = 'A Python wrapper for the Starlink AST library',
       url = 'http://starlink.jach.hawaii.edu/starlink/AST',
       author = 'David Berry',
       author_email = '*****@*****.**',
       packages =['starlink'],
       package_data = { 'starlink': [os.path.join('include','star','pyast.h')] },
       ext_modules=[Ast],
       py_modules=['starlink.Grf','starlink.Atl'],
       classifiers=[
          'Intended Audience :: Developers',
          'License :: OSI Approved :: GNU General Public License v2 (GPLv2)',
示例#9
0
            download_library()

    # check again (the user might have downloaded the library)
    if os.path.isdir(SQLPARSER_DIR):
        parsebridge = Extension('sqlparser', 
            sources = ['Parser.c', 'Statement.c', 'Node.c', 'ENodeType.c', 'parsebridgemodule.c', 
        				SQLPARSER_DIR + 'ext/node_visitor/node_visitor.c',
        				SQLPARSER_DIR + 'ext/expr_traverse/expr_traverse.c',
        				SQLPARSER_DIR + 'ext/modifysql/modifysql.c' ],
            include_dirs = [ SQLPARSER_DIR + 'core/', 
        			SQLPARSER_DIR + 'ext/collection/includes/',
        			SQLPARSER_DIR + 'ext/expr_traverse/',
        			SQLPARSER_DIR + 'ext/modifysql/',
        			SQLPARSER_DIR + 'ext/node_visitor/' ],
            library_dirs = [ SQLPARSER_DIR + '/lib/' ],
            libraries = [ 'gspcollection' + ARCH, 'gspcore' + ARCH ],
            define_macros = [ ('_CRT_SECURE_NO_WARNINGS', None), ('DONT_FIX_FRAGMENTS', None), ]
        )

        if sys.platform == 'win32' or sys.platform == 'win64':
            parsebridge.extra_link_args = [ '/MANIFEST', '/DEBUG' ]
            parsebridge.extra_compile_args = [ '/Zi' ]

        setup (name = 'sqlparser',
            version = '1.0',
            description = 'A package for parsing SQL queries',
            author = 'Timo Djürken',
            url = 'https://github.com/TwoLaid/python-sqlparser',
            license = 'GPL',
            ext_modules = [ parsebridge ])
示例#10
0
                     sources=["_tosdb.cpp"],
                     include_dirs=["../include"],
                     optional=True)

ext_win = Extension(**ext_stub.__dict__)

# add/override for Win
ext_win.library_dirs = ["../bin/Release/" + _SYS_ARCHD]
ext_win.libraries = [
    "_tos-databridge-shared-" + _SYS_ARCH,
    "_tos-databridge-static-" + _SYS_ARCH
]
ext_win.define_macros = [("THIS_IMPORTS_IMPLEMENTATION", None),
                         ("THIS_DOESNT_IMPORT_INTERFACE", None)]
ext_win.extra_compile_args = ["/EHsc"]
ext_win.extra_link_args = ["/LTCG"]

try:  # capture setup errors but allow setup to complete (optional=True)
    sio = StringIO()
    se = sys.stderr
    sys.stderr = sio
    setup(ext_modules=[ext_win if _SYS_IS_WIN else ext_stub], **setup_dict)
    sys.stderr = se
    if sio.getvalue():
        print('\n', "+ Operation 'completed' with errors:\n")
        print(sio.getvalue())
        print("+ Checking on the status of the build...")
        t = None
        try:
            import _tosdb as t
            print("+ _tosdb.pyd exists (possibly an older version?) ")
示例#11
0
文件: setup.py 项目: rcortini/wlc
from distutils.core import setup, Extension
import subprocess
module=Extension('pywlc', ['wlc_python.c'])
module.libraries = ['wlc']
module.extra_compile_args=[subprocess.check_output(["wlc-config", "--cflags"])]
module.extra_link_args=[subprocess.check_output(["wlc-config", "--libs"])]
setup(name='pywlc', version='0.0', ext_modules=[module])
示例#12
0
                include_dirs=include_dirs,
                define_macros=define_macros,
                sources=sources)

# OSX needs to hide all the normal AST symbols to prevent
# name clashes when loaded alongside libast itself (eg from pyndf)
symbol_list = "public_symbols.txt"
if sys.platform.startswith("darwin"):
    symfile = open(symbol_list, "w")
    if sys.version_info[0] > 2:
        symname = "_PyInit_Ast"
    else:
        symname = "_initAst"
    print(symname, file=symfile)
    symfile.close()
    Ast.extra_link_args = ["-exported_symbols_list", symbol_list]

setup(
    name='starlink-pyast',
    version=get_version(),
    description='A Python wrapper for the Starlink AST library',
    url='http://www.starlink.ac.uk/ast',
    author='David Berry',
    author_email='*****@*****.**',
    packages=['starlink'],
    package_data={'starlink': [os.path.join('include', 'star', 'pyast.h')]},
    ext_modules=[Ast],
    py_modules=['starlink.Grf', 'starlink.Atl'],
    classifiers=[
        'Intended Audience :: Developers',
        'License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)',
示例#13
0
                SQLPARSER_DIR + 'ext/expr_traverse/expr_traverse.c',
                SQLPARSER_DIR + 'ext/modifysql/modifysql.c'
            ],
            include_dirs=[
                SQLPARSER_DIR + 'core/',
                SQLPARSER_DIR + 'ext/collection/includes/',
                SQLPARSER_DIR + 'ext/expr_traverse/',
                SQLPARSER_DIR + 'ext/modifysql/',
                SQLPARSER_DIR + 'ext/node_visitor/'
            ],
            library_dirs=[SQLPARSER_DIR + '/lib/'],
            libraries=['gspcollection', 'gspcore'],
            define_macros=[
                ('_CRT_SECURE_NO_WARNINGS', None),
                ('DONT_FIX_FRAGMENTS', None),
            ],
            extra_compile_args=['-Wno-strict-prototypes'],
        )

        if sys.platform == 'win32' or sys.platform == 'win64':
            parsebridge.extra_link_args = ['/MANIFEST', '/DEBUG']
            parsebridge.extra_compile_args = ['/Zi']

        setup(name='sqlparser',
              version='1.0',
              description='A package for parsing SQL queries',
              author='Timo Djürken',
              url='https://github.com/TwoLaid/python-sqlparser',
              license='GPL',
              ext_modules=[parsebridge])
示例#14
0
文件: setup.py 项目: bniemczyk/bnirc
#!/usr/bin/env python

from distutils.core import setup, Extension
from os import getenv

ext = Extension("bnirc", [])
ext.extra_objects = ["python.o"]
ext.extra_link_args = ["-L../../src", "-L../../src/.libs", "-L../../src/libs", "-lbnirc"]
ver = getenv("VERSION")

setup(name="bnirc", version=ver,  ext_modules=[ext])
示例#15
0
                       ],
                       language='c++',
                       extra_link_args=[
                           '-L/opt/cprocsp/lib/amd64',
                           '-lcapi20',
                           '-lcapi10',
                           '-lcades',
                           '-lrdrsup',
                       ])

if get_platform().startswith("macos"):
    libpycades.extra_link_args = [
        '-L/opt/cprocsp/lib/',
        '-lcapi20',
        '-lcapi10',
        '-lrdrsup',
        '-L/Applications/CryptoPro_ECP.app/Contents/MacOS/lib/',
        '-lcades',
        '-Wl,-rpath,/Applications/CryptoPro_ECP.app/Contents/MacOS/lib/',
    ]

setup(name='pycryptoprosdk',
      version='1.0.0',
      url='https://github.com/Keyintegrity/pycryptoprosdk',
      author='uishnik',
      author_email='*****@*****.**',
      long_description=long_description,
      packages=[
          'pycryptoprosdk',
      ],
      ext_modules=[
示例#16
0
# the cross platfrom stub
ext_stub = Extension( "_tosdb",
                      sources=[ "_tosdb.cpp" ], 
                      include_dirs=[ "../include" ],
                      optional=True )

ext_win = Extension( **ext_stub.__dict__ )

# add/override for Win
ext_win.library_dirs       =  [ "../bin/Release/"+ _SYS_ARCHD ]
ext_win.libraries          =  [ "_tos-databridge-shared-"+ _SYS_ARCH,
                                "_tos-databridge-static-"+ _SYS_ARCH ]
ext_win.define_macros      =  [ ("THIS_IMPORTS_IMPLEMENTATION",None),
                                ("THIS_DOESNT_IMPORT_INTERFACE",None) ]
ext_win.extra_compile_args =  ["/EHsc"]
ext_win.extra_link_args    =  ["/LTCG"]  
        
try: # capture setup errors but allow setup to complete (optional=True)   
    sio = StringIO()
    se = sys.stderr
    sys.stderr = sio  
    setup( ext_modules=[ ext_win if _SYS_IS_WIN else ext_stub], **setup_dict )  
    sys.stderr = se    
    if sio.getvalue(): 
        print( '\n', "+ Operation 'completed' with errors:\n")
        print( sio.getvalue() )
        print( "+ Checking on the status of the build...")
        t = None
        try:
            import _tosdb as t
            print( "+ _tosdb.pyd exists (possibly an older version?) ")