-
Notifications
You must be signed in to change notification settings - Fork 17
/
setup.py
executable file
·51 lines (39 loc) · 1.45 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
#! /usr/bin/env python3
import os, glob
import shutil
from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext
from distutils.version import LooseVersion
import sys
sys.path.insert(0, 'mirheo')
import version
class BinaryExtension(Extension):
def __init__(self, name, sourcedir=''):
Extension.__init__(self, name, sources=[])
self.sourcedir = os.path.abspath(sourcedir)
class CopyLibrary(build_ext):
def run(self):
for ext in self.extensions:
self.copy_extension(ext)
def copy_extension(self, ext):
extdir = os.path.abspath(os.path.dirname(self.get_ext_fullpath(ext.name)))
library = glob.glob(ext.sourcedir + '/build/src/mirheo/bindings/libmirheo.cpython*.so')
if (len(library) == 0):
raise ValueError('No pre-build library found in folder ' +
ext.sourcedir + '/build/')
shutil.copy2(library[0], extdir)
setup(
name='Mirheo',
version=version.mir_version,
author='Dmitry Alexeev, Lucas Amoudruz, Ivica Kicic',
description='Computational Microfluidics',
long_description='',
packages = ['mirheo'],
package_dir = {'mirheo' : 'mirheo'},
ext_modules=[BinaryExtension('libmirheo', sourcedir='./')],
cmdclass=dict(build_ext=CopyLibrary),
url='https://mirheo.readthedocs.io/en/latest/',
license='MIT',
zip_safe=False,
)