bpo-45723: Add helpers for save/restore env (GH-29637)#29637
Merged
tiran merged 6 commits intopython:mainfrom Nov 22, 2021
Merged
bpo-45723: Add helpers for save/restore env (GH-29637)#29637tiran merged 6 commits intopython:mainfrom
tiran merged 6 commits intopython:mainfrom
Conversation
Contributor
Author
|
@tiran: there might be a smoother way to do this, but this should do the trick. |
PoC: Apply to SQLite check.
8316e5f to
6579627
Compare
added 2 commits
November 19, 2021 15:38
Contributor
Author
|
Another option is to patch the built-in macros, but I prefer this explicit approach. |
Contributor
Author
|
Possible improvement: minimise future Proposed patchdiff --git a/configure.ac b/configure.ac
index 02463ae717..90507e206b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -32,21 +32,21 @@ dnl - WITH_SAVE_ENV([SCRIPT]) Runs SCRIPT wrapped with SAVE_ENV/RESTORE_ENV
AC_DEFUN([_SAVE_VAR], [AS_VAR_COPY([save_][$1], [$1])])dnl
AC_DEFUN([_RESTORE_VAR], [AS_VAR_COPY([$1], [save_][$1])])dnl
AC_DEFUN([SAVE_ENV],
- [_SAVE_VAR([CFLAGS])]
- [_SAVE_VAR([CPPFLAGS])]
- [_SAVE_VAR([LDFLAGS])]
- [_SAVE_VAR([LIBS])]
+[_SAVE_VAR([CFLAGS])]
+[_SAVE_VAR([CPPFLAGS])]
+[_SAVE_VAR([LDFLAGS])]
+[_SAVE_VAR([LIBS])]
)dnl
AC_DEFUN([RESTORE_ENV],
- [_RESTORE_VAR([CFLAGS])]
- [_RESTORE_VAR([CPPFLAGS])]
- [_RESTORE_VAR([LDFLAGS])]
- [_RESTORE_VAR([LIBS])]
+[_RESTORE_VAR([CFLAGS])]
+[_RESTORE_VAR([CPPFLAGS])]
+[_RESTORE_VAR([LDFLAGS])]
+[_RESTORE_VAR([LIBS])]
)dnl
AC_DEFUN([WITH_SAVE_ENV],
- [SAVE_ENV]
- [$1]
- [RESTORE_ENV]
+[SAVE_ENV]
+m4_strip([$1])
+[RESTORE_ENV]
)dnl
AC_SUBST(BASECPPFLAGS) |
tiran
reviewed
Nov 19, 2021
configure.ac
Outdated
Comment on lines
35
to
38
| [_SAVE_VAR([CFLAGS])] | ||
| [_SAVE_VAR([CPPFLAGS])] | ||
| [_SAVE_VAR([LDFLAGS])] | ||
| [_SAVE_VAR([LIBS])] |
Member
There was a problem hiding this comment.
It looks like the indention adds some extra space to the output:
save_CFLAGS=$CFLAGS
save_CPPFLAGS=$CPPFLAGS
save_LDFLAGS=$LDFLAGS
save_LIBS=$LIBS
Contributor
Author
There was a problem hiding this comment.
Yeah. We can tweak the new macros to further minimise configure diffs. I think that could be worth it, as it would be easier to review future PRs.
Contributor
Author
There was a problem hiding this comment.
Does it look better with dcc2ba9 applied?
remykarem
pushed a commit
to remykarem/cpython
that referenced
this pull request
Dec 7, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://bugs.python.org/issue45723