Skip to content

Commit

Permalink
Added setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ddemidov committed Sep 26, 2014
1 parent f66797d commit d0f8b37
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions python/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
from setuptools import setup, Extension
import os, sys
import numpy

pyver = sys.version_info

def find_file(filename, search_dirs):
for dirname in search_dirs:
for root, dirs, files in os.walk(dirname):
for f in files:
if filename in f:
return dirname
for d in dirs:
if filename in d:
return dirname
if filename in root:
return dirname
return False


def boost_python_lib():
library_dirs = [
'/usr/local/lib64/',
'/usr/lib64/',
'/usr/local/lib/',
'/usr/lib/',
'/opt/local/lib/'
]

path = find_file("libboost_python-%s.%s" % (pyver[0], pyver[1]), library_dirs)
if path: return path

if _version >= (3, ):
path = find_file("libboost_python-py%s%s" % (pyver[0], pyver[1]), library_dirs)
if path: return path

return "boost_python"

setup(
name='pyamgcl',
version='0.5.0',
description='Solution of large sparse linear systems with Algebraic Multigrid Method',
author='Denis Demidov',
author_email='dennis.demidov@gmail.com',
url='https://github.com/ddemidov/amgcl',
include_package_data=True,
zip_safe=False,
ext_modules=[
Extension('pyamgcl',
['pyamgcl.cpp'],
include_dirs=['..', numpy.get_include()],
libraries=[boost_python_lib()]
)
]
)

0 comments on commit d0f8b37

Please sign in to comment.