2020-11-16 20:05:11 +00:00
|
|
|
# -*- encoding: utf-8 -*-
|
|
|
|
"""
|
|
|
|
Auto-generate snapcraft.yaml.
|
|
|
|
"""
|
2021-01-09 17:00:18 +00:00
|
|
|
import sys
|
2023-08-08 01:03:30 +00:00
|
|
|
from pathlib import Path
|
2021-02-17 16:03:15 +00:00
|
|
|
from subprocess import check_output # nosec
|
2020-11-16 20:05:11 +00:00
|
|
|
|
2023-08-08 01:03:30 +00:00
|
|
|
sys.path.insert(1, str(Path(__file__).parent.parent))
|
2020-11-16 20:05:11 +00:00
|
|
|
import tqdm # NOQA
|
|
|
|
|
|
|
|
snap_yml = r"""name: tqdm
|
2019-02-13 23:15:51 +00:00
|
|
|
summary: A fast, extensible CLI progress bar
|
2019-02-13 23:37:48 +00:00
|
|
|
description: |
|
|
|
|
https://tqdm.github.io
|
|
|
|
|
|
|
|
`tqdm` means "progress" in Arabic (taqadum, تقدّم) and is an
|
|
|
|
abbreviation for "I love you so much" in Spanish (te quiero demasiado).
|
|
|
|
|
|
|
|
Instantly make your loops show a smart progress meter and stats - just
|
|
|
|
replace any pipe "`|`" with "`| tqdm |`", and you're done!
|
|
|
|
|
|
|
|
```sh
|
|
|
|
$ seq 9999999 | tqdm --bytes | wc -l
|
|
|
|
75.2MB [00:00, 217MB/s]
|
|
|
|
9999999
|
|
|
|
$ 7z a -bd -r backup.7z docs/ | grep Compressing | \
|
|
|
|
tqdm --total $(find docs/ -type f | wc -l) --unit files >> backup.log
|
|
|
|
100%|███████████████████████████████▉| 8014/8014 [01:37<00:00, 82.29files/s]
|
|
|
|
```
|
|
|
|
|
|
|
|
Overhead is low -- about 60ns per iteration.
|
|
|
|
|
|
|
|
In addition to its low overhead, `tqdm` uses smart algorithms to predict
|
|
|
|
the remaining time and to skip unnecessary iteration displays, which
|
|
|
|
allows for a negligible overhead in most cases.
|
|
|
|
|
|
|
|
`tqdm` works on any platform (Linux, Windows, Mac, FreeBSD, NetBSD,
|
|
|
|
Solaris/SunOS), in any console or in a GUI, and is also friendly with
|
|
|
|
IPython/Jupyter notebooks.
|
|
|
|
|
|
|
|
`tqdm` does not require any dependencies, just
|
|
|
|
an environment supporting `carriage return \r` and
|
|
|
|
`line feed \n` control characters.
|
2018-12-03 13:45:51 +00:00
|
|
|
grade: stable
|
|
|
|
confinement: strict
|
2023-03-03 15:59:12 +00:00
|
|
|
base: core22
|
2020-11-16 20:05:11 +00:00
|
|
|
icon: logo.png
|
|
|
|
version: '{version}'
|
2019-02-14 20:56:17 +00:00
|
|
|
license: MPL-2.0
|
2018-12-03 13:45:51 +00:00
|
|
|
parts:
|
|
|
|
tqdm:
|
|
|
|
plugin: python
|
2020-11-16 20:05:11 +00:00
|
|
|
source: .
|
2019-03-16 23:46:56 +00:00
|
|
|
source-commit: '{commit}'
|
2023-08-07 23:58:10 +00:00
|
|
|
python-packages: [.]
|
2020-11-16 20:05:11 +00:00
|
|
|
build-packages: [git]
|
2020-04-25 18:31:52 +00:00
|
|
|
override-build: |
|
2023-03-03 15:59:12 +00:00
|
|
|
craftctl default
|
2020-04-25 18:31:52 +00:00
|
|
|
cp $SNAPCRAFT_PART_BUILD/tqdm/completion.sh $SNAPCRAFT_PART_INSTALL/
|
2018-12-03 13:45:51 +00:00
|
|
|
apps:
|
|
|
|
tqdm:
|
|
|
|
command: bin/tqdm
|
2020-04-25 18:31:52 +00:00
|
|
|
completer: completion.sh
|
2020-12-18 22:55:41 +00:00
|
|
|
""".format(version=tqdm.__version__, commit=check_output([
|
2023-08-08 01:03:30 +00:00
|
|
|
'git', 'describe', '--always']).decode('utf-8').strip()) # nosec
|
2020-11-16 20:05:11 +00:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2023-08-08 01:03:30 +00:00
|
|
|
(Path(__file__).resolve().parent.parent / 'snapcraft.yaml').write_text(
|
|
|
|
snap_yml.decode('utf-8') if hasattr(snap_yml, 'decode') else snap_yml, encoding='utf-8')
|