-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathsetup.py
executable file
·127 lines (118 loc) · 5.1 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# YAFF is yet another force-field code.
# Copyright (C) 2011 Toon Verstraelen <[email protected]>,
# Louis Vanduyfhuys <[email protected]>, 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 __future__ import print_function
import os
import subprocess
import sys
from glob import glob
import numpy as np
from setuptools import setup
from setuptools.extension import Extension
from Cython.Build import build_ext
# Try to get the version from git describe
__version__ = None
try:
print('Trying to get the version from git describe')
git_describe = subprocess.check_output(["git", "describe", "--tags"])
version_words = git_describe.decode('utf-8').strip().split('-')
__version__ = version_words[0]
if len(version_words) > 1:
__version__ += '.post' + version_words[1]
print('Version from git describe: {}'.format(__version__))
except (subprocess.CalledProcessError, OSError):
pass
# Interact with version.py
fn_version = os.path.join(os.path.dirname(__file__), 'yaff', 'version.py')
version_template = """\
\"""Do not edit this file, versioning is governed by ``git describe --tags`` and ``setup.py``.\"""
__version__ = '{}'
"""
if __version__ is None:
print('Trying to get the version from {}',format(fn_version))
# Try to load the git version tag from version.py
try:
with open(fn_version, 'r') as fh:
__version__ = fh.read().split('=')[-1].replace('\'', '').strip()
except IOError:
print('Could not determine version. Giving up.')
sys.exit(1)
print('Version according to {}: {}'.format(fn_version, __version__))
else:
# Store the git version tag in version.py
print('Writing version to {}'.format(fn_version))
with open(fn_version, 'w') as fh:
fh.write(version_template.format(__version__))
setup(
name='yaff',
version=__version__,
description='YAFF is yet another force-field code.',
author='Toon Verstraelen',
author_email='[email protected]',
url='http://molmod.ugent.be/code/',
scripts=glob("scripts/yaff-*"),
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/test', 'yaff/external', 'yaff/external/test'],
cmdclass = {'build_ext': build_ext},
include_package_data=True,
zip_safe=False,
setup_requires=['numpy>=1.5', 'cython>=0.26'],
install_requires=['numpy>=1.5', 'nose>=0.11', 'cython>=0.26', 'matplotlib>1.0.0',
'h5py>=2.0.0', 'molmod>=1.4.1', 'scipy>=0.17.1'],
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/comlist.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', 'yaff/pes/tailcorr.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/comlist.h', 'yaff/pes/comlist.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', 'yaff/pes/tailcorr.h'],
include_dirs=[np.get_include()],
),
],
classifiers=[
'Environment :: Console',
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Topic :: Scientific/Engineering :: Physics',
'Topic :: Scientific/Engineering :: Chemistry',
'Intended Audience :: Science/Research',
],
)