Subject: [bug#28693] [PATCH] gnu: Add missing input to python-py3status.

From: Christopher Baines <[email-masked]>
Date: Wed, 4 Oct 2017 07:59:44 +0100

On Wed,  4 Oct 2017 00:57:57 +0200
Tomáš Čech <[email-masked]> wrote:

> * gnu/packages/python.scm (python-py3status): Add missing input.
> 
> file is used to determine configuration file encoding and py3status
> fails to run when this tool is missing.

Hey Tomáš,

I don't know much about python-py3status, but I had a look at building
it with and without this patch, and it worked for me both times.

When building with this patch, so with file as an additional input, the
resulting store item does not reference the file store item (which you
can check using guix size, which lists the referenced store items [1]).

Given file is used at runtime, it would be good if the resulting store
item for python-py3status referenced file. As far as I can see, file is
used here [2], so you could use the substitute* procedure to replace
the command name with an absolute path to the binary in the store. This
absolute path would then mean that file is recorded as a "runtime"
dependency of python-py3status.

Other approaches include wrapping the py3status binary to ensure the
PATH environment variable includes the dependencies (like file), or
adding file as to propagated-inputs (rather than inputs), which ensures
its installed when py3status is installed.

All of these 3 approaches I've mentioned have some downsides. Patching
the files is tricky, and what is used where can change in later
releases. As for wrapping, that is inelegant, and wouldn't help if this
is used as a python library. Propagated inputs can conflict with other
packages and propagated inputs, which can cause issues for people
installing and upgrading packages.

From the number of occurrences of the subprocess module in this
package, this seems to be a problem not limited to the file tool, but a
large number of programs.

I'm imagining that you use this, so let me know what you think, and if
you have any questions?

Thanks for the patch,

Chris

1: 
→ guix size python-py3status
store item                                                       total    self
/gnu/store/ks27x0mf95gir0cdgb9h573xbava6v1k-python-3.5.3           171.5    65.2  36.7%
/gnu/store/n6nvxlk2j8ysffjh3jphn1k5silnakh6-glibc-2.25              38.5    37.1  20.9%
/gnu/store/3x53yv4v144c9xp02rs64z7j597kkqax-gcc-5.4.0-lib           68.6    30.1  16.9%
/gnu/store/42d5rjrdkln6nwvzwdc8dyd4w6iy3n5j-coreutils-8.27          86.8    14.8   8.3%
/gnu/store/m0m6bwzi8lx7kv8zbn3hjrim6flmgnf4-openssl-1.0.2l          74.6     5.9   3.3%
/gnu/store/09j7scnl3hahcmql986fsjpzj6gqsmzv-ncurses-6.0             74.3     5.7   3.2%
/gnu/store/b7y66db86k57vbb03nr4bfn9svmks4gf-bash-4.4.12             81.0     5.4   3.1%
/gnu/store/mpl9b9w60gjzsq470zka5l8p2bmy7r8v-sqlite-3.19.3           79.0     3.5   1.9%
/gnu/store/5jl21csvr3jmsa4a7d08sqa2waks3f09-gmp-6.1.2               71.2     2.6   1.5%
/gnu/store/zhrajv6qf2hzn9c3g2bb07559hyrz5xp-bash-static-4.4.12       1.4     1.4   0.8%
/gnu/store/mipizipnr4y2hly9b429j8id1albbgqi-readline-7.0            75.6     1.3   0.7%
/gnu/store/g3nari57wcfnm00kv9bnpyzdzfq4h8pk-xz-5.2.2                70.7     1.1   0.6%
/gnu/store/kpxi8h3669afr9r1bgvaf9ij3y4wdyyn-bash-minimal-4.4.12     39.5     1.0   0.5%
/gnu/store/9ym4jxs5jhzjbf0dy5wz3ghdd8mp72r8-python-py3status-3.1   177.7     0.8   0.5%
/gnu/store/47jgabf5wx296alb06pb5iig6cqbmx0v-gdbm-1.13               69.2     0.6   0.3%
/gnu/store/5lrk6d5cjsv2s29vfji6j59gyf18rb5m-acl-2.2.52              69.3     0.4   0.2%
/gnu/store/sfx1wh27i6gsrk21p87rdyikc64v7d51-zlib-1.2.11             69.0     0.4   0.2%
/gnu/store/yz1lf55ag0904w9ib0q2kcjpdx33y7wm-attr-2.4.47             68.9     0.2   0.1%
/gnu/store/jnbb8ffxxvrw2b4z18zn0g08kqk9rsgl-libffi-3.2.1            68.8     0.1   0.1%
/gnu/store/yzlmd2nlcyjhx0ydbap7x32zjqxc3hz9-libcap-2.25             68.8     0.1   0.1%
/gnu/store/v4i3zfiwk6vl0mhdz580diqs0p6sc8vg-python-wrapper-3.5.3   176.9     0.0   0.0%
total: 177.7 MiB

2: lib/python3.5/site-packages/py3status/parse_config.py