From 00d1d2f8c62bf6501c8c7804243e830cd70d23ca Mon Sep 17 00:00:00 2001 From: Scott K Logan Date: Mon, 1 Apr 2024 14:34:56 -0500 Subject: [PATCH] STASH --- .github/workflows/ci.yaml | 2 +- src/catkin_pkg/workspaces.py | 5 ++++- test/test_workspaces.py | 6 +++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 27b91bc5..5c291c1b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -3,7 +3,7 @@ name: Run tests on: # yamllint disable-line rule:truthy push: - branches: ['master'] + branches: ['master', 'cottsay/ws-test'] pull_request: jobs: diff --git a/src/catkin_pkg/workspaces.py b/src/catkin_pkg/workspaces.py index d6f42730..19b5188f 100644 --- a/src/catkin_pkg/workspaces.py +++ b/src/catkin_pkg/workspaces.py @@ -35,6 +35,7 @@ from __future__ import print_function import os +import warnings CATKIN_WORKSPACE_MARKER_FILE = '.catkin_workspace' @@ -94,7 +95,9 @@ def order_paths(paths_to_order, prefix_paths): def _is_equal_or_in_parents(dir_, path): dir_ = os.path.normcase(os.path.realpath(dir_)) path = os.path.normcase(os.path.realpath(path)) - return path == dir_ or path.startswith(dir_ + os.sep) + res = (path == dir_ or path.startswith(dir_ + os.sep)) + warnings.warn(f'Checking if {path} is under {dir_}: {res}') + return res def ensure_workspace_marker(base_path): diff --git a/test/test_workspaces.py b/test/test_workspaces.py index be5a76ad..70f08d6d 100644 --- a/test/test_workspaces.py +++ b/test/test_workspaces.py @@ -2,6 +2,7 @@ import os import shutil +import sys import tempfile import unittest @@ -43,7 +44,10 @@ def test_order_paths(self): self.assertEqual(['foo' + os.sep + 'bim', 'bar'], order_paths(['bar', 'foo' + os.sep + 'bim'], ['foo'])) def test_order_paths_with_symlink(self): - root_dir = tempfile.mkdtemp() + if os.name == 'nt' and sys.version_info < ('3', '8'): + self.skipTest('symlinks are not resolved on windows prior to Python 3.8') + + root_dir = os.path.realpath(tempfile.mkdtemp()) try: foo = os.path.join(root_dir, 'foo') foo_inc = os.path.join(foo, 'include')