Allow cubitpy on windows#142
Merged
isteinbrecher merged 1 commit intoJun 19, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aims to improve Windows compatibility by adjusting platform detection and refactoring the Cubit client/host initialization handshake and message/log handling between the host Python interpreter and the Cubit-side interpreter.
Changes:
- Add Windows host platform detection in configuration.
- Refactor Cubit initialization to pass init arguments via the first parameter payload (host → client) and simplify host-side init flow.
- Update client-side message handling and remove legacy console-output helper.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
src/cubitpy/cubit_wrapper/cubit_wrapper_host.py |
Refactors host-to-client initialization to send a single parameter payload including Cubit init arguments. |
src/cubitpy/cubit_wrapper/cubit_wrapper_client.py |
Updates client initialization to consume init arguments from the first payload; adjusts message/log handling setup. |
src/cubitpy/conf.py |
Adds Windows host platform detection and tweaks temp/log-related configuration. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
84
to
88
| # Temporary directory for cubitpy. | ||
| self.temp_dir = os.path.join( | ||
| "/tmp/cubitpy_{}".format(getpass.getuser()), # nosec | ||
| "pid_{}".format(os.getpid()), | ||
| ) |
Comment on lines
+118
to
+137
| # Import libraries needed if this script is running on a remote system. | ||
| # Also, create a temporary directory that is accessible by Cubit. | ||
| if parameters["is_remote"]: | ||
| import platform | ||
| import subprocess # nosec B404 | ||
| import time | ||
|
|
||
| temp_dir = tempfile.TemporaryDirectory(prefix="cubitpy_temp_dir") | ||
|
|
||
|
|
||
| if sys.version_info[0] < 3: | ||
| # On non-Coreform Cubit versions (running on python2), we check the log file to get the | ||
| # messages and errors from Cubit. This can be removed once support for python2 is | ||
| # dropped, as the message handler is the cleaner solution. | ||
| temp_dir = "/tmp/cubitpy_temp_log" # nosec | ||
| if not os.path.exists(temp_dir): | ||
| os.makedirs(temp_dir) | ||
| temp_log = os.path.join(temp_dir, "cubitpy.log") | ||
| open(temp_log, "w").close() | ||
| parameters["init_arguments"].extend(["-log", temp_log]) |
Comment on lines
+76
to
+78
| "Off", | ||
| "-nojournal", # Do write a journal file | ||
| "-noecho", # Do not output commands used in cubit |
Comment on lines
+177
to
+178
| # On old cubit versions, we send all messages as warnings, was they are | ||
| # not directly related to the messages on newer cubit versions. |
2b1f90e to
65f3ea9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.