File: setup.py

package info (click to toggle)
python-drizzle 2.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 203,192 kB
  • sloc: ansic: 6,927; python: 2,054; makefile: 128
file content (54 lines) | stat: -rwxr-xr-x 1,531 bytes parent folder | download
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
47
48
49
50
51
52
53
54
#!/usr/bin/env python
# Licensed under a 3-clause BSD style license - see LICENSE.rst

import os
import sys

import numpy
from setuptools import Extension, setup


def get_extensions():
    srcdir = os.path.join(os.path.dirname(__file__), 'src')
    cdriz_sources = ['cdrizzleapi.c',
                     'cdrizzleblot.c',
                     'cdrizzlebox.c',
                     'cdrizzlemap.c',
                     'cdrizzleutil.c',
                     os.path.join('tests', 'utest_cdrizzle.c')]
    sources = [os.path.join(srcdir, x) for x in cdriz_sources]

    cfg = {
        'include_dirs': [],
        'libraries': [],
        'define_macros': [],
    }
    cfg['include_dirs'].append(numpy.get_include())
    cfg['include_dirs'].append(srcdir)

    if sys.platform == 'win32':
        cfg['define_macros'].extend(
            [
                ('WIN32', None),
                ('__STDC__', 1),
                ('_CRT_SECURE_NO_WARNINGS', None),
            ]
        )
    else:
        cfg['libraries'].append('m')
        cfg['extra_compile_args'] = [
            '-O3',
            '-Wall',
            '-Wextra',
            '-Wpedantic',
            '-Wno-unused-parameter',
            '-Wincompatible-pointer-types'
        ]
    # importing these extension modules is tested in `.github/workflows/build.yml`;
    # when adding new modules here, make sure to add them to the `test_command` entry there
    return [Extension(str('drizzle.cdrizzle'), sources, **cfg)]


setup(
    ext_modules=get_extensions(),
)