-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetup.py
64 lines (58 loc) · 1.53 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
from setuptools import setup
from setuptools.command.install import install
from setuptools.command.develop import develop
from setuptools.command.egg_info import egg_info
import subprocess as sp
import platform
def make_hkl():
'''
Compile the C huckel code and turns it in a dynamic library
'''
print('--> Compile huckel library')
src_path = './husky/hamiltonian/huckel/src/'
osname = platform.system()
if osname == 'Linux':
cmd = 'gcc -shared -o ../hkl.so -fPIC huckel.c'
elif osname == 'Darwin':
cmd = 'gcc -dynamiclib huckel.c -o ../hkl.so'
else:
raise ValueError('Environement %s not supported.' %osname)
sp.check_call(cmd,cwd=src_path,shell=True)
class hklinstall(install):
'''
custom hadler for the install command
'''
def run(self):
make_hkl()
super().run()
class hkldevelop(develop):
'''
custom hadler for the install command
'''
def run(self):
make_hkl()
super().run()
class hklegg(egg_info):
'''
custom hadler for the install command
'''
def run(self):
make_hkl()
super().run()
setup(
name='husky',
description='huskython: Husky in Python ',
version='0.1-dev',
url='https://github.com/NicoRenaud/huskython',
packages=['husky'],
install_requires=[
'numpy>=1.13.3',
'scipy>=1.0.0'
],
extras_require={
'test':['nose','coverage']
},
cmdclass={'install' : hklinstall,
'develop' : hkldevelop,
'egg_info': hklegg }
)