-
Notifications
You must be signed in to change notification settings - Fork 4
/
setup.py
139 lines (119 loc) · 4.41 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
# Copyright 2017-2021 Lawrence Livermore National Security, LLC and other
# CallFlow Project Developers. See the top-level LICENSE file for details.
#
# SPDX-License-Identifier: MIT
import os
from setuptools import setup, find_packages
import pathlib
# get the version safely!
from codecs import open
here = pathlib.Path(__file__).parent.resolve()
# Get the long description from the README file
long_description = (here / "README.md").read_text(encoding="utf-8")
# ------------------------------------------------------------------------------
version = {}
vfile = os.path.join(here, "callflow", "version.py")
with open(vfile) as fp:
exec(fp.read(), version)
version = version["__version__"]
# ------------------------------------------------------------------------------
# Only allow folders in https://github.com/LLNL/CallFlow/tree/develop/data to be added.
# For now we are hard-coding this.
# TODO: Find a more automated solution.
_GITHUB_DATA_FOLDERS = [
"caliper-cali",
"caliper-lulesh-json",
"hpctoolkit-cpi-databases",
]
# Only allow jupyter notebooks in https://github.com/LLNL/CallFlow/tree/develop/example to be added.
_GITHUB_EXAMPLE_FILES = [
"%callflow-ipython-magic.ipynb",
"CallFlow-python-interface-demo.ipynb",
]
_APP_DIST_FOLDERS = [
"js",
"css",
"fonts",
]
_APP_DIST_INDEX_HTML = ["index.html"]
def list_files_update(directory, whitelist_files=[], whitelist_folders=[]):
"""
Returns the paths of all children files after checking it with the
whitelisted folders or files.
directory: Path to iterate
whitelist_files: Array(files to only consider)
whitelist_folders: Array(folders to only consider)
"""
paths = []
if len(whitelist_folders) > 0:
for item in os.listdir(directory):
if item in whitelist_folders:
for (path, directories, filenames) in os.walk(
os.path.join(directory, item)
):
if ".callflow" not in path.split("/"):
paths += [os.path.join(path, f) for f in filenames]
if len(whitelist_files) > 0:
for (path, directories, filenames) in os.walk(directory):
paths += [os.path.join(path, f) for f in filenames if f in whitelist_files]
return paths
data_files = list_files_update("data", whitelist_folders=_GITHUB_DATA_FOLDERS)
example_files = list_files_update("examples", whitelist_files=_GITHUB_EXAMPLE_FILES)
app_dist_folders = list_files_update("app/dist", whitelist_folders=_APP_DIST_FOLDERS)
app_dist_index_html = list_files_update(
"app/dist", whitelist_files=_APP_DIST_INDEX_HTML
)
# ------------------------------------------------------------------------------
# these folders live outside the callflow "package" in the src distribution
# but we want to install them within the callflow installed package
# i.e., in .../site-packages/callflow/app
# so, let's create a symlink inside the callflow folder
# so setuptools can place them relative to the installed package
os.chdir("./callflow")
for _ in ["app", "data", "examples"]:
if not os.path.islink(_):
os.symlink(os.path.join("..", _), _)
os.chdir("..")
# ------------------------------------------------------------------------------
deps = [
"numpy",
"scipy",
"pandas",
"llnl-hatchet",
"scikit_learn",
"colorlog",
"jsonschema",
"networkx",
"matplotlib",
"ipython",
"flask_cors",
"pyinstrument",
"psutil",
]
# ------------------------------------------------------------------------------
# now set up
setup(
name="CallFlow",
version=version,
license="MIT",
description="An Interactive Visual Analysis Tool for visualizing Calling Context Trees, Call Graphs from Performance Profiles.",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/LLNL/CallFlow",
author="Suraj Kesavan",
author_email="spkesavan@ucdavis.edu",
classifiers=[
"Development Status :: 3 - Alpha",
"License :: OSI Approved :: MIT License",
],
keywords="",
packages=find_packages(),
include_package_data=True,
zip_safe=False,
package_data={
"callflow": data_files + example_files + app_dist_folders + app_dist_index_html
},
entry_points={"console_scripts": ["callflow = server.main:main"]},
install_requires=deps,
)
# ------------------------------------------------------------------------------