summaryrefslogtreecommitdiff
path: root/src/main/python/OMChem/setup.py
diff options
context:
space:
mode:
authorpravindalve2023-05-30 04:20:14 +0530
committerGitHub2023-05-30 04:20:14 +0530
commitcbdd7ca21f1f673a3a739065098f7cc6c9c4b881 (patch)
tree595e888c38f00a314e751096b6bf636a544a5efe /src/main/python/OMChem/setup.py
parent7740d1ca0c2e6bf34900460b0c58fa4d528577fb (diff)
parent280c6aa89a15331fb76b7014957953dc72af6093 (diff)
downloadChemical-Simulator-GUI-cbdd7ca21f1f673a3a739065098f7cc6c9c4b881.tar.gz
Chemical-Simulator-GUI-cbdd7ca21f1f673a3a739065098f7cc6c9c4b881.tar.bz2
Chemical-Simulator-GUI-cbdd7ca21f1f673a3a739065098f7cc6c9c4b881.zip
Merge pull request #63 from brenda-br/Fix-35HEADmaster
Restructure Project and Deployment
Diffstat (limited to 'src/main/python/OMChem/setup.py')
-rw-r--r--src/main/python/OMChem/setup.py54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/main/python/OMChem/setup.py b/src/main/python/OMChem/setup.py
new file mode 100644
index 0000000..037da1c
--- /dev/null
+++ b/src/main/python/OMChem/setup.py
@@ -0,0 +1,54 @@
+try:
+ from setuptools import setup
+except ImportError:
+ from distutils.core import setup
+
+from subprocess import call
+import sys
+import os
+# Python 3.3 offers shutil.which()
+from distutils import spawn
+
+def warningOrError(errorOnFailure, msg):
+ if errorOnFailure:
+ raise Exception(msg)
+ else:
+ print(msg)
+
+def generateIDL():
+ errorOnFailure = not os.path.exists(os.path.join(os.path.dirname(__file__), 'OMPythonIDL', '__init__.py'))
+ try:
+ omhome = os.path.split(os.path.split(os.path.realpath(spawn.find_executable("omc")))[0])[0]
+ except:
+ omhome = None
+ omhome = omhome or os.environ.get('OPENMODELICAHOME')
+
+ if omhome is None:
+ warningOrError(errorOnFailure, "Failed to find OPENMODELICAHOME (searched for environment variable as well as the omc executable)")
+ return
+ idl = os.path.join(omhome,"share","omc","omc_communication.idl")
+ if not os.path.exists(idl):
+ warningOrError(errorOnFailure, "Path not found: %s" % idl)
+ return
+
+ if 0 is not call(["omniidl","-bpython","-Wbglobal=_OMCIDL","-Wbpackage=OMPythonIDL",idl]):
+ warningOrError(errorOnFailure, "omniidl command failed")
+ return
+ print("Generated OMPythonIDL files")
+generateIDL()
+
+setup(name='OMPython',
+ version='2.0.7',
+ description='OpenModelica-Python API Interface',
+ author='Anand Kalaiarasi Ganeson',
+ author_email='ganan642@student.liu.se',
+ maintainer='Adeel Asghar',
+ maintainer_email='adeel.asghar@liu.se',
+ license="BSD, OSMC-PL 1.2, GPL (user's choice)",
+ url='http://openmodelica.org/',
+ packages=['OMPython', 'OMPython.OMParser', 'OMPythonIDL', 'OMPythonIDL._OMCIDL', 'OMPythonIDL._OMCIDL__POA'],
+ install_requires=[
+ # 'omniORB', # Required, but not part of pypi
+ 'pyparsing'
+ ]
+)