This repository has been archived by the owner on Dec 18, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathsetup.py
106 lines (88 loc) · 2.94 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
from io import open
import platform
import os, shutil, torch
from setuptools import setup, find_packages
import distutils.command.clean
from torch.utils.cpp_extension import CppExtension
class clean(distutils.command.clean.clean):
def run(self):
import glob
import re
with open('.gitignore', 'r') as f:
ignores = f.read()
pat = re.compile(r'^#( BEGIN NOT-CLEAN-FILES )?')
for wildcard in filter(None, ignores.split('\n')):
match = pat.match(wildcard)
if match:
if match.group(1):
# Marker is found and stop reading .gitignore.
break
# Ignore lines which begin with '#'.
else:
for filename in glob.glob(wildcard):
# skip vscode
vscode_pat = re.compile(r'.vscode/.*')
if re.match(vscode_pat, filename):
continue
try:
os.remove(filename)
except OSError:
shutil.rmtree(filename, ignore_errors=True)
# It's an old-style class in Python 2.7...
distutils.command.clean.clean.run(self)
with open('torch_complex/__init__.py', 'r') as f:
for line in f:
if line.startswith('__version__'):
version = line.strip().split('=')[1].strip(' \'"')
break
else:
version = '0.0.1'
with open('README.md', 'r', encoding='utf-8') as f:
readme = f.read()
REQUIRES = []
cmdclass = {
"build_ext": torch.utils.cpp_extension.BuildExtension,
'clean': clean,
}
if platform.system() == 'Darwin':
extra_compile_args = ["-g", "-stdlib=libc++", "-std=c++11"]
else:
extra_compile_args = ["-g"]
ext_modules = [
CppExtension(
"torch_complex.cpp",
["src/module.cpp"],
extra_compile_args=extra_compile_args,
)
]
setup(
name='torch-complex',
version=version,
description='',
long_description=readme,
author='Roger Luo',
author_email='[email protected]',
maintainer='Roger Luo',
maintainer_email='[email protected]',
url='https://github.com/_/torch-complex',
license='MIT',
keywords=[
'',
],
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: Implementation :: CPython',
],
install_requires=REQUIRES,
tests_require=['coverage', 'pytest'],
packages=find_packages(),
ext_modules=ext_modules,
cmdclass=cmdclass,
)