Skip to content

Allow cubitpy on windows#142

Merged
isteinbrecher merged 1 commit into
imcs-compsim:mainfrom
isteinbrecher:allow-cubitpy-on-windows
Jun 19, 2026
Merged

Allow cubitpy on windows#142
isteinbrecher merged 1 commit into
imcs-compsim:mainfrom
isteinbrecher:allow-cubitpy-on-windows

Conversation

@isteinbrecher

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 thread src/cubitpy/conf.py
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.
@isteinbrecher isteinbrecher force-pushed the allow-cubitpy-on-windows branch from 2b1f90e to 65f3ea9 Compare June 19, 2026 07:08
@isteinbrecher isteinbrecher merged commit 3f36aad into imcs-compsim:main Jun 19, 2026
1 of 2 checks passed
@isteinbrecher isteinbrecher deleted the allow-cubitpy-on-windows branch June 19, 2026 07:09
@isteinbrecher isteinbrecher restored the allow-cubitpy-on-windows branch June 19, 2026 07:10
@isteinbrecher isteinbrecher deleted the allow-cubitpy-on-windows branch June 19, 2026 07:23
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