From 444240a82c9f375f9db9b2cb68ca1c25386f3084 Mon Sep 17 00:00:00 2001 From: Trygve Aaberge Date: Thu, 2 Feb 2023 01:40:36 +0100 Subject: Use perl instead of awk to join multiline imports Unline the awk command, this works as intended and only joins the imports. --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'build.sh') diff --git a/build.sh b/build.sh index 3247682..22caf53 100755 --- a/build.sh +++ b/build.sh @@ -3,7 +3,7 @@ shopt -s extglob contents="$(cat slack/util.py slack/task.py slack/!(util|task).py main.py | \ - awk -v RS='\\([^)]+\\)' '/from.*import/ {gsub(/[[:space:]]+/, "", RT)} {ORS=RT} 1' | \ + perl -0777 -pe 's/^( *from [^(\n]+\([^)]+\))/$1=~s|\s+| |gr/mge' | \ grep -Ev '^from slack[. ]')" echo "$contents" | grep '^from __future__' | sort -u > build/slack.py -- cgit