-
Notifications
You must be signed in to change notification settings - Fork 57
/
setup.py
175 lines (156 loc) · 5.17 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
from setuptools import setup, find_packages, Extension, Command
#from skbuild import setup
from setuptools.command.build_ext import build_ext
import subprocess
import re
import os
class CMakeBuildExt(build_ext):
"""Custom command to build Submodules packages during installation."""
# def copy_extensions_to_source(self):
# "Override the method to prevent copying package files"
# pass
def finalize_options(self):
super().finalize_options()
# Process and use os.environ['CUSTOM_CONFIG_SETTINGS'] as needed
self.pip_nobuild = os.environ.get('PIP_NOBUILD')
def run(self):
package_dir = os.path.dirname(os.path.abspath(__file__))
build_dir = package_dir + "/build"
cmake_args = []
if self.pip_nobuild=="yes":
pass
else:
if not os.path.isdir(build_dir):
os.makedirs(build_dir)
subprocess.check_call(
["cmake", ".."] + cmake_args, cwd=build_dir
)
subprocess.check_call(
["make", "install", "-j4"], cwd=build_dir
)
super().run()
def run():
pip_nobuild = os.environ.get('PIP_NOBUILD')
package_dir = os.path.dirname(os.path.abspath(__file__))
build_dir = package_dir + "/build"
cmake_args = []
if pip_nobuild=="yes":
pass
else:
if not os.path.isdir(build_dir):
os.makedirs(build_dir)
subprocess.check_call(
["cmake", ".."] + cmake_args, cwd=build_dir
)
subprocess.check_call(
["make", "install", "-j4"], cwd=build_dir
)
class BuildCommand(Command):
"""Custom command to build Submodules packages without installation."""
description = 'Build Submodules in lib packages'
user_options = [
('cmake-args=', None, 'Additional CMake arguments'),
]
def initialize_options(self):
self.cmake_args = None
def finalize_options(self):
pass
def run(self):
# Run the CMake build step with additional cmake_args
package_dir = os.path.dirname(os.path.abspath(__file__))
build_dir = package_dir + "/build"
if not os.path.isdir(build_dir):
os.makedirs(build_dir)
if self.cmake_args is not None:
subprocess.check_call(
["cmake", f"{self.cmake_args}", ".."], cwd=build_dir
)
else:
subprocess.check_call(
["cmake", ".."], cwd=build_dir
)
subprocess.check_call(
["make", "install", "-j4"], cwd=build_dir
)
ext_modules = [
Extension('lib', []),
# Add more Extension instances for additional extension modules
]
this_directory = os.path.abspath(os.path.dirname(__file__))
__version__ = re.findall(
r"""__version__ = ["']+([0-9\.]*)["']+""",
open(os.path.join(this_directory, "sharpy/version.py")).read(),
)[0]
with open(os.path.join(this_directory, "README.md"), encoding="utf-8") as f:
long_description = f.read()
run()
setup(
name="ic_sharpy", # due to the name sharpy being taken on pypi
version=__version__,
description="""SHARPy is a nonlinear aeroelastic analysis package developed
at the Department of Aeronautics, Imperial College London. It can be used
for the structural, aerodynamic and aeroelastic analysis of flexible
aircraft, flying wings and wind turbines.""",
long_description=long_description,
long_description_content_type="text/markdown",
keywords="nonlinear aeroelastic structural aerodynamic analysis",
author="",
author_email="",
url="https://github.com/ImperialCollegeLondon/sharpy",
license="BSD 3-Clause License",
#ext_modules=ext_modules,
cmdclass={#"build_ext": CMakeBuildExt,
"build_subm": BuildCommand},
packages=find_packages(
where='./',
include=['sharpy*'],
exclude=['tests']
),
# data_files=[
# ("./lib/UVLM/lib", ["libuvlm.so"]),
# ("./lib/xbeam/lib", ["libxbeam.so"])
# ],
python_requires=">=3.8",
install_requires=[
"numpy<2.0",
"configobj",
"h5py",
"scipy<1.14.0",
"sympy",
"matplotlib",
"colorama",
"dill",
"jupyterlab",
"mayavi", # github direct dependency removed since pip version is fixed, and also not compatible with pypi
"pandas",
"control",
"openpyxl>=3.0.10",
"lxml>=4.4.1",
"PySocks",
"PyYAML"
],
extras_require={
"docs": [
"sphinx",
"recommonmark>=0.6.0",
"sphinx_rtd_theme>=0.4.3",
"nbsphinx>=0.4.3"
],
"all": [
"sphinx",
"recommonmark>=0.6.0",
"sphinx_rtd_theme>=0.4.3",
"nbsphinx>=0.4.3"
],
},
classifiers=[
"Operating System :: MacOS",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3.10",
"Programming Language :: Fortran",
"Programming Language :: C++"
],
entry_points={
'console_scripts': ['sharpy=sharpy.sharpy_main:sharpy_run'],
}
)