1
# -*- encoding: utf-8 -*-
3
Auto-generate snapcraft.yaml.
6
from pathlib import Path
7
from subprocess import check_output # nosec
9
sys.path.insert(1, str(Path(__file__).parent.parent))
12
snap_yml = r"""name: tqdm
13
summary: A fast, extensible CLI progress bar
15
https://tqdm.github.io
17
`tqdm` means "progress" in Arabic (taqadum, تقدّم) and is an
18
abbreviation for "I love you so much" in Spanish (te quiero demasiado).
20
Instantly make your loops show a smart progress meter and stats - just
21
replace any pipe "`|`" with "`| tqdm |`", and you're done!
24
$ seq 9999999 | tqdm --bytes | wc -l
25
75.2MB [00:00, 217MB/s]
27
$ 7z a -bd -r backup.7z docs/ | grep Compressing | \
28
tqdm --total $(find docs/ -type f | wc -l) --unit files >> backup.log
29
100%|███████████████████████████████▉| 8014/8014 [01:37<00:00, 82.29files/s]
32
Overhead is low -- about 60ns per iteration.
34
In addition to its low overhead, `tqdm` uses smart algorithms to predict
35
the remaining time and to skip unnecessary iteration displays, which
36
allows for a negligible overhead in most cases.
38
`tqdm` works on any platform (Linux, Windows, Mac, FreeBSD, NetBSD,
39
Solaris/SunOS), in any console or in a GUI, and is also friendly with
40
IPython/Jupyter notebooks.
42
`tqdm` does not require any dependencies, just
43
an environment supporting `carriage return \r` and
44
`line feed \n` control characters.
55
source-commit: '{commit}'
60
cp $SNAPCRAFT_PART_BUILD/tqdm/completion.sh $SNAPCRAFT_PART_INSTALL/
64
completer: completion.sh
65
""".format(version=tqdm.__version__, commit=check_output([
66
'git', 'describe', '--always']).decode('utf-8').strip()) # nosec
68
if __name__ == "__main__":
69
(Path(__file__).resolve().parent.parent / 'snapcraft.yaml').write_text(
70
snap_yml.decode('utf-8') if hasattr(snap_yml, 'decode') else snap_yml, encoding='utf-8')