You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When parsing this cmakelist, CMAKE_CURRENT_BINARY_DIR is resolved to something like /e0RDahb2EYle4Jjl. This is because catkin_lint/linter.py sets info.var["CMAKE_CURRENT_BINARY_DIR"] to PathConstants.PACKAGE_BINARY, which is defined as "/%s" % generate_random_id().
Then, in catkin_lint/checks/build.py function exports(linter), we do this in the init hook:
info.export_includes = set()
Then this in the command hook:
includes = [info.source_relative_path(d) for d in opts["INCLUDE_DIRS"]]
...
info.export_includes |= set([d for d in includes if not os.path.isabs(d)])
with this cmakelist, with Python up to 3.12, that always results in info.export_includes being an empty set, because there's only CMAKE_CURRENT_BINARY_DIR (i.e. /somerandomstring) in INCLUDE_DIRS, and that will always be considered absolute. With Python 3.13 using posixpath, that continues to be the case, and the test passes. But with Python 3.13 using ntpath - the test has the @posix_and_nt decorator which causes it to be tested both ways - we now have a non-empty info.export_includes which contains a randomly-generated path name that does not exist.
So now we reach the final hook (on_final), which does this:
for incl in info.export_includes:
if not info.is_existing_path(incl, check=os.path.isdir, require_source_folder=True):
info.report(ERROR, "MISSING_INCLUDE_PATH", path=incl, file_location=info.location_of("catkin_package"))
and so of course, because we now have this non-existent path in info.export_includes, we report the MISSING_INCLUDE_PATH error.
I don't know what the appropriate upstream fix for this would be, which is why I'm sending an issue not a patch. Maybe change the implementation of PathConstants to use Windows-y paths on Windows?
The text was updated successfully, but these errors were encountered:
AdamWill
added a commit
to AdamWill/catkin_lint
that referenced
this issue
Jun 13, 2024
ntpath.isabs no longer considers paths that start with "/" to
be absolute. This is correct behaviour on Windows but causes us
problems, because our `PathConstants` use paths that start with
/ and expect these to always be considered absolute. To deal
with this, let's just filter out paths that are absolute by
ntpath *or* posixpath rules.
Signed-off-by: Adam Williamson <awilliam@redhat.com>
ntpath.isabs no longer considers paths that start with "/" to
be absolute. This is correct behaviour on Windows but causes us
problems, because our `PathConstants` use paths that start with
/ and expect these to always be considered absolute. To deal
with this, let's add an extra slash to the `PathConstants`;
paths starting `//` are considered absolute by both ntpath and
posixpath.
Signed-off-by: Adam Williamson <awilliam@redhat.com>
When run under Python 3.13, the test suite fails in test_exports. The second cmakelist checked:
gets a result list with a MISSING_INCLUDE_PATH message in it, when it expects to get no messages. This is because on Python 3.13,
ntpath.isabs
no longer considers a path that starts with a single/
to be absolute.When parsing this cmakelist,
CMAKE_CURRENT_BINARY_DIR
is resolved to something like/e0RDahb2EYle4Jjl
. This is becausecatkin_lint/linter.py
setsinfo.var["CMAKE_CURRENT_BINARY_DIR"]
toPathConstants.PACKAGE_BINARY
, which is defined as"/%s" % generate_random_id()
.Then, in
catkin_lint/checks/build.py
functionexports(linter)
, we do this in the init hook:Then this in the command hook:
with this cmakelist, with Python up to 3.12, that always results in
info.export_includes
being an empty set, because there's onlyCMAKE_CURRENT_BINARY_DIR
(i.e./somerandomstring
) inINCLUDE_DIRS
, and that will always be considered absolute. With Python 3.13 usingposixpath
, that continues to be the case, and the test passes. But with Python 3.13 usingntpath
- the test has the@posix_and_nt
decorator which causes it to be tested both ways - we now have a non-emptyinfo.export_includes
which contains a randomly-generated path name that does not exist.So now we reach the final hook (
on_final
), which does this:and so of course, because we now have this non-existent path in
info.export_includes
, we report theMISSING_INCLUDE_PATH
error.I don't know what the appropriate upstream fix for this would be, which is why I'm sending an issue not a patch. Maybe change the implementation of
PathConstants
to use Windows-y paths on Windows?The text was updated successfully, but these errors were encountered: