forked from samson-wang/cython_bbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
60 lines (52 loc) · 1.87 KB
/
setup.py
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
55
56
57
58
59
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Samson Wang
# --------------------------------------------------------
from __future__ import print_function
from setuptools import Extension
from setuptools import setup
from distutils.command.build import build as _build
import os
# ref from https://stackoverflow.com/questions/54117786/add-numpy-get-include-argument-to-setuptools-without-preinstalled-numpy
class build(_build):
def finalize_options(self):
super().finalize_options()
import builtins
builtins.__NUMPY_SETUP__ = False
import numpy as np
# Obtain the numpy include directory. This logic works across numpy versions.
extension = next(m for m in self.distribution.ext_modules if m.name=='cython_bbox')
try:
extension.include_dirs.append(np.get_include())
except AttributeError:
extension.include_dirs.append(np.get_numpy_include())
with open("README.md", "r") as fh:
long_description = fh.read()
if os.name == 'nt':
compile_args = {'gcc': ['/Qstd=c99']}
else:
compile_args = ['-Wno-cpp']
ext_modules = [
Extension(
name='cython_bbox',
sources=['src/cython_bbox.pyx'],
extra_compile_args = compile_args,
)
]
setup(
name='cython_bbox',
setup_requires=["setuptools>=18.0","Cython","numpy"],
install_requires=["Cython","numpy"],
ext_modules=ext_modules,
cmdclass={'build': build},
version = '2023.04.20',
description = 'Standalone cython_bbox',
long_description=long_description,
long_description_content_type="text/markdown",
author = 'Samson Wang',
author_email = 'samson.c.wang@gmail.com',
url = 'https://github.com/samson-wang/cython_bbox.git',
keywords = ['cython_bbox']
)