Skip to content
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

Don't overwrite the persistent variable when hacking paths #1296

Merged
merged 5 commits into from
May 14, 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
6 changes: 4 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
strategy:
fail-fast: false
matrix:
octave: [8.4.0]
octave: [9.1.0]
sympy: [1.5.1, 1.6.2, 1.7.1, 1.8, 1.9, 1.10.1, 1.11.1, 1.12]
include:
- octave: 5.1.0
Expand All @@ -106,6 +106,8 @@ jobs:
sympy: 1.12
- octave: 8.3.0
sympy: 1.12
- octave: 8.4.0
sympy: 1.12
steps:
- uses: actions/checkout@v4
- name: Container setup
Expand Down Expand Up @@ -276,7 +278,7 @@ jobs:
ubuntu2204_pip_sympy:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Octave and Python
run: |
uname -a
Expand Down
16 changes: 7 additions & 9 deletions inst/private/python_ipc_sysoneline.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%% Copyright (C) 2014-2018, 2022 Colin B. Macdonald
%% Copyright (C) 2014-2018, 2022, 2024 Colin B. Macdonald
%% Copyright (C) 2018-2019 Osella Giancarlo
%%
%% This file is part of OctSymPy.
Expand Down Expand Up @@ -69,7 +69,7 @@
% Windows. We have a 8000 char budget, and the header uses all
% of it.
mydir = fileparts (mfilename ('fullpath'));
mydir = strrep ([mydir filesep()], '\', '\\');
mydir = strrep ([mydir filesep()], '\', '\\\\');
% execfile() only works on python 2
headers = ['exec(open(\"' mydir 'python_header.py\").read()); '];
%s = python_header_embed2();
Expand Down Expand Up @@ -161,14 +161,12 @@
% dbl-quote is rather special here
% /" -> ///////" -> ///" -> /" -> "
s{i} = strrep(s{i}, '"', '\\\"');

if (ispc () && (~isunix ()))
%Escape sequence for WIN (Octave & Matlab)
s{i} = strrep(s{i}, '>', '^>');
s{i} = strrep(s{i}, '<', '^<');
end


if (ispc () && (~isunix ()))
% escape sequence for Windows (Octave & Matlab)
s{i} = strrep(s{i}, '>', '^>');
s{i} = strrep(s{i}, '<', '^<');
end

end
end
14 changes: 11 additions & 3 deletions inst/private/python_ipc_system.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%% Copyright (C) 2014-2016, 2022 Colin B. Macdonald
%% Copyright (C) 2014-2016, 2022, 2024 Colin B. Macdonald
%% Copyright (C) 2022 Alex Vong
%%
%% This file is part of OctSymPy.
Expand Down Expand Up @@ -133,10 +133,18 @@
tmpfilename, fd);
end

% On Windows, tmp file is like C:\Users\Zoe\AppData\Local\Temp\oct-rZDdea
% and this causes issues for msys2 [1]. It seems the same files are available
% in /tmp/ (?) and cygpath translates them, but careful not to change the
% persistent variable [2].
% [1] https://github.com/gnu-octave/symbolic/issues/1182
% [2] https://savannah.gnu.org/bugs/index.php?65735
if python_env_is_cygwin_like (pyexec)
tmpfilename = cygpath (tmpfilename);
_tmpfilename = cygpath (tmpfilename);
else
_tmpfilename = tmpfilename;
end
[status, out] = system ([pyexec ' ' tmpfilename]);
[status, out] = system ([pyexec ' ' _tmpfilename]);
end

info.raw = out;
Expand Down