diff --git a/common/hooks/pre-pkg/04-generate-provides.sh b/common/hooks/pre-pkg/04-generate-provides.sh
index 234c19ac8ee..18302434214 100644
--- a/common/hooks/pre-pkg/04-generate-provides.sh
+++ b/common/hooks/pre-pkg/04-generate-provides.sh
@@ -3,9 +3,17 @@
 # This hook executes the following tasks:
 #	- Generates provides file with provides entries for xbps-create(1)
 
+get_explicit_provides() {
+    # include explicit values from the template
+    if [ -n "$provides" ]; then
+        printf '%s\n' $provides
+    fi
+}
+
 generate_python_provides() {
     local py3_bin="${XBPS_MASTERDIR}/usr/bin/python3"
 
+    # get the canonical python package names for each python module
     if [ -z "$nopyprovides" ] && [ -d "${PKGDESTDIR}/${py3_sitelib}" ] && [ -x "${py3_bin}" ]; then
         PYTHONPATH="${XBPS_MASTERDIR}/${py3_sitelib}-bootstrap" "${py3_bin}" \
             "${XBPS_COMMONDIR}"/scripts/parse-py-metadata.py \
@@ -14,11 +22,12 @@ generate_python_provides() {
 }
 
 hook() {
-    # include explicit values from the template
-    local -a _provides=($provides)
+    local -a _provides
 
-    # get the canonical python package names for each python module
-    mapfile -t -O "${#_provides[@]}" _provides < <( generate_python_provides )
+    mapfile -t _provides < <(
+        get_explicit_provides
+        generate_python_provides
+    )
 
     if [ "${#_provides[@]}" -gt 0 ]; then
         echo "   ${_provides[*]}"