Skip to content

Conversation

syntron
Copy link
Contributor

@syntron syntron commented Jun 28, 2025

new class OMCPath which implements path handling based on OMC commands

currently just a prove of concept with a test case using docker

see issue #315 and PR #309

Important: due to limitations in pathlib.Path, this is not working for Python < 3.12! - I'm testing compatibility but got no overall success (local Linux seems to work / Windows fails for 3.10)

@syntron syntron force-pushed the OMCPath branch 4 times, most recently from 7514c47 to 13fec2c Compare July 9, 2025 18:35
@syntron syntron force-pushed the OMCPath branch 2 times, most recently from c8bddac to b59e473 Compare July 11, 2025 19:30
@syntron syntron force-pushed the OMCPath branch 4 times, most recently from 1b64550 to c45b4f7 Compare July 11, 2025 21:10
@syntron
Copy link
Contributor Author

syntron commented Jul 12, 2025

@Sonyoyo could you please test if this is working on WSL and provide some feedback? I'm just coding blind regarding this option ...

Feel free to use the testcase in tests.test_OMCPath.test_OMCPath_WSL() - it is working well on local and docker; thus, should also work on WSL (I hope)

@syntron
Copy link
Contributor Author

syntron commented Jul 12, 2025

@ondras12345 could you please advice on the unittest?

In tests.test_OMCPath tests are defined which use different backends (local / docker / WSL). I implemented it by using different functions to define the test and the unique code is in a helper function which is called by each test.

@syntron syntron marked this pull request as ready for review August 12, 2025 20:25
@adeas31 adeas31 added this to the 4.1.0 milestone Aug 18, 2025
* use modified pathlib.Path as OMCPath
* this is scripting output and, thus, it cannot be parsed
see commit ID: aa74b36 - [OMCPath] add more functionality and docstrings
* differentiate between
  * Python >= 3.12 uses OMCPath based on OMC for filesystem operation
  * Python <  3.12 uses a pathlib.Path based implementation which is
    limited to OMCProcessLocal
error: "unlink" of "OMCPathReal" does not return a value (it only ever returns None)  [func-returns-value]
Copy link
Member

@adeas31 adeas31 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Important: due to limitations in pathlib.Path, this is not working for Python < 3.12! - I'm testing compatibility but got no overall success (local Linux seems to work / Windows fails for 3.10)

Did you figure out what is the limitation? Is there a workaround?

@syntron
Copy link
Contributor Author

syntron commented Oct 20, 2025

Did you figure out what is the limitation? Is there a workaround?

see 1acd916: there is a compatibility layer such that for Python < 3.12 pathlib.Path is used such that it will work on the same level as it is now (i.e. no regression but also not the new possibilities)

@adeas31 adeas31 merged commit 07eb621 into OpenModelica:master Oct 20, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants