3 %bcond_without doc # don't build doc
4 %bcond_without tests # do not perform "make test"
5 %bcond_without python2 # CPython 2.x module
6 %bcond_with python3 # CPython 3.x module, build for Python3<3.5
9 %define egg_name scandir
10 Summary: A better directory iterator and faster os.walk() for Python 2
11 Summary(pl.UTF-8): Lepszy iterator po katalogach i szybsze os.walk() dla Pythona 2
12 Name: python-%{module}
16 Group: Libraries/Python
17 #Source0Download: https://github.com/benhoyt/scandir/releases
18 Source0: https://github.com/benhoyt/scandir/archive/v%{version}/%{module}-%{version}.tar.gz
19 # Source0-md5: 798407545833aa7011c1ee34b580e902
20 URL: https://github.com/benhoyt/scandir
21 %if %{with tests} && %(locale -a | grep -q '^C\.UTF-8$'; echo $?)
22 BuildRequires: glibc-localedb-all
25 BuildRequires: python-modules >= 1:2.6
26 BuildRequires: python-setuptools
29 BuildRequires: python3-modules >= 1:3.2
30 BuildRequires: python3-setuptools
32 BuildRequires: rpm-pythonprov
33 BuildRequires: rpmbuild(macros) >= 1.714
34 Requires: python-modules >= 1:2.6
35 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
38 scandir() is a directory iteration function like os.listdir(), except
39 that instead of returning a list of bare filenames, it yields DirEntry
40 objects that include file type and stat information along with the
41 name. Using scandir() increases the speed of os.walk() by 2-20 times
42 (depending on the platform and file system) by avoiding unnecessary
43 calls to os.stat() in most cases. scandir is included in the Python
44 3.5+ standard library.
46 %description -l pl.UTF-8
47 scandir() to funkcja iterująca po katalogu podobna do os.listdir(),
48 ale zamiast zwracania listy samych nazw plików, przekazująca przez
49 yield obiekty DirEntry, zawierające poza nazwą typ pliku oraz
50 informacje stat. Użycie scandir() przyspiesza os.walk() 2-20 razy (w
51 zależności od platformy i systemu plików), zapobiegając w większości
52 przypadków niepotrzebnym wywołaniom os.stat(). scandir jest zawarte w
53 bibliotece standardowej Pythona 3.5+.
55 %package -n python3-%{module}
56 Summary: A better directory iterator and faster os.walk() for Python 3 < 3.5
57 Summary(pl.UTF-8): Lepszy iterator po katalogach i szybsze os.walk() dla Pythona 3 < 3.5
58 Group: Libraries/Python
59 Requires: python3-modules >= 1:3.2
61 %description -n python3-%{module}
62 scandir() is a directory iteration function like os.listdir(), except
63 that instead of returning a list of bare filenames, it yields DirEntry
64 objects that include file type and stat information along with the
65 name. Using scandir() increases the speed of os.walk() by 2-20 times
66 (depending on the platform and file system) by avoiding unnecessary
67 calls to os.stat() in most cases. scandir is included in the Python
68 3.5+ standard library.
70 %description -n python3-%{module} -l pl.UTF-8
71 scandir() to funkcja iterująca po katalogu podobna do os.listdir(),
72 ale zamiast zwracania listy samych nazw plików, przekazująca przez
73 yield obiekty DirEntry, zawierające poza nazwą typ pliku oraz
74 informacje stat. Użycie scandir() przyspiesza os.walk() 2-20 razy (w
75 zależności od platformy i systemu plików), zapobiegając w większości
76 przypadków niepotrzebnym wywołaniom os.stat(). scandir jest zawarte w
77 bibliotece standardowej Pythona 3.5+.
80 %setup -q -n %{module}-%{version}
88 # Tests fail if unicode is not supported
90 %{__python} test/run_tests.py
100 # Tests fail if unicode is not supported
102 %{__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