Skip to content

Remove distutils, update CI #221

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Set update schedule for GitHub Actions

version: 2
updates:

- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates to GitHub Actions every week
interval: "monthly"
6 changes: 3 additions & 3 deletions .github/workflows/FMITest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
timeout-minutes: 30
strategy:
matrix:
python-version: ['3.10']
python-version: ['3.12']
os: ['ubuntu-latest', 'windows-latest']
omc-version: ['stable', 'nightly']

Expand Down Expand Up @@ -41,7 +41,7 @@ jobs:
pip install future pyparsing numpy psutil pyzmq pytest pytest-md pytest-emoji

- name: Set timezone
uses: szenius/set-timezone@v1.2
uses: szenius/set-timezone@v2.0
with:
timezoneLinux: 'Europe/Berlin'

Expand All @@ -53,4 +53,4 @@ jobs:
job-summary: true
custom-arguments: 'tests/test_FMIRegression.py -v'
click-to-expand: true
report-title: 'FMI_Export TEST REPORT'
report-title: 'FMI_Export TEST REPORT'
13 changes: 6 additions & 7 deletions .github/workflows/Test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ jobs:
timeout-minutes: 30
strategy:
matrix:
python-version: ['3.10']
os: ['ubuntu-latest']
python-version: ['3.10', '3.12']
os: ['ubuntu-latest', 'windows-latest']
omc-version: ['stable']

steps:
- uses: actions/checkout@v4

- name: "Set up OpenModelica Compiler"
uses: OpenModelica/setup-openmodelica@v1.0
with:
Expand All @@ -26,12 +27,10 @@ jobs:
omc
libraries: |
'Modelica 4.0.0'

- run: "omc --version"

- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: 'x64'
Expand All @@ -42,7 +41,7 @@ jobs:
pip install future pyparsing numpy psutil pyzmq pytest pytest-md pytest-emoji

- name: Set timezone
uses: szenius/set-timezone@v1.2
uses: szenius/set-timezone@v2.0
with:
timezoneLinux: 'Europe/Berlin'

Expand All @@ -54,4 +53,4 @@ jobs:
job-summary: true
custom-arguments: '-v '
click-to-expand: true
report-title: 'Test Report'
report-title: 'Test Report'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
.vs/
.DS_Store
.vscode/
/.venv/
6 changes: 3 additions & 3 deletions OMPython/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class which means it will use OMCSessionZMQ by default. If you want to use
from future.utils import with_metaclass
from builtins import int, range
from copy import deepcopy
from distutils import spawn
import shutil

import abc
import csv
Expand Down Expand Up @@ -129,10 +129,10 @@ def __init__(self):
if omc_env_home:
self.omhome = omc_env_home
else:
path_to_omc = spawn.find_executable("omc")
path_to_omc = shutil.which("omc")
if path_to_omc is None:
raise ValueError("Cannot find OpenModelica executable, please install from openmodelica.org")
self.omhome = os.path.split(os.path.split(os.path.realpath(path_to_omc))[0])[0]
self.omhome = os.path.dirname(os.path.dirname(path_to_omc))
def _get_omc_path(self):
try:
return os.path.join(self.omhome, 'bin', 'omc')
Expand Down
44 changes: 28 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,45 +31,57 @@ Installation using `pip` is recommended.

Install the latest OMPython master by running:

python -m pip install -U https://github.com/OpenModelica/OMPython/archive/master.zip
```bash
python -m pip install -U https://github.com/OpenModelica/OMPython/archive/master.zip
```

### Windows

Install the version as packaged with your OpenModelica installation by
running:
Install the version packed with your OpenModelica installation by running:

```cmd
cd %OPENMODELICAHOME%\share\omc\scripts\PythonInterface
python -m pip install -U .
```

cd %OPENMODELICAHOME%\share\omc\scripts\PythonInterface
python -m pip install -U .
### Local installation

Instead, to Install the latest version of the OMPython master branch
To Install the latest version of the OMPython master branch
only, previously cloned into `<OMPythonPath>`, run:

cd <OMPythonPath>
python -m pip install -U .
```
cd <OMPythonPath>
python -m pip install -U .
```

## Usage

Running the following commads should get you started
Running the following commands should get you started

``` python
```python
import OMPython
help(OMPython)
```

or read the [OMPython
documentation](https://openmodelica.org/doc/OpenModelicaUsersGuide/latest/ompython.html)
```python
from OMPython import OMCSessionZMQ
omc = OMCSessionZMQ()
omc.sendExpression("getVersion()")
```

or read the [OMPython documentation](https://openmodelica.org/doc/OpenModelicaUsersGuide/latest/ompython.html)
online.

## Bug Reports

- See OMPython bugs on the [OpenModelica
- See OMPython bugs on the [OpenModelica
trac](https://trac.openmodelica.org/OpenModelica/query?component=OMPython)
or submit a [new
ticket](https://trac.openmodelica.org/OpenModelica/newticket).
- [Pull requests](https://github.com/OpenModelica/OMPython/pulls) are
- [Pull requests](https://github.com/OpenModelica/OMPython/pulls) are
welcome.

## Contact

- Adeel Asghar, <adeel.asghar@liu.se>
- Arunkumar Palanisamy, <arunkumar.palanisamy@liu.se>
- Adeel Asghar, <adeel.asghar@liu.se>
- Arunkumar Palanisamy, <arunkumar.palanisamy@liu.se>
23 changes: 9 additions & 14 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,19 @@
try:
from setuptools import setup
except ImportError:
from distutils.core import setup

from setuptools import setup
from subprocess import call
import os
# Python 3.3 offers shutil.which()
from distutils import spawn

import shutil

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]
path_to_omc = shutil.which("omc")
omhome = os.path.dirname(os.path.dirname(os.path.split(path_to_omc)))
except BaseException:
omhome = None
omhome = omhome or os.environ.get('OPENMODELICAHOME')
Expand Down Expand Up @@ -54,8 +48,9 @@ def generateIDL():
OMPython_packages.extend(['OMPythonIDL', 'OMPythonIDL._OMCIDL', 'OMPythonIDL._OMCIDL__POA'])

setup(name='OMPython',
version='3.5.2',
version='3.6.0',
description='OpenModelica-Python API Interface',
long_description=open('README.md').read(),
author='Anand Kalaiarasi Ganeson',
author_email='ganan642@student.liu.se',
maintainer='Adeel Asghar',
Expand All @@ -64,11 +59,11 @@ def generateIDL():
url='http://openmodelica.org/',
packages=OMPython_packages,
install_requires=[
# 'omniORB', # Required, but not part of pypi
'future',
'pyparsing',
'numpy',
'psutil',
'pyparsing',
'pyzmq'
]
],
python_requires='>=3.8',
)