Skip to content

Commit

Permalink
fix: MinGW gvmap.sh detection logic
Browse files Browse the repository at this point in the history
CI has begun failing on MinGW:

  FAILED ci/tests.py::test_existence[gvmap.sh] - AssertionError: gvmap.sh has been resurrected in the cmake build on None. Please remove skip.
  assert WindowsPath('C:/Graphviz/bin/gvmap.sh') is None
   +  where WindowsPath('C:/Graphviz/bin/gvmap.sh') = which('gvmap.sh')
  FAILED tests/test_tools.py::test_tools[gvmap.sh] - OSError: [WinError 193] %1 is not a valid Win32 application

Comparing the CI logs from commit 71aed63
against recent failing MRs, it can be seen that Python in MinGW has moved from
3.11.10 to 3.12.7. Quoting some text from commit
97b0c0b:

  > This test began failing due to gvmap.sh unexpectedly existing. As diagnosed
  > by Magnus:
  >
  > > I diffed a full log file from a successful job with one from a failing one
  > > and the only tangible difference I could find was an upgrade of Python
  > > from 3.11.5 to 3.12.0. Indeed, this is what What’s New In Python 3.12¹
  > > says:
  > >
  > > > shutil
  > > > …
  > > > shutil.which() now consults the `PATHEXT` environment variable to find
  > > > matches within `PATH` on Windows even when the given `cmd` includes a
  > > > directory component. (Contributed by Charles Machalow in gh-103179.)
  > > >
  > > > shutil.which() will call `NeedCurrentDirectoryForExePathW` when querying
  > > > for executables on Windows to determine if the current working directory
  > > > should be prepended to the search path. (Contributed by Charles Machalow
  > > > in gh-103179.)
  > > >
  > > > shutil.which() will return a path matching the `cmd` with a component
  > > > from `PATHEXT` prior to a direct match elsewhere in the search path on
  > > > Windows. (Contributed by Charles Machalow in gh-103179.)
  > >
  > > I don't really understand what all this means, but it sounds quite
  > > suspicious to me anyway.

So it looks like the previous Python change that made it into the Windows
ecosystem has now propagated to MinGW.
  • Loading branch information
Smattr committed Nov 18, 2024
1 parent 71aed63 commit 18ebd12
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
4 changes: 0 additions & 4 deletions ci/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,6 @@ def test_existence(binary: str):
check_that_tool_does_not_exist(binary, os_id)
pytest.skip("smyrna is not built on non-Linux due to lacking dependencies")

if binary == "gvmap.sh" and is_mingw():
check_that_tool_does_not_exist(binary, os_id)
pytest.skip(f"{binary} is not installed on MinGW")

if binary == "vimdot" and platform.system() == "Windows":
check_that_tool_does_not_exist(binary, os_id)
pytest.skip(f"{binary} is not installed on Windows")
Expand Down
8 changes: 2 additions & 6 deletions tests/test_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@
import pytest

sys.path.append(os.path.dirname(__file__))
from gvtest import ( # pylint: disable=wrong-import-position
is_mingw,
remove_xtype_warnings,
which,
)
from gvtest import remove_xtype_warnings, which # pylint: disable=wrong-import-position


@pytest.mark.parametrize(
Expand Down Expand Up @@ -76,7 +72,7 @@ def test_tools(tool):
pytest.skip(f"{tool} not available")

# exec-ing a POSIX shell script as-is does not work on Windows
if tool == "gvmap.sh" and platform.system() == "Windows" and not is_mingw():
if tool == "gvmap.sh" and platform.system() == "Windows":
pytest.skip("gvmap.sh cannot be run directly on Windows")

# Ensure that X fails to open display
Expand Down

0 comments on commit 18ebd12

Please sign in to comment.