This repository has been archived by the owner on Apr 23, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
74 lines (57 loc) · 1.97 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
import os
import sys
from setuptools import setup, find_packages, Command
from setuptools.command.bdist_egg import bdist_egg
from packageinfo import NAME, VERSION
with open('README.rst', 'r') as readme:
README_TEXT = readme.read()
class CleanCommand(Command):
description = "custom clean command \
that forcefully removes dist/build directories"
user_options = []
def initialize_options(self):
self.cwd = None
def finalize_options(self):
self.cwd = os.getcwd()
def run(self):
assert os.getcwd() == self.cwd, 'Must be in root: %s' % self.cwd
os.system('./Allwclean')
class BdistEggCommand(bdist_egg):
"""Customized setuptools bdist_egg command - prints a friendly greeting."""
def run(self):
if '--user' in sys.argv:
os.system("./install_foam_interface.sh --user")
else:
os.system("./install_foam_interface.sh")
bdist_egg.run(self)
def write_version_py(filename=None):
if filename is None:
filename = os.path.join(
os.path.dirname(__file__), 'foam_controlwrapper', 'version.py')
ver = """\
version = '%s'
"""
fh = open(filename, 'wb')
try:
fh.write(ver % VERSION)
finally:
fh.close()
write_version_py(os.path.join(os.path.dirname(__file__),
'foam_controlwrapper', 'version.py'))
write_version_py(os.path.join(os.path.dirname(__file__),
'foam_internalwrapper', 'version.py'))
setup(
name=NAME,
version=VERSION,
author='SimPhoNy FP7 European Project',
description='Implementation of OpenFoam wrappers',
long_description=README_TEXT,
packages=find_packages(),
install_requires=['simphony>=0.5'],
entry_points={'simphony.engine':
['openfoam_file_io = foam_controlwrapper',
'openfoam_internal = foam_internalwrapper']},
cmdclass={
'clean': CleanCommand,
'bdist_egg': BdistEggCommand}
)