python 2 support

This commit is contained in:
Soumith Chintala
2016-05-12 17:49:16 -04:00
parent 6954783d9d
commit 5ee3358a92
15 changed files with 196 additions and 63 deletions

View File

@ -1,5 +1,7 @@
from setuptools import setup, Extension
from os.path import expanduser
from tools.cwrap import cwrap
import platform
################################################################################
# Generate __init__.py from templates
@ -49,6 +51,16 @@ for src in cwrap_src:
################################################################################
# Declare the package
################################################################################
extra_link_args = []
# TODO: remove and properly submodule TH in the repo itself
th_path = expanduser("~/torch/install/")
th_header_path = th_path + "include"
th_lib_path = th_path + "lib"
if platform.system() == 'Darwin':
extra_link_args.append('-L' + th_lib_path)
extra_link_args.append('-Wl,-rpath,' + th_lib_path)
sources = [
"torch/csrc/Module.cpp",
"torch/csrc/Tensor.cpp",
@ -59,9 +71,13 @@ C = Extension("torch.C",
libraries=['TH'],
sources=sources,
language='c++',
include_dirs=["torch/csrc"])
include_dirs=(["torch/csrc", th_header_path]),
extra_link_args = extra_link_args,
)
setup(name="torch", version="0.1",
ext_modules=[C],
packages=['torch'])
packages=['torch'],
)