Compare commits
38 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bb4d7e8077 | ||
|
|
47d1dfb924 | ||
|
|
11086bec8a | ||
|
|
b9cfe2cc78 | ||
|
|
0574505f81 | ||
|
|
70c30f0ba5 | ||
|
|
9dde5d8b5f | ||
|
|
ffb3785f1f | ||
|
|
853f4fd193 | ||
|
|
10a4af73ce | ||
|
|
aaaf5c1358 | ||
|
|
8c1145608b | ||
|
|
8dcbe52ac3 | ||
|
|
b0de2732cb | ||
|
|
30987611b1 | ||
|
|
ad2c27039e | ||
|
|
505ca6ee15 | ||
|
|
390ed8303d | ||
|
|
0750cb964f | ||
|
|
c7e9fc54d9 | ||
|
|
bbc325efdb | ||
|
|
1d8a18691b | ||
|
|
40e61ae260 | ||
|
|
22463f2e42 | ||
|
|
b6118e8650 | ||
|
|
4aad60a738 | ||
|
|
f802995f36 | ||
|
|
582f828b59 | ||
|
|
40b9d50d82 | ||
|
|
495376923b | ||
|
|
e9f0d5214f | ||
|
|
9073d294fb | ||
|
|
10008e4a43 | ||
|
|
682ce814c1 | ||
|
|
97fe74ee79 | ||
|
|
c326a74a7b | ||
|
|
ac87388fb1 | ||
|
|
e39309c4c3 |
5 changed files with 191 additions and 76 deletions
|
|
@ -11,7 +11,7 @@ Since the upstream default window size is only of size 10 items
|
||||||
(by default), it calculates the average speed only for the last
|
(by default), it calculates the average speed only for the last
|
||||||
~0.005s. We could enlarge the size of window (sma_window param),
|
~0.005s. We could enlarge the size of window (sma_window param),
|
||||||
but the algorithm is so naive that it would decrease the
|
but the algorithm is so naive that it would decrease the
|
||||||
performance.
|
performance (O(N): sum(queue)/len(queue)).
|
||||||
|
|
||||||
This has been discussed very extensively with upstream (PR 24 and
|
This has been discussed very extensively with upstream (PR 24 and
|
||||||
friends) but I neither was not able to explain the problem, nor I
|
friends) but I neither was not able to explain the problem, nor I
|
||||||
|
|
@ -26,11 +26,11 @@ Fork with this patch backported is maintained in
|
||||||
https://github.com/python-progress/python-progress
|
https://github.com/python-progress/python-progress
|
||||||
|
|
||||||
diff --git a/progress/__init__.py b/progress/__init__.py
|
diff --git a/progress/__init__.py b/progress/__init__.py
|
||||||
index a41f65d..1147462 100644
|
index b434b30..f26056d 100644
|
||||||
--- a/progress/__init__.py
|
--- a/progress/__init__.py
|
||||||
+++ b/progress/__init__.py
|
+++ b/progress/__init__.py
|
||||||
@@ -24,16 +24,53 @@ from time import time
|
@@ -30,19 +30,55 @@ HIDE_CURSOR = '\x1b[?25l'
|
||||||
__version__ = '1.4'
|
SHOW_CURSOR = '\x1b[?25h'
|
||||||
|
|
||||||
|
|
||||||
+class _Window(object):
|
+class _Window(object):
|
||||||
|
|
@ -41,7 +41,7 @@ index a41f65d..1147462 100644
|
||||||
+ self.max_seconds = max_seconds
|
+ self.max_seconds = max_seconds
|
||||||
+ self.max_items = max_items
|
+ self.max_items = max_items
|
||||||
+
|
+
|
||||||
+ stamp = time()
|
+ stamp = monotonic()
|
||||||
+ self.last = stamp - 0.001
|
+ self.last = stamp - 0.001
|
||||||
+ self.counter = 0
|
+ self.counter = 0
|
||||||
+ self.deque = deque()
|
+ self.deque = deque()
|
||||||
|
|
@ -55,7 +55,7 @@ index a41f65d..1147462 100644
|
||||||
+ if self.max_items:
|
+ if self.max_items:
|
||||||
+ while len(self.deque) > self.max_items:
|
+ while len(self.deque) > self.max_items:
|
||||||
+ self.pop()
|
+ self.pop()
|
||||||
+ while len(self.deque) > 2 and self.last - self.deque[0][0] > float(self.max_seconds):
|
+ while len(self.deque) > 2 and self.last - self.deque[1][0] > float(self.max_seconds):
|
||||||
+ self.pop()
|
+ self.pop()
|
||||||
+
|
+
|
||||||
+ def next(self, n, t):
|
+ def next(self, n, t):
|
||||||
|
|
@ -76,27 +76,30 @@ index a41f65d..1147462 100644
|
||||||
+ # window structure (in memory), default is unlimited.
|
+ # window structure (in memory), default is unlimited.
|
||||||
+ sma_window_seconds = 2
|
+ sma_window_seconds = 2
|
||||||
+ sma_window = None
|
+ sma_window = None
|
||||||
|
check_tty = True
|
||||||
|
hide_cursor = True
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, message='', **kwargs):
|
||||||
self.index = 0
|
self.index = 0
|
||||||
self.start_ts = time()
|
self.start_ts = monotonic()
|
||||||
- self.avg = 0
|
- self.avg = 0
|
||||||
|
- self._avg_update_ts = self.start_ts
|
||||||
- self._ts = self.start_ts
|
- self._ts = self.start_ts
|
||||||
- self._xput = deque(maxlen=self.sma_window)
|
- self._xput = deque(maxlen=self.sma_window)
|
||||||
+ self.window = _Window(self.sma_window_seconds, self.sma_window)
|
+ self.window = _Window(self.sma_window_seconds, self.sma_window)
|
||||||
for key, val in kwargs.items():
|
for key, val in kwargs.items():
|
||||||
setattr(self, key, val)
|
setattr(self, key, val)
|
||||||
|
|
||||||
@@ -46,15 +83,17 @@ class Infinite(object):
|
@@ -69,21 +105,17 @@ class Infinite(object):
|
||||||
def elapsed(self):
|
def elapsed(self):
|
||||||
return int(time() - self.start_ts)
|
return int(monotonic() - self.start_ts)
|
||||||
|
|
||||||
+ @property
|
+ @property
|
||||||
+ def avg(self):
|
+ def avg(self):
|
||||||
+ speed = self.window.avg
|
+ speed = self.window.avg
|
||||||
+ if speed:
|
+ if speed:
|
||||||
+ return 1/speed
|
+ return 1/speed
|
||||||
+ return 3600 # better constant?
|
+ return float("inf")
|
||||||
+
|
+
|
||||||
@property
|
@property
|
||||||
def elapsed_td(self):
|
def elapsed_td(self):
|
||||||
|
|
@ -104,21 +107,32 @@ index a41f65d..1147462 100644
|
||||||
|
|
||||||
- def update_avg(self, n, dt):
|
- def update_avg(self, n, dt):
|
||||||
- if n > 0:
|
- if n > 0:
|
||||||
|
- xput_len = len(self._xput)
|
||||||
- self._xput.append(dt / n)
|
- self._xput.append(dt / n)
|
||||||
- self.avg = sum(self._xput) / len(self._xput)
|
- now = monotonic()
|
||||||
|
- # update when we're still filling _xput, then after every second
|
||||||
|
- if (xput_len < self.sma_window or
|
||||||
|
- now - self._avg_update_ts > 1):
|
||||||
|
- self.avg = sum(self._xput) / len(self._xput)
|
||||||
|
- self._avg_update_ts = now
|
||||||
-
|
-
|
||||||
def update(self):
|
def update(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@@ -65,10 +104,7 @@ class Infinite(object):
|
@@ -112,14 +144,10 @@ class Infinite(object):
|
||||||
pass
|
try:
|
||||||
|
return self.file.isatty() if self.check_tty else True
|
||||||
|
except AttributeError:
|
||||||
|
- msg = "%s has no attribute 'isatty'. Try setting check_tty=False." % self
|
||||||
|
- raise AttributeError(msg)
|
||||||
|
+ raise AttributeError('\'{}\' object has no attribute \'isatty\'. Try setting parameter check_tty=False.'.format(self))
|
||||||
|
|
||||||
def next(self, n=1):
|
def next(self, n=1):
|
||||||
- now = time()
|
- now = monotonic()
|
||||||
- dt = now - self._ts
|
- dt = now - self._ts
|
||||||
- self.update_avg(n, dt)
|
- self.update_avg(n, dt)
|
||||||
- self._ts = now
|
- self._ts = now
|
||||||
+ self.window.next(n, time())
|
+ self.window.next(n, monotonic())
|
||||||
self.index = self.index + n
|
self.index = self.index + n
|
||||||
self.update()
|
self.update()
|
||||||
|
|
||||||
|
|
|
||||||
1
README.md
Normal file
1
README.md
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
See also automatic push/pr [Copr builds](https://copr.fedorainfracloud.org/coprs/praiskup/enterprise-ci-python-progress/).
|
||||||
39
build-and-update-all-branches
Executable file
39
build-and-update-all-branches
Executable file
|
|
@ -0,0 +1,39 @@
|
||||||
|
#! /bin/sh
|
||||||
|
|
||||||
|
# Prepare main branch, review the list of branches below and then execute this
|
||||||
|
# script.
|
||||||
|
|
||||||
|
branches='main epel8 epel9 epel10 f39 f40 f41'
|
||||||
|
|
||||||
|
exit_handler ()
|
||||||
|
{
|
||||||
|
git checkout main
|
||||||
|
}
|
||||||
|
|
||||||
|
trap exit_handler EXIT
|
||||||
|
|
||||||
|
set -e
|
||||||
|
set -x
|
||||||
|
|
||||||
|
koji hello
|
||||||
|
|
||||||
|
tasks=
|
||||||
|
for branch in $branches; do
|
||||||
|
if test $branch != main; then
|
||||||
|
git checkout "$branch"
|
||||||
|
git merge main
|
||||||
|
fi
|
||||||
|
git push
|
||||||
|
skip_nvr_check=
|
||||||
|
if test $branch = epel7; then
|
||||||
|
skip_nvr_check=--skip-nvr-check
|
||||||
|
fi
|
||||||
|
tasks="${tasks}`fedpkg build $skip_nvr_check --nowait | grep 'Created task' | cut -d: -f2`"
|
||||||
|
done
|
||||||
|
|
||||||
|
if test -n "$tasks"; then
|
||||||
|
koji watch-task $tasks
|
||||||
|
fi
|
||||||
|
|
||||||
|
git checkout main
|
||||||
|
fedpkg update
|
||||||
|
|
@ -1,103 +1,164 @@
|
||||||
%if 0%{?fedora}
|
|
||||||
%bcond_without python3
|
|
||||||
%if 0%{?fedora} > 29
|
|
||||||
%bcond_with python2
|
|
||||||
%else
|
|
||||||
%bcond_without python2
|
|
||||||
%endif
|
|
||||||
%else
|
|
||||||
%if 0%{?rhel} > 7
|
|
||||||
%bcond_with python2
|
|
||||||
%bcond_without python3
|
|
||||||
%else
|
|
||||||
%bcond_without python2
|
|
||||||
%bcond_with python3
|
|
||||||
%endif
|
|
||||||
%endif
|
|
||||||
|
|
||||||
# Created by pyp2rpm-0.5.2
|
|
||||||
%global pypi_name progress
|
%global pypi_name progress
|
||||||
|
|
||||||
Name: python-%{pypi_name}
|
Name: python-%{pypi_name}
|
||||||
Version: 1.4
|
Version: 1.6
|
||||||
Release: 3%{?dist}
|
Release: 19%{?dist}
|
||||||
Summary: Easy to use progress bars
|
Summary: Easy to use progress bars
|
||||||
|
|
||||||
License: ISC
|
License: ISC
|
||||||
URL: http://github.com/verigak/progress/
|
URL: http://github.com/verigak/progress/
|
||||||
Source0: %pypi_source
|
Source0: %{pypi_source %{pypi_name}}
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
|
|
||||||
%if %{with python2}
|
|
||||||
BuildRequires: python2-devel
|
|
||||||
BuildRequires: python2-setuptools
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%if %{with python3}
|
|
||||||
BuildRequires: python3-devel
|
BuildRequires: python3-devel
|
||||||
|
%if %{defined el8}
|
||||||
BuildRequires: python3-setuptools
|
BuildRequires: python3-setuptools
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
Patch1: 0001-fixup-moving-average-window.patch
|
Patch1: 0001-fixup-moving-average-window.patch
|
||||||
|
|
||||||
%global _description\
|
%global _description %{expand:
|
||||||
Collection of easy to use progress bars and spinners.\
|
Collection of easy to use progress bars and spinners.}
|
||||||
|
|
||||||
|
|
||||||
%description %_description
|
%description %_description
|
||||||
|
|
||||||
|
|
||||||
%if 0%{with python2}
|
|
||||||
%package -n python2-%{pypi_name}
|
|
||||||
Summary: %summary
|
|
||||||
%{?python_provide:%python_provide python2-%{pypi_name}}
|
|
||||||
|
|
||||||
%description -n python2-%{pypi_name} %_description
|
|
||||||
%endif # python2
|
|
||||||
|
|
||||||
|
|
||||||
%if 0%{with python3}
|
|
||||||
%package -n python3-%{pypi_name}
|
%package -n python3-%{pypi_name}
|
||||||
Summary: Easy to use progress bars
|
Summary: Easy to use progress bars
|
||||||
|
|
||||||
%description -n python3-%{pypi_name}
|
%description -n python3-%{pypi_name} %_description
|
||||||
Collection of easy to use progress bars and spinners.
|
|
||||||
%endif # python3
|
|
||||||
|
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%autosetup -p1 -n %{pypi_name}-%{version}
|
%autosetup -p1 -n %{pypi_name}-%{version}
|
||||||
|
|
||||||
# Remove bundled egg-info
|
|
||||||
rm -rf %{pypi_name}.egg-info
|
%if %{undefined el8}
|
||||||
|
%generate_buildrequires
|
||||||
|
%pyproject_buildrequires
|
||||||
|
%endif
|
||||||
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%{?with_python2: %py2_build}
|
%if %{defined el8}
|
||||||
%{?with_python3: %py3_build}
|
%py3_build
|
||||||
|
%else
|
||||||
|
%pyproject_wheel
|
||||||
|
%endif
|
||||||
|
|
||||||
|
|
||||||
%install
|
%install
|
||||||
%{?with_python2: %py2_install}
|
%if %{defined el8}
|
||||||
%{?with_python3: %py3_install}
|
%py3_install
|
||||||
|
%else
|
||||||
|
%pyproject_install
|
||||||
%if 0%{with python2}
|
%pyproject_save_files -l %{pypi_name}
|
||||||
%files -n python2-%{pypi_name}
|
|
||||||
%doc README.rst LICENSE
|
|
||||||
%{python2_sitelib}/%{pypi_name}
|
|
||||||
%{python2_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
|
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%if 0%{with python3}
|
|
||||||
%files -n python3-%{pypi_name}
|
%check
|
||||||
%doc README.rst LICENSE
|
%if %{defined el8}
|
||||||
|
%py3_check_import %{pypi_name}
|
||||||
|
%else
|
||||||
|
%pyproject_check_import
|
||||||
|
%endif
|
||||||
|
|
||||||
|
|
||||||
|
%files -n python3-%{pypi_name} %{!?el8:-f %{pyproject_files}}
|
||||||
|
%doc README.rst
|
||||||
|
%if %{defined el8}
|
||||||
|
%license LICENSE
|
||||||
%{python3_sitelib}/%{pypi_name}
|
%{python3_sitelib}/%{pypi_name}
|
||||||
%{python3_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
|
%{python3_sitelib}/%{pypi_name}-%{version}-py%{python3_version}.egg-info
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Sep 19 2025 Python Maint <python-maint@redhat.com> - 1.6-19
|
||||||
|
- Rebuilt for Python 3.14.0rc3 bytecode
|
||||||
|
|
||||||
|
* Fri Aug 15 2025 Python Maint <python-maint@redhat.com> - 1.6-18
|
||||||
|
- Rebuilt for Python 3.14.0rc2 bytecode
|
||||||
|
|
||||||
|
* Fri Jul 25 2025 Fedora Release Engineering <releng@fedoraproject.org> - 1.6-17
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild
|
||||||
|
|
||||||
|
* Mon Jun 02 2025 Python Maint <python-maint@redhat.com> - 1.6-16
|
||||||
|
- Rebuilt for Python 3.14
|
||||||
|
|
||||||
|
* Sat Jan 18 2025 Fedora Release Engineering <releng@fedoraproject.org> - 1.6-15
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild
|
||||||
|
|
||||||
|
* Tue Sep 24 2024 Carl George <carlwgeorge@fedoraproject.org> - 1.6-14
|
||||||
|
- Convert to pyproject macros
|
||||||
|
|
||||||
|
* Fri Jul 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.6-13
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
|
||||||
|
|
||||||
|
* Fri Jun 07 2024 Python Maint <python-maint@redhat.com> - 1.6-12
|
||||||
|
- Rebuilt for Python 3.13
|
||||||
|
|
||||||
|
* Fri Jan 26 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.6-11
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
|
||||||
|
|
||||||
|
* Mon Jan 22 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.6-10
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
|
||||||
|
|
||||||
|
* Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.6-9
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
|
||||||
|
|
||||||
|
* Tue Jun 13 2023 Python Maint <python-maint@redhat.com> - 1.6-8
|
||||||
|
- Rebuilt for Python 3.12
|
||||||
|
|
||||||
|
* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.6-7
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
|
||||||
|
|
||||||
|
* Fri Jul 22 2022 Pavel Raiskup <praiskup@redhat.com> - 1.6-6
|
||||||
|
- use time.monotonic(), bar.avg is infinity for zero speed
|
||||||
|
|
||||||
|
* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.6-5
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
|
||||||
|
|
||||||
|
* Sat Jul 02 2022 Pavel Raiskup <praiskup@redhat.com> - 1.6-4
|
||||||
|
- fix for very frequent next() call, rhbz#2103093
|
||||||
|
|
||||||
|
* Mon Jun 13 2022 Python Maint <python-maint@redhat.com> - 1.6-3
|
||||||
|
- Rebuilt for Python 3.11
|
||||||
|
|
||||||
|
* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.6-2
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
|
||||||
|
|
||||||
|
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.5-10
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
|
||||||
|
|
||||||
|
* Fri Jun 04 2021 Python Maint <python-maint@redhat.com> - 1.5-9
|
||||||
|
- Rebuilt for Python 3.10
|
||||||
|
|
||||||
|
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.5-8
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
||||||
|
|
||||||
|
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.5-7
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
||||||
|
|
||||||
|
* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 1.5-6
|
||||||
|
- Rebuilt for Python 3.9
|
||||||
|
|
||||||
|
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.5-5
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
||||||
|
|
||||||
|
* Thu Oct 03 2019 Miro Hrončok <mhroncok@redhat.com> - 1.5-4
|
||||||
|
- Rebuilt for Python 3.8.0rc1 (#1748018)
|
||||||
|
|
||||||
|
* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 1.5-3
|
||||||
|
- Rebuilt for Python 3.8
|
||||||
|
|
||||||
|
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.5-2
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
||||||
|
|
||||||
|
* Mon Mar 18 2019 Pavel Raiskup <praiskup@redhat.com> - 1.5-1
|
||||||
|
- the latest upstream release
|
||||||
|
|
||||||
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.4-3
|
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.4-3
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
|
||||||
|
|
||||||
|
|
|
||||||
2
sources
2
sources
|
|
@ -1 +1 @@
|
||||||
SHA512 (progress-1.4.tar.gz) = f9973ac4f670632fa4ab27232f53c0c74992329a298f95ea6a39ba7a4cbdccfacd44a49c367bf45d739d4fb652e13c271792eff509c9277e2250c2cdb3e82c48
|
SHA512 (progress-1.6.tar.gz) = 58a614bba5a7273a42ba5e9607b3a965fec17f26a4f24563d4c13679ea32b23dda7509c5da81a2a34bebeeedd91154d0457ab8dac95cc7a092add2567249cc94
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue