Ejemplo n.º 1
0
def make_ueye(fillout, remove, pkgdata):
    hname = r'^uEye\.h$'
    tops = get_paths('ueye')
    try:
        include_path = path.dirname(find_file(tops, hname, expats=[]))
    except ValueError:
        return

    libname = r'^uEye_api_64\.lib$'
    try:
        lib_path = path.dirname(find_file(tops, libname, expats=[]))
    except ValueError:
        return

    pristine = path.join(include_path, 'uEye.h')
    patched = path.join(r'devwraps', 'uEye.h')

    with open(pristine, 'r') as f:
        incl = f.read()
    incl = re.sub(r'extern "C" __declspec', r'extern __declspec', incl)
    with open(patched, 'w') as f:
        f.write(incl)

    fillout.append(
        Extension(
            'devwraps.ueye',
            [r'devwraps\ueye.pyx'],
            include_dirs=[r'devwraps', numpy.get_include()],
            library_dirs=[lib_path],
            libraries=['ueye_api_64'],
        ))
    remove.append(patched)
    remove.append(r'devwraps\ueye.c')
Ejemplo n.º 2
0
def make_bmc(fillout, remove, pkgdata):
    libname = r'^BMC[0-9]*\.lib$'
    tops = get_paths('bmc')
    try:
        lib_fname = find_file(tops, libname, expats=[])
        lib_path = path.dirname(lib_fname)
        lib_name = path.basename(lib_fname).replace('.lib', '')
    except ValueError:
        return

    iname = r'^BmcApi\.h$'
    try:
        include_path = path.dirname(find_file(tops, iname, expats=[]))
    except ValueError:
        return

    fillout.append(
        Extension(
            'devwraps.bmc',
            [r'devwraps\bmc.pyx'],
            include_dirs=[r'devwraps',
                          numpy.get_include(), include_path],
            library_dirs=[lib_path],
            libraries=[lib_name],
        ))
    remove.append(r'devwraps\bmc.c')
Ejemplo n.º 3
0
def make_mirao52e(fillout, remove, pkgdata):
    hname = r'^mirao52e\.h$'
    tops = get_paths('mirao52e')
    try:
        include_path = path.dirname(find_file(tops, hname, expats=[]))
    except ValueError:
        return

    hname1 = 'mirao52e.h'
    with open(path.join(include_path, hname1), 'r') as f:
        incl = f.read()
    incl = re.sub(r'static const (.*) = .*;', r'\1;', incl)
    with open(path.join('devwraps', hname1), 'w') as f:
        f.write(incl)

    libname = r'^mirao52e\.lib$'
    try:
        lib_path = path.dirname(find_file(tops, libname, expats=['i386']))
    except ValueError:
        return

    fillout.append(
        Extension('devwraps.mirao52e', [r'devwraps\mirao52e.pyx'],
                  include_dirs=[r'devwraps', numpy.get_include()],
                  library_dirs=[lib_path],
                  libraries=['mirao52e']))
    remove.append(r'devwraps\mirao52e.c')
    remove.append(r'devwraps\mirao52e.h')
Ejemplo n.º 4
0
def make_asdk(fillout, remove, pkgdata):
    hname = r'^asdkType\.h$'
    tops = get_paths('asdk')
    try:
        include_path = path.dirname(find_file(tops, hname, expats=[]))
    except ValueError:
        return

    libname = r'^ASDK\.lib$'
    try:
        lib_path = path.dirname(find_file(tops, libname, expats=['x86']))
    except ValueError:
        return

    fillout.append(
        Extension(
            'devwraps.asdk', [r'devwraps\asdk.pyx'],
            include_dirs=[r'devwraps',
                          numpy.get_include(), include_path],
            library_dirs=[lib_path],
            libraries=['ASDK']))
    remove.append(r'devwraps\asdk.c')
Ejemplo n.º 5
0
def make_ximea(fillout, remove, pkgdata):
    libname = r'^xiapi64\.lib$'
    expats = ['32bit']
    tops = get_paths('ximea')
    try:
        dllpath = path.dirname(find_file(tops, libname, expats=expats))
    except ValueError:
        return

    copies = [
        (r'^m3ErrorCodes\.h$', 'm3ErrorCodes.h'),
        (r'^m3Identify\.h$', 'm3Identify.h'),
        (r'^sensorsIdentify\.h$', 'sensorsIdentify.h'),
        (r'^xiApi\.h$', 'xiApi.h'),
    ]
    for t in copies:
        pat, n = t
        hf = find_file(tops, pat, expats=expats)
        copyfile(hf, path.join('devwraps', n))

    with open(path.join('devwraps', 'xiApi.h'), 'r') as f:
        incl = f.read().replace('WIN32', '_WIN64')
    with open(path.join('devwraps', 'xiApi.h'), 'w') as f:
        f.write(incl)

    fillout.append(
        Extension(
            'devwraps.ximea',
            [r'devwraps\ximea.pyx'],
            include_dirs=[r'devwraps', numpy.get_include()],
            library_dirs=[dllpath],
            libraries=['xiapi64'],
        ))
    remove.append(r'devwraps\ximea.c')
    for t in copies:
        _, n = t
        remove.append(path.join('devwraps', n))
Ejemplo n.º 6
0
def make_sdk3(fillout, remove, pkgdata):
    hname = r'^atcore\.h$'
    tops = get_paths('sdk3')
    try:
        include_path = path.dirname(find_file(tops, hname, expats=['win32']))
    except ValueError:
        return

    libname = r'^atcorem\.lib$'
    try:
        lib_path = path.dirname(find_file(tops, libname, expats=['Source']))
    except ValueError:
        return

    fillout.append(
        Extension(
            'devwraps.sdk3',
            [r'devwraps\sdk3.pyx'],
            include_dirs=[r'devwraps',
                          numpy.get_include(), include_path],
            library_dirs=[lib_path],
            libraries=['atcorem'],
        ))
    remove.append(r'devwraps\sdk3.c')
Ejemplo n.º 7
0
def make_thorcam(fillout, remove, pkgdata):
    hname = r'^uc480\.h$'
    tops = get_paths('thorcam')
    try:
        include_path = path.dirname(find_file(tops, hname, expats=['Source']))
    except ValueError:
        return

    libname = r'^uc480_64\.lib$'
    try:
        lib_path = path.dirname(find_file(tops, libname, expats=['Source']))
    except ValueError:
        return

    pristine = path.join(include_path, 'uc480.h')
    patched = path.join(r'devwraps', 'uc480.h')

    with open(pristine, 'r') as f:
        incl = f.read()
    incl = re.sub(r'#define IS_SENSOR_C1280G12M *0x021E', '', incl, 1)
    incl = re.sub(r'#define IS_SENSOR_C1280G12C *0x021F', '', incl, 1)
    incl = re.sub(r'#define IS_SENSOR_C1280G12N *0x0220', '', incl, 1)
    incl = re.sub(r'extern "C" __declspec', r'extern __declspec', incl, 2)
    with open(patched, 'w') as f:
        f.write(incl)

    fillout.append(
        Extension(
            'devwraps.thorcam',
            [r'devwraps\thorcam.pyx'],
            include_dirs=[r'devwraps', numpy.get_include()],
            library_dirs=[lib_path],
            libraries=['uc480_64'],
        ))
    remove.append(patched)
    remove.append(r'devwraps\thorcam.c')