This repository has been archived by the owner on Sep 5, 2024. It is now read-only.
forked from unerue/boda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
80 lines (66 loc) · 2.72 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
from setuptools import find_packages
from numpy.distutils.core import setup
from numpy.distutils.misc_util import Configuration
from distutils.command.clean import clean as Clean
from distutils.command.sdist import sdist
import os
import shutil
def configuration(parent_package='', top_path=None):
config = Configuration(None, parent_package, top_path)
config.set_options(
ignore_setup_xxx_py=True,
assume_default_configuration=True,
delegate_options_to_subpackages=True,
quiet=True)
config.add_subpackage('boda')
return config
class CleanCommand(Clean):
description = 'Remove build artifacts from the source tree'
def run(self):
Clean.run(self)
# Remove c files if we are not within a sdist package
cwd = os.path.abspath(os.path.dirname(__file__))
remove_c_files = not os.path.exists(os.path.join(cwd, 'PKG-INFO'))
if remove_c_files:
print('Will remove generated .c files')
if os.path.exists('build'):
shutil.rmtree('build')
for dirpath, dirnames, filenames in os.walk('sklearn'):
for filename in filenames:
if any(filename.endswith(suffix) for suffix in
(".so", ".pyd", ".dll", ".pyc")):
os.unlink(os.path.join(dirpath, filename))
continue
extension = os.path.splitext(filename)[1]
if remove_c_files and extension in ['.c', '.cpp']:
pyx_file = str.replace(filename, extension, '.pyx')
if os.path.exists(os.path.join(dirpath, pyx_file)):
os.unlink(os.path.join(dirpath, filename))
for dirname in dirnames:
if dirname == '__pycache__':
shutil.rmtree(os.path.join(dirpath, dirname))
cmdclass = {'clean': CleanCommand, 'sdist': sdist}
def setup_packages():
metadata = dict(
name='boda',
version='0.0.1',
install_requires=['torch', 'numpy', 'cython'],
author='Kang, Kyung-Su',
author_email='[email protected]',
maintainer='Kang, Kyung-Su',
maintainer_email='[email protected]',
description='boda is a library for instance segmentation.',
packages=find_packages(),
# include_package_data=True,
classifiers=[
'Programming Language :: C',
'Programming Language :: Python',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8'],
cmdclass=cmdclass,
configuration=configuration,
python_requires='>=3.6')
setup(**metadata)
if __name__ == '__main__':
setup_packages()