3 %bcond_without tests # unit tests
4 %bcond_without python2 # CPython 2.x module
5 %bcond_without python3 # CPython 3.x module
7 %if "%{_ver_ge '%{py3_ver}' '3.9'}" == "1"
11 %define module scandir
12 %define egg_name scandir
13 Summary: A better directory iterator and faster os.walk() for Python 2
14 Summary(pl.UTF-8): Lepszy iterator po katalogach i szybsze os.walk() dla Pythona 2
15 Name: python-%{module}
19 Group: Libraries/Python
20 Source0: https://github.com/benhoyt/scandir/archive/v%{version}/%{module}-%{version}.tar.gz
21 # Source0-md5: 6357f342d776a2ce056e1731e67631ae
22 Patch0: %{name}-linux.patch
23 URL: https://github.com/benhoyt/scandir
24 %if %{with tests} && %(locale -a | grep -q '^C\.utf8$'; echo $?)
25 BuildRequires: glibc-localedb-all
28 BuildRequires: python-modules >= 1:2.7
29 BuildRequires: python-setuptools
32 BuildRequires: python3-modules >= 1:3.4
33 BuildRequires: python3-setuptools
35 BuildRequires: rpm-pythonprov
36 BuildRequires: rpmbuild(macros) >= 1.750
37 Requires: python-modules >= 1:2.7
38 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
41 scandir() is a directory iteration function like os.listdir(), except
42 that instead of returning a list of bare filenames, it yields DirEntry
43 objects that include file type and stat information along with the
44 name. Using scandir() increases the speed of os.walk() by 2-20 times
45 (depending on the platform and file system) by avoiding unnecessary
46 calls to os.stat() in most cases. scandir is included in the Python
47 3.5+ standard library.
49 %description -l pl.UTF-8
50 scandir() to funkcja iterująca po katalogu podobna do os.listdir(),
51 ale zamiast zwracania listy samych nazw plików, przekazująca przez
52 yield obiekty DirEntry, zawierające poza nazwą typ pliku oraz
53 informacje stat. Użycie scandir() przyspiesza os.walk() 2-20 razy (w
54 zależności od platformy i systemu plików), zapobiegając w większości
55 przypadków niepotrzebnym wywołaniom os.stat(). scandir jest zawarte w
56 bibliotece standardowej Pythona 3.5+.
58 %package -n python3-%{module}
59 Summary: A better directory iterator and faster os.walk() for Python 3 < 3.5
60 Summary(pl.UTF-8): Lepszy iterator po katalogach i szybsze os.walk() dla Pythona 3 < 3.5
61 Group: Libraries/Python
62 Requires: python3-modules >= 1:3.4
64 %description -n python3-%{module}
65 scandir() is a directory iteration function like os.listdir(), except
66 that instead of returning a list of bare filenames, it yields DirEntry
67 objects that include file type and stat information along with the
68 name. Using scandir() increases the speed of os.walk() by 2-20 times
69 (depending on the platform and file system) by avoiding unnecessary
70 calls to os.stat() in most cases. scandir is included in the Python
71 3.5+ standard library.
73 %description -n python3-%{module} -l pl.UTF-8
74 scandir() to funkcja iterująca po katalogu podobna do os.listdir(),
75 ale zamiast zwracania listy samych nazw plików, przekazująca przez
76 yield obiekty DirEntry, zawierające poza nazwą typ pliku oraz
77 informacje stat. Użycie scandir() przyspiesza os.walk() 2-20 razy (w
78 zależności od platformy i systemu plików), zapobiegając w większości
79 przypadków niepotrzebnym wywołaniom os.stat(). scandir jest zawarte w
80 bibliotece standardowej Pythona 3.5+.
83 %setup -q -n %{module}-%{version}
92 # Tests fail if unicode is not supported
94 PYTHONPATH=$(pwd)/$(echo build-2/lib.linux-*) \
95 %{__python} test/run_tests.py
104 # Tests fail if unicode is not supported
106 PYTHONPATH=$(pwd)/$(echo build-3/lib.linux-*) \
107 %{__python3} test/run_tests.py
112 rm -rf $RPM_BUILD_ROOT
123 rm -rf $RPM_BUILD_ROOT
127 %defattr(644,root,root,755)
128 %doc LICENSE.txt README.rst
129 %{py_sitedir}/scandir.py[co]
130 %attr(755,root,root) %{py_sitedir}/_scandir.so
131 %{py_sitedir}/%{egg_name}-%{version}-py*.egg-info
135 %files -n python3-%{module}
136 %defattr(644,root,root,755)
137 %doc LICENSE.txt README.rst
138 %{py3_sitedir}/scandir.py
139 %{py3_sitedir}/__pycache__/scandir.cpython-*.pyc
140 %attr(755,root,root) %{py3_sitedir}/_scandir.cpython-*.so
141 %{py3_sitedir}/%{egg_name}-%{version}-py*.egg-info