diff --git a/0001-fixup-moving-average-window.patch b/0001-fixup-moving-average-window.patch index 94635b0e6d3082732e5077044729066fbfd9ecca..94c87a183290e1fcadce5dd834ba93ec594350b2 100644 --- a/0001-fixup-moving-average-window.patch +++ b/0001-fixup-moving-average-window.patch @@ -1,34 +1,12 @@ -From: Pavel Raiskup -Subject: [PATCH] Fix fast upload avg calculation +From 8be91cee2d25e26ee1ab92a9bbab6fd9fda49104 Mon Sep 17 00:00:00 2001 +From: jxy_git +Date: Thu, 17 Nov 2022 11:26:05 +0800 +Subject: [PATCH] fixup moving average window - -Upstream verigak/progress is broken for very fast uploads; e.g. -with 'copr build' command, the next() call is called so often that -the avg() calculation probably suffers from some small -floating-point numbers problems: - - With 15MB/s => next() called for each 8096B => ~2000 calls/s - -Since the upstream default window size is only of size 10 items -(by default), it calculates the average speed only for the last -~0.005s. We could enlarge the size of window (sma_window param), -but the algorithm is so naive that it would decrease the -performance. - -This has been discussed very extensively with upstream (PR 24 and -friends) but I neither was not able to explain the problem, nor I -was able to convince upstream to accept my patches. - -This downstream patch - while it keeps the backward API -compatibility - changes the algorithm so the average speed is -calculation is fast enough, and much more stable (by default it -calculates speed for window of 2 seconds). - -We also don't seem to have the monotonic() mess, since we don't seem -to suffer from the same issues. - -Fork with this patch backported is maintained in -https://github.com/python-progress/python-progress +--- + MANIFEST.in | 1 - + progress/__init__.py | 78 +++++++++++++++++++++++++++++--------------- + 2 files changed, 52 insertions(+), 27 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index ef7c4cb..0c73842 100644 @@ -38,7 +16,7 @@ index ef7c4cb..0c73842 100644 include README.rst LICENSE -include test_*.py diff --git a/progress/__init__.py b/progress/__init__.py -index e434c25..1cbdce6 100644 +index b434b30..71b2039 100644 --- a/progress/__init__.py +++ b/progress/__init__.py @@ -18,10 +18,7 @@ from collections import deque @@ -52,7 +30,7 @@ index e434c25..1cbdce6 100644 +from time import time - __version__ = '1.5' + __version__ = '1.6' @@ -30,19 +27,55 @@ HIDE_CURSOR = '\x1b[?25l' SHOW_CURSOR = '\x1b[?25h' @@ -115,7 +93,7 @@ index e434c25..1cbdce6 100644 for key, val in kwargs.items(): setattr(self, key, val) -@@ -62,23 +95,19 @@ class Infinite(object): +@@ -67,23 +100,19 @@ class Infinite(object): @property def elapsed(self): @@ -147,8 +125,8 @@ index e434c25..1cbdce6 100644 def update(self): pass -@@ -112,10 +141,7 @@ class Infinite(object): - return self.file.isatty() if self.check_tty else True +@@ -116,10 +145,7 @@ class Infinite(object): + raise AttributeError(msg) def next(self, n=1): - now = monotonic() @@ -159,3 +137,6 @@ index e434c25..1cbdce6 100644 self.index = self.index + n self.update() +-- +2.37.1 + diff --git a/progress-1.5.tar.gz b/progress-1.5.tar.gz deleted file mode 100644 index 77f5fa8c62f862d9ed0bc8fe7a06e9ec70e66109..0000000000000000000000000000000000000000 Binary files a/progress-1.5.tar.gz and /dev/null differ diff --git a/progress-1.6.tar.gz b/progress-1.6.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..3eba3a0a504da7b2e6063d42d443a23c1e8cfe34 Binary files /dev/null and b/progress-1.6.tar.gz differ diff --git a/python-progress.spec b/python-progress.spec index fe82a5aa6c3496926f47a8edf042ee7e24d582e4..de2652bae79d98b74a460d18db7a1e14539f5a3b 100644 --- a/python-progress.spec +++ b/python-progress.spec @@ -1,53 +1,77 @@ -# Created by pyp2rpm-0.5.2 -%global pypi_name progress - -Name: python-%{pypi_name} -Version: 1.5 -Release: 1 -Summary: Easy to use progress bars - -License: ISC -URL: http://github.com/verigak/progress/ -Source0: %pypi_source -BuildArch: noarch - -BuildRequires: python3-devel -BuildRequires: python3-setuptools - -Patch1: 0001-fixup-moving-average-window.patch +%global _empty_manifest_terminate_build 0 +Name: python-progress +Version: 1.6 +Release: 1 +Summary: Easy to use progress bars +License: ISC +URL: http://github.com/verigak/progress/ +Source0: https://files.pythonhosted.org/packages/2a/68/d8412d1e0d70edf9791cbac5426dc859f4649afc22f2abbeb0d947cf70fd/progress-1.6.tar.gz +Patch0: 0001-fixup-moving-average-window.patch +BuildArch: noarch + + +%description +Collection of easy to use progress bars and spinners. -%global _description\ -Collection of easy to use progress bars and spinners.\ +%package -n python3-progress +Summary: Easy to use progress bars +Provides: python-progress = %{version}-%{release} +BuildRequires: python3-devel +BuildRequires: python3-setuptools -%description %_description +%description -n python3-progress +Collection of easy to use progress bars and spinners. -%package -n python3-%{pypi_name} -Summary: Easy to use progress bars +%package help +Summary: Development documents and examples for progress +Provides: python3-progress-doc -%description -n python3-%{pypi_name} +%description help Collection of easy to use progress bars and spinners. - %prep -%autosetup -p1 -n %{pypi_name}-%{version} - -# Remove bundled egg-info -rm -rf %{pypi_name}.egg-info - +%autosetup -p1 -n progress-%{version} %build %py3_build - %install %py3_install - -%files -n python3-%{pypi_name} -%doc README.rst LICENSE -%{python3_sitelib}/%{pypi_name} -%{python3_sitelib}/%{pypi_name}-%{version}-py%{python3_version}.egg-info - +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-progress -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* %changelog +* Wed Nov 16 2022 jiangxinyu - 1.6-1 +- Update package to version 1.6 + * Fri Jun 25 2021 liufeng - 1.5-1 - Initial package.