fix: ensure shell scripts are portable across macOS and Linux#192
Merged
fix: ensure shell scripts are portable across macOS and Linux#192
Conversation
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.
Related Issues
Proposed Changes:
This PR addresses shell script portability issues between macOS and Linux by replacing GNU-specific tools with POSIX-compliant alternatives:
scripts/download_fixtures.sh:
sed -iwithperl -pi -efor in-place file editing and added proper variable quoting throughout the script. Thesed -icommand has different syntax on macOS (requires a backup extension argument) versus GNU sed, causing failures in macOS environments.script/hassfestmodule (only__init__.pyandmodel.pyfiles) required for running Home Assistant tests. Imports are rewritten fromscript.totests.script.to match the new location.tarextraction for bothtests/andscript/folders, and a singlefindcommand for import rewriting using regex capture groups..github/workflows/testing.yaml and README.md: Replaced
grep -Po(GNU grep with Perl regex) with portablesedcommand using POSIX extended regex. The-Poflags are not available in BSD grep (macOS default)..python-version: Added Python version file to specify the project's Python version (3.13) for use with version management tools like pyenv.
These changes ensure that initialization and fixture download scripts run successfully on both macOS and Linux without modification.
Testing:
The existing CI pipeline (GitHub Actions) will validate these changes across the Linux environment. Manual verification can be performed on macOS systems where the scripts previously failed due to incompatible sed syntax.
Extra Notes (optional):
The changes maintain backward compatibility and do not alter the functional behavior of any scripts—only the tools used to accomplish the same tasks in a cross-platform manner.
Checklist