-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathsetup.py
executable file
·150 lines (117 loc) · 4.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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#!/usr/bin/env python
# flake8: noqa
"""Setup script for abiflows."""
import sys
import os
import shutil
from glob import glob
from setuptools import find_packages, setup
#-------------------------------------------------------------------------------
# Useful globals and utility functions
#-------------------------------------------------------------------------------
# A little utility we'll need below, since glob() does NOT allow you to do exclusion on multiple endings!
def file_doesnt_end_with(test, endings):
"""
Returns true if test is a file and its name does NOT end with any
of the strings listed in endings.
"""
if not os.path.isfile(test):
return False
for e in endings:
if test.endswith(e):
return False
return True
#---------------------------------------------------------------------------
# Basic project information
#---------------------------------------------------------------------------
# release.py contains version, authors, license, url, keywords, etc.
release_file = os.path.join('abiflows', 'core', 'release.py')
with open(release_file) as f:
code = compile(f.read(), release_file, 'exec')
exec(code)
#---------------------------------------------------------------------------
# Find package data
#---------------------------------------------------------------------------
def find_package_data():
"""Find abiflows package_data."""
# This is not enough for these things to appear in an sdist.
# We need to muck with the MANIFEST to get this to work
package_data = {'abiflows.fireworks.tasks': ['n1000multiples_primes.json']
}
return package_data
def find_exclude_package_data():
package_data = {
# 'abiflows.data' : ["managers", 'benchmarks','runs/flow_*'],
}
return package_data
#---------------------------------------------------------------------------
# Find scripts
#---------------------------------------------------------------------------
def find_scripts():
"""Find abiflows scripts."""
scripts = []
# All python files in abiflows/scripts
pyfiles = glob(os.path.join('abiflows', 'scripts', "*.py"))
scripts.extend(pyfiles)
return scripts
def get_long_desc():
with open("README.md") as f:
return f.read()
#-----------------------------------------------------------------------------
# Function definitions
#-----------------------------------------------------------------------------
def cleanup():
"""Clean up the junk left around by the build process."""
if "develop" not in sys.argv:
try:
shutil.rmtree('abiflows.egg-info')
except Exception:
try:
os.unlink('abiflows.egg-info')
except Exception:
pass
# List of external packages we rely on.
# Note setup install will download them from Pypi if they are not available.
install_requires = [
"six",
"numpy",
"pymongo",
"prettytable",
"mongoengine",
"paramiko",
"custodian",
"fireworks",
"abipy>=0.7.0",
]
#---------------------------------------------------------------------------
# Find all the packages, package data, and data_files
#---------------------------------------------------------------------------
# Get the set of packages to be included.
my_packages = find_packages(exclude=())
my_scripts = find_scripts()
my_package_data = find_package_data()
my_excl_package_data = find_exclude_package_data()
# Create a dict with the basic information
# This dict is eventually passed to setup after additional keys are added.
setup_args = dict(
name=name,
version=version,
description=description,
long_description=long_description,
author=author,
author_email=author_email,
url=url,
license=license,
platforms=platforms,
keywords=keywords,
classifiers=classifiers,
install_requires=install_requires,
packages=my_packages,
package_data=my_package_data,
exclude_package_data=my_excl_package_data,
scripts=my_scripts,
#download_url=download_url,
)
if __name__ == "__main__":
setup(**setup_args)
cleanup()