setup.py 1.68 KB
Newer Older
Soumith Chintala's avatar
Soumith Chintala committed
1
#!/usr/bin/env python
2
3
import os
import platform
Soumith Chintala's avatar
Soumith Chintala committed
4
5

from setuptools import setup, find_packages
6
from torch.utils.cpp_extension import BuildExtension, CppExtension
Soumith Chintala's avatar
Soumith Chintala committed
7

8
9
10
11
12
13
14
15
16
17
18
19
20
21

def check_env_flag(name, default=''):
    return os.getenv(name, default).upper() in set(['ON', '1', 'YES', 'TRUE', 'Y'])

DEBUG = check_env_flag('DEBUG')
eca = []
ela = []
if DEBUG:
    if platform.system() == 'Windows':
        ela += ['/DEBUG:FULL']
    else:
        eca += ['-O0', '-g']
        ela += ['-O0', '-g']

Soumith Chintala's avatar
Soumith Chintala committed
22
23
setup(
    name="torchaudio",
David Pollack's avatar
David Pollack committed
24
    version="0.2",
Soumith Chintala's avatar
Soumith Chintala committed
25
26
    description="An audio package for PyTorch",
    url="https://github.com/pytorch/audio",
27
    author="Soumith Chintala, David Pollack, Sean Naren, Peter Goldsborough",
Soumith Chintala's avatar
Soumith Chintala committed
28
    author_email="soumith@pytorch.org",
Hong Xu's avatar
Hong Xu committed
29
30
31
32
33
34
35
36
37
38
39
40
41
42
    classifiers=[
        "Environment :: Plugins",
        "Intended Audience :: Developers",
        "Intended Audience :: Science/Research",
        "License :: OSI Approved :: BSD License",
        "Operating System :: MacOS :: MacOS X",
        "Operating System :: Microsoft :: Windows",
        "Operating System :: POSIX",
        "Programming Language :: C++",
        "Programming Language :: Python 3",
        "Programming Language :: Python :: Implementation :: CPython",
        "Topic :: Multimedia :: Sound/Audio",
        "Topic :: Scientific/Engineering :: Artificial Intelligence"
    ],
Soumith Chintala's avatar
Soumith Chintala committed
43
44
    # Exclude the build files.
    packages=find_packages(exclude=["build"]),
45
46
    ext_modules=[
        CppExtension(
47
48
49
50
51
            '_torch_sox',
            ['torchaudio/torch_sox.cpp'],
            libraries=['sox'],
            extra_compile_args=eca,
            extra_link_args=ela),
Soumith Chintala's avatar
Soumith Chintala committed
52
    ],
53
54
55
    cmdclass={'build_ext': BuildExtension},
    install_requires=['torch']
)