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