#960116 bad interaction with parameter substitution

Package:
dh-python
Source:
dh-python
Submitter:
Picca Frédéric-Emmanuel
Date:
2025-12-20 22:27:09 UTC
Severity:
normal
#960116#5
Date:
2020-05-09 14:44:39 UTC
From:
To:
Hello, I try to use parameter substitution in one of my package.

something with this line

        # install all the non .py files of the sources
        # modules
        dh_auto_install -- -s custom --install-args='find modules -path "modules/cctbx_project" -prune -o -name "__init__.py" -print0 |\
        while read -d $$"\0" file; do fdir=`dirname "$$file"`\
                ; find "$fdir" -maxdepth 1 \\\
                        -name "*.py" -prune \\\
                        -o -name "*.c" \\\
                        -o -name "*.cc" \\\
                        -o -name "*.cpp" \\\
                        -o -name "*.h" \\\
                        -o -name "*.hpp" \\\
                        -o -name "*.f" \\\
                        -o -name "SConscript" \\\
                        -o -name "\.*" \\\
                        -o -name "*.rst" \\\
                        -o -name "*.md" \\\
                        -o -name "*.toml" \\\
                        -o -name "LICENSE*" \\\
                        -o -name "AUTHORS*" \\\
                        -o -type d \\\
                        -o -print0 |\
                        while read -d $$"\0" ffile; do \
                                dh_install -p python3-dials --sourcedir=modules "$${ffile#modules/}" {install_dir};\
                        done \
        done'

But it failes with this error

E: pybuild pybuild:352: install: plugin custom failed with: 'ffile#modules/'
Traceback (most recent call last):
  File "/usr/bin/pybuild", line 350, in main
    run(func, i, version, c)
  File "/usr/bin/pybuild", line 301, in run
    result = func(context, args)
  File "/usr/share/dh-python/dhpython/build/base.py", line 260, in wrapped_func
    command = command.format(**quoted_args)
KeyError: 'ffile#modules/'

It seems that pybuild does not understand that it must not deal with ${

Cheers

Frederic

#960116#10
Date:
2025-12-20 21:59:40 UTC
From:
To:
Hi Picca (2020.05.09_10:44:39_-0400)
command twice, so even if you escape the braces {{}}, they get consumed
in the second substitution.

Double-escaping works: --args='for i in 1 2 3 4 5; do echo $${{{{i}}}}; done' for example.

But we should probably squash the two substitutions into one.

Stefano