-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py
92 lines (77 loc) · 3.13 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
from distutils.command.build import build as _build
import subprocess
import setuptools
# This class handles the pip install mechanism.
class build(_build): # pylint: disable=invalid-name
"""A build command class that will be invoked during package install.
"""
sub_commands = _build.sub_commands + [('CustomCommands', None)]
CUSTOM_COMMANDS = [
# ['sudo apt-get update'.split()],
# ['sudo apt-get -y install build-essentials'.split()],
# ['sudo spt-get -y install gfortran'.split()],
# ['sudo apt-get -y install python3-dev'.split()],
# ['sudo apt-get -y install libopenmpi-dev'.split()],
# ['sudo apt-get -y install openmpi-bin'.split()],
# ['sudo apt-get -y install libgsl-dev'.split()],
# ['sudo apt-get -y install cmake'.split()],
# ['sudo apt-get -y install libfftw3-3'.split()],
# ['sudo apt-get -y install libfftw3-dev'.split()],
# ['sudo apt-get -y install libgmp3-dev'.split()],
# ['sudo apt-get -y install libmpfr6'.split()],
# ['sudo apt-get -y install libmpfr-dev'.split()],
# ['sudo apt-get -y install libhdf5-serial-dev'.split()],
# ['sudo apt-get -y install hdf5-tools'.split()],
# ['sudo apt-get -y install libblas-dev'.split()],
# ['sudo apt-get -y install liblapack-dev'.split()],
# ['sudo apt-get -y install python3-venv'.split()],
# ['sudo apt-get -y install python3-pip'.split()],
# ['sudo apt-get -y install git'.split()]
# ['pip', 'install', 'amuse-framework'],
# ['pip', 'install', 'amuse-bse']
]
class CustomCommands(setuptools.Command):
"""A setuptools Command class able to run arbitrary commands."""
def initialize_options(self):
pass
def finalize_options(self):
pass
def RunCustomCommand(self, command_list):
print('Running command: %s' % command_list)
p = subprocess.Popen(
command_list,
stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
# Can use communicate(input='y\n'.encode()) if the command run requires
# some confirmation.
stdout_data, _ = p.communicate()
print('Command output: %s' %stdout_data)
if p.returncode != 0:
raise RuntimeError(
'Command %s failed: exit code: %s' % (command_list, p.returncode))
def run(self):
for command in CUSTOM_COMMANDS:
self.RunCustomCommand(command)
# Configure the required packages and scripts to install.
REQUIRED_PACKAGES = ['pep517', 'numpy', 'docutils','mpi4py', 'h5py', 'wheel', 'scipy', 'astropy', 'jupyter', 'pandas', 'seaborn', 'matplotlib', 'amuse-framework', 'amuse-bse', 'matplotlib', 'tqdm']
setuptools.setup(
name='BPS',
version='4.2.0',
cmdclass={
# Command class instantiated and run during pip install scenarios.
'build': build,
'CustomCommands': CustomCommands,
},
# packages=setuptools.find_packages(),
install_requires=REQUIRED_PACKAGES
)
from setuptools import setup,find_packages
with open('requirements.txt') as f:
required = f.read().splitlines()
setup(
name='BPS',
version='1.0.0-beta',
packages=find_packages(),
install_requires=required,
url='https://github.com/gautam-404/BPS',
author='gautam-404'
)