Skip to content

fix: support relative paths for icons#2536

Merged
astrofrog merged 1 commit into
glue-viz:mainfrom
maartenbreddels:fix_relative_path_icon
Apr 15, 2025
Merged

fix: support relative paths for icons#2536
astrofrog merged 1 commit into
glue-viz:mainfrom
maartenbreddels:fix_relative_path_icon

Conversation

@maartenbreddels
Copy link
Copy Markdown
Contributor

When using PyInstaller, importlib_resources.files("glue") can return a relative path.
If this path is not resolved, it will lead to an error like:

File "glue/icons/init.py", line 35, in icon_path
RuntimeError: Icon does not exist: /Users/maartenbreddels/github/spacetelescope/jdaviz/standalone/dist/jdaviz/_internal/glue_jupyter/bqplot/common/../../icons/glue_polygon.svg

When using PyInstaller, importlib_resources.files("glue")
can return a relative path.
If this path is not resolved, it will lead to an error like:

  File "glue/icons/__init__.py", line 35, in icon_path
RuntimeError: Icon does not exist: /Users/maartenbreddels/github/spacetelescope/jdaviz/standalone/dist/jdaviz/_internal/glue_jupyter/bqplot/common/../../icons/glue_polygon.svg
maartenbreddels added a commit to maartenbreddels/jdaviz that referenced this pull request Apr 8, 2025
It should currently fail, since it requires:
 glue-viz/glue#2536
@dhomeier dhomeier added the bug label Apr 8, 2025
Copy link
Copy Markdown
Collaborator

@dhomeier dhomeier left a comment

Choose a reason for hiding this comment

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

Looks good to me; I guess there's no easy way to test this from within glue?

@maartenbreddels
Copy link
Copy Markdown
Contributor Author

No, unless we mock it, but with the comment in it, this is unlikely to be broken in the future.

@astrofrog astrofrog merged commit 49d73e7 into glue-viz:main Apr 15, 2025
25 of 26 checks passed
maartenbreddels added a commit to maartenbreddels/jdaviz that referenced this pull request Apr 29, 2025
It should currently fail, since it requires:
 glue-viz/glue#2536
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants