-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Python utilities: avoid UseExceptions() related deprecation warning when launched from launcher shell scripts #10039
Conversation
…hen launched from launcher shell scripts Fixes OSGeo#10010 The launcher shell scripts generated by setuptools don't use our gdal-utils/scripts/{script_name}.py scripts, but directly the gdal-utils/osgeo_utils/{script_name}.py one. Hence let's move the call to UseExceptions() from the former to the later.
Would it make sense for exceptions to be set via a context manager opened in each script's top-level function, e.g. |
…Exceptions() if run under gdal.ExceptionMgr()
…on already caught under it
…ionMgr() to cause later issues
…rning about UseExceptions()
done |
) | ||
|
||
|
||
def _Calc( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll attempt a decorator to avoid the need to duplicate all of these arguments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Python scripts: Use decorator to enable exceptions
The backport to
stderr
stdout
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-release/3.9 release/3.9
# Navigate to the new working tree
cd .worktrees/backport-release/3.9
# Create a new branch
git switch --create backport-10039-to-release/3.9
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick 0de28a155595961eea4e01d19fb55c75a7798f19,e36b6ac1f725554305dbf18edeafd1c984406c61,fcd8a3001ff43af82cfa91cc23446ed67c278983,c435c2180c06bddbdc4cb45b73a671ffa2e93f82,1aa4f0c1ee7244de66b94382bf266d4545631ea2,f079410180ab3d71b443d0040cdee8f386113e08,9bdb59888f0ab5ad5a6eccf754d0855a275cfcd0,39d5a57183fa13d306769a21e710c48fd13893bd,de9fd3194645fb751b191cab18476e9c7bc1cd5a,0187ae9dbeab5b0ffa69089434dd652302e17fc8,c263611070050c1ca06565399cdd670192fb899c
# Push it to GitHub
git push --set-upstream origin backport-10039-to-release/3.9
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-release/3.9 Then, create a pull request where the |
manual backport in #10044 |
Fixes #10010
The launcher shell scripts generated by setuptools don't use our gdal-utils/scripts/{script_name}.py scripts, but directly the gdal-utils/osgeo_utils/{script_name}.py one. Hence let's move the call to UseExceptions() from the former to the later.