From 8e0ba1611dc87351b71e573704b3eb276f35bb1a Mon Sep 17 00:00:00 2001 From: Benjamin A. Beasley Date: Sep 20 2021 14:53:01 +0000 Subject: Improve shebang munging --- diff --git a/python-graph-tool.spec b/python-graph-tool.spec index 09814a2..bfa534e 100644 --- a/python-graph-tool.spec +++ b/python-graph-tool.spec @@ -139,8 +139,15 @@ Provides: graph-tool%{?_isa} = %{version}-%{release} %prep %autosetup -S git -n %{modname}-%{version} -# Remove shebangs -find . -type f -name "*.py" -exec sed -i '/^#![ ]*\/usr\/bin\/env.*$/ d' {} 2>/dev/null ';' +# Remove shebangs from non-script sources +# +# The pattern of selecting files before modifying them with sed keeps us from +# unnecessarily discarding the original mtimes on unmodified files. +find %{srcname} -type f -name '*.py' \ + -exec gawk '/^#!/ { print FILENAME }; { nextfile }' '{}' '+' | + xargs -r sed -r -i '1{/^#!/d}' +# Fix shebang(s) in sample script(s) +%py3_shebang_fix doc %build