Skip to content

Commit aecebad

Browse files
committed
Fix the setup.py, installation instructions
1 parent bef04f3 commit aecebad

File tree

9 files changed

+67
-35
lines changed

9 files changed

+67
-35
lines changed

.gitattributes

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
*.c text eol=native
2+
*.cpp text eol=native
3+
*.h text eol=native
4+
*.m4 text eol=native
5+
.gitattributes text eol=native
6+
.gitignore text eol=native
7+
*.py text eol=native
8+
LICENSE text eol=native

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/OMPython.egg-info
2+
/OMPythonIDL/
3+
/build/
4+
/dist/
5+
/tmp/
File renamed without changes.
File renamed without changes.
File renamed without changes.

PythonInterface/setup.py

Lines changed: 0 additions & 21 deletions
This file was deleted.

README.md

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
1-
2012-03-19 [ganan642@student.liu.se]
2-
--------------------------------------------
1+
# OMPython
32

4-
- Python 2.7 is required. Download python from http://www.python.org/download/.
3+
OMPython is a Python interface that uses CORBA (omniORB) to communicate with OpenModelica.
54

6-
- Add python to your PATH.
5+
## Installation
76

8-
- Start command prompt/terminal and execute command "python setup.py install". This will add OMPython to the python 3rd party libraries.
7+
- Python 2.7 is required. Download python from http://www.python.org/download/.
98

10-
- Now OMPython can be used as a library within any Python code that imports the "OMPython" module.
9+
- omniORB is required to be installed including Python support (the omniidl command needs to be on the PATH)
1110

12-
- Use OMPython.run() to test the OpenModelica-Python API Interface with OpenModelica commands.
11+
- Add python to your PATH.
1312

14-
- Use OMPython.execute("any-OpenModelica-command") to retreive results.
13+
- Start command prompt/terminal and execute command "python setup.py install". This will add OMPython to the python 3rd party libraries.
1514

16-
For dictionary results:
15+
- Now OMPython can be used as a library within any Python code:
1716

18-
- After the result is available, use OMPython.get (result_dict,'dotted.notationed.dict.names') to easily traverse through the nested dictionaries and retrieve specific results.
17+
- import OMPython
1918

20-
- After the result is available, use OMPython.set (result_dict,'dotted.notationed.dict.names.new_dict', new_dict_value) to easily create a new dictionary(Key with a value assigned to it inside the nested dictionaries.
19+
- help(OMPython)
2120

22-
---------------------------------------------
23-
Adeel, adeel.asghar@liu.se.
24-
Anand, ganan642@student.liu.se
21+
## Contact
22+
Adeel, adeel.asghar@liu.se
23+
Anand, ganan642@student.liu.se

setup.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
try:
2+
from setuptools import setup
3+
except ImportError:
4+
from distutils.core import setup
5+
6+
from subprocess import call
7+
import sys
8+
import os
9+
# Python 3.3 offers shutil.which()
10+
from distutils import spawn
11+
12+
try:
13+
omhome = os.path.split(os.path.split(os.path.realpath(spawn.find_executable("omc")))[0])[0]
14+
except:
15+
omhome = None
16+
omhome = omhome or os.environ.get('OPENMODELICAHOME')
17+
18+
if omhome is None:
19+
raise Exception("Failed to find OPENMODELICAHOME (searched for environment variable as well as the omc executable)")
20+
idl = os.path.join(omhome,"share","omc","omc_communication.idl")
21+
if not os.path.exists(idl):
22+
raise Exception("Path not found: %s" % idl)
23+
24+
if 0<>call(["omniidl","-bpython","-Wbglobal=_OMCIDL","-Wbpackage=OMPythonIDL",idl]):
25+
raise Exception("omniidl command failed")
26+
27+
setup(name='OMPython',
28+
version='2.0',
29+
description='OpenModelica-Python API Interface',
30+
author='Anand Kalaiarasi Ganeson',
31+
author_email='ganan642@student.liu.se',
32+
maintainer='Adeel Asghar',
33+
maintainer_email='adeel.asghar@liu.se',
34+
license="BSD, OSMC-PL 1.2, GPL (user's choice)",
35+
url='http://openmodelica.org/',
36+
packages=['OMPython', 'OMPython.OMParser','OMPythonIDL', 'OMPythonIDL._OMCIDL', 'OMPythonIDL._OMCIDL__POA'],
37+
install_requires=[
38+
# 'omniORB', # Required, but not part of pypi
39+
'pyparsing'
40+
]
41+
)

0 commit comments

Comments
 (0)