forked from molmod/yaff
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
executable file
·112 lines (105 loc) · 4.49 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# YAFF is yet another force-field code
# Copyright (C) 2011 - 2013 Toon Verstraelen <Toon.Verstraelen@UGent.be>,
# Louis Vanduyfhuys <Louis.Vanduyfhuys@UGent.be>, Center for Molecular Modeling
# (CMM), Ghent University, Ghent, Belgium; all rights reserved unless otherwise
# stated.
#
# This file is part of YAFF.
#
# YAFF is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# YAFF is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>
#
#--
from glob import glob
import numpy as np, os
from distutils.core import setup
from distutils.extension import Extension
from distutils.command.install_data import install_data
from Cython.Distutils import build_ext
class my_install_data(install_data):
"""Add a datadir.txt file that points to the root for the data files. It is
otherwise impossible to figure out the location of these data files at
runtime.
"""
def run(self):
# Do the normal install_data
install_data.run(self)
# Create the file datadir.txt. It's exact content is only known
# at installation time.
dist = self.distribution
libdir = dist.command_obj["install_lib"].install_dir
for name in dist.packages:
if '.' not in name:
destination = os.path.join(libdir, name, "data_dir.txt")
print "Creating %s" % destination
if not self.dry_run:
f = file(destination, "w")
print >> f, self.install_dir
f.close()
def find_all_data_files(dn):
result = []
for root, dirs, files in os.walk(os.path.join('data', dn)):
if len(files) > 0:
files = [os.path.join(root, fn) for fn in files]
result.append(('share/yaff/' + root[5:], files))
return result
setup(
name='yaff',
version='1.0.develop.2.13',
description='YAFF is yet another force-field code.',
author='Toon Verstraelen',
author_email='Toon.Verstraelen@UGent.be',
url='http://molmod.ugent.be/code/',
scripts=glob("scripts/yaff-*.py"),
package_dir = {'yaff': 'yaff'},
packages=['yaff', 'yaff/test', 'yaff/pes', 'yaff/pes/test', 'yaff/sampling',
'yaff/sampling/test', 'yaff/analysis', 'yaff/analysis/test',
'yaff/tune', 'yaff/tune/test', 'yaff/conversion',
'yaff/conversion/'],
cmdclass = {'build_ext': build_ext, 'install_data': my_install_data},
data_files=[
('share/yaff/test', glob('data/test/*.*')),
] + find_all_data_files('examples'),
ext_modules=[
Extension("yaff.pes.ext",
sources=['yaff/pes/ext.pyx', 'yaff/pes/nlist.c',
'yaff/pes/pair_pot.c', 'yaff/pes/ewald.c',
'yaff/pes/dlist.c', 'yaff/pes/grid.c', 'yaff/pes/iclist.c',
'yaff/pes/vlist.c', 'yaff/pes/cell.c',
'yaff/pes/truncation.c', 'yaff/pes/slater.c'],
depends=['yaff/pes/nlist.h', 'yaff/pes/nlist.pxd',
'yaff/pes/pair_pot.h', 'yaff/pes/pair_pot.pxd',
'yaff/pes/ewald.h', 'yaff/pes/ewald.pxd',
'yaff/pes/dlist.h', 'yaff/pes/dlist.pxd',
'yaff/pes/grid.h', 'yaff/pes/grid.pxd',
'yaff/pes/iclist.h', 'yaff/pes/iclist.pxd',
'yaff/pes/vlist.h', 'yaff/pes/vlist.pxd',
'yaff/pes/cell.h', 'yaff/pes/cell.pxd',
'yaff/pes/truncation.h', 'yaff/pes/truncation.pxd',
'yaff/pes/slater.h', 'yaff/pes/slater.pxd',
'yaff/pes/constants.h'],
include_dirs=[np.get_include()],
),
],
classifiers=[
'Development Status :: 3 - Alpha',
'Environment :: Console',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: GNU General Public License (GPL)',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python',
'Topic :: Science/Engineering :: Molecular Science'
],
)