Skip to content

Commit

Permalink
fix(posix): get rid of unportable sed usages to support macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
zyv committed Aug 29, 2023
1 parent e4b4806 commit 19ec751
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ fi

if [ -z "${PYTHON_RUNTIME_VERSION:-}" ] ; then
log "Read Python version from poetry.lock"
PYTHON_RUNTIME_VERSION="$(sed -n -e '/^\[metadata\]/,/^\[/p' poetry.lock | sed -n -e 's/^python-versions\s*=\s*//p' | tr -d \"'[:space:]'\')"
PYTHON_RUNTIME_VERSION="$(sed -n -e '/^\[metadata\]/,/^\[/p' poetry.lock | sed -n -e 's/^python-versions[[:space:]]*=[[:space:]]*//p' | tr -d \"'[:space:]'\')"
else
log "Force Python version to $PYTHON_RUNTIME_VERSION, because PYTHON_RUNTIME_VERSION is set!"
fi
Expand Down
3 changes: 1 addition & 2 deletions test/test-compile
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ run_test no_vars_success compile "$INPUT_DIR" CACHE_DIR fixtures/env_dir
cp fixtures/poetry.lock-valid_exact_version_specifier "$INPUT_DIR"/poetry.lock
run_test exact_version_specifier compile "$INPUT_DIR" CACHE_DIR fixtures/env_dir

cp fixtures/poetry.lock-valid "$INPUT_DIR"/poetry.lock
# add trailing space to python-versions to test if it will be removed
sed -i 's/^python-versions.*/& /g' "$INPUT_DIR"/poetry.lock
sed -e 's/^python-versions.*/& /g' fixtures/poetry.lock-valid > "$INPUT_DIR"/poetry.lock
run_test trailing_space compile "$INPUT_DIR" CACHE_DIR fixtures/env_dir

cp fixtures/poetry.lock-valid "$INPUT_DIR"/poetry.lock
Expand Down

0 comments on commit 19ec751

Please sign in to comment.