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

Use importlib.resources to find cysignals-CSI-helper.py #200

Open
orlitzky opened this issue Mar 26, 2024 · 0 comments · May be fixed by #204
Open

Use importlib.resources to find cysignals-CSI-helper.py #200

orlitzky opened this issue Mar 26, 2024 · 0 comments · May be fixed by #204

Comments

@orlitzky
Copy link

Currently cysignals-CSI-helper.py is installed https://github.com/sagemath/cysignals/blob/main/setup.py#L219. The script that makes use of it, cysignals-CSI, later tries to guess the install location based on sys.argv[0]: https://github.com/sagemath/cysignals/blob/main/src/scripts/cysignals-CSI#L68

This can fail if sys.argv[0] isn't something simple like /usr/bin/python, e.g. https://bugs.gentoo.org/927767

By using importlib.resources.files we could avoid guessing at all.

mgorny added a commit to mgorny/cysignals that referenced this issue Jul 6, 2024
Rather than installing `cysignals-CSI-helper.py` into a `share`
directory and then trying to figure out the correct path to it, install
it as Python package data and use the standard `importlib.resources`
API to access it.  For Python versions older than 3.9,
the `importlib_resources` backport is used instead.

Fixes sagemath#200
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant