File: setup-min.py

package info (click to toggle)
astrometry.net 0.76%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 18,120 kB
  • sloc: ansic: 161,636; python: 19,915; makefile: 1,439; awk: 159; cpp: 78; pascal: 67; sh: 61; perl: 9
file content (46 lines) | stat: -rw-r--r-- 1,461 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# This file is part of libkd.
# Licensed under a 3-clause BSD style license - see LICENSE
from __future__ import print_function
from distutils.core import setup, Extension
import numpy
import os.path

from numpy.distutils.misc_util import get_numpy_include_dirs
numpy_inc = get_numpy_include_dirs()
print('Numpy inc:', numpy_inc)

def strlist(s, split=' '):
    lst = s.split(split)
    lst = [i.strip() for i in lst]
    lst = [i for i in lst if len(i)]
    return lst

link = ' '.join([os.environ.get('LDFLAGS', ''),
                 os.environ.get('LDLIBS', ''),])
link = strlist(link)
#objs = strlist(os.environ.get('SLIB', ''))
inc = strlist(os.environ.get('INC', ''), split='-I')
cflags = strlist(os.environ.get('CFLAGS', ''))

print('link:', link)
#print 'objs:', objs
print('inc:', inc)
print('cflags:', cflags)

c_module = Extension('spherematch_c',
                     sources = ['pyspherematch.c'],
                     include_dirs = numpy_inc + inc,
                     extra_objects = ['libkd-min.a'],
                     extra_compile_args = cflags,
                     extra_link_args=link,
    )

setup(name = 'Kdtree matching in Python',
      version = '1.0',
      description = 'This package finds near neighbours in two sets of points',
      author = 'Astrometry.net (Dustin Lang)',
      author_email = 'dstndstn@gmail.com',
      url = 'http://astrometry.net',
      py_modules = [ 'spherematch' ],
      ext_modules = [c_module])