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 Patch0: %{name}-linux.patch
21 URL: https://github.com/benhoyt/scandir
22 %if %{with tests} && %(locale -a | grep -q '^C\.UTF-8$'; echo $?)
23 BuildRequires: glibc-localedb-all
26 BuildRequires: python-modules >= 1:2.6
27 BuildRequires: python-setuptools
30 BuildRequires: python3-modules >= 1:3.2
31 BuildRequires: python3-setuptools
33 BuildRequires: rpm-pythonprov
34 BuildRequires: rpmbuild(macros) >= 1.714
35 Requires: python-modules >= 1:2.6
36 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
39 scandir() is a directory iteration function like os.listdir(), except
40 that instead of returning a list of bare filenames, it yields DirEntry
41 objects that include file type and stat information along with the
42 name. Using scandir() increases the speed of os.walk() by 2-20 times
43 (depending on the platform and file system) by avoiding unnecessary
44 calls to os.stat() in most cases. scandir is included in the Python
45 3.5+ standard library.
47 %description -l pl.UTF-8
48 scandir() to funkcja iterująca po katalogu podobna do os.listdir(),
49 ale zamiast zwracania listy samych nazw plików, przekazująca przez
50 yield obiekty DirEntry, zawierające poza nazwą typ pliku oraz
51 informacje stat. Użycie scandir() przyspiesza os.walk() 2-20 razy (w
52 zależności od platformy i systemu plików), zapobiegając w większości
53 przypadków niepotrzebnym wywołaniom os.stat(). scandir jest zawarte w
54 bibliotece standardowej Pythona 3.5+.
56 %package -n python3-%{module}
57 Summary: A better directory iterator and faster os.walk() for Python 3 < 3.5
58 Summary(pl.UTF-8): Lepszy iterator po katalogach i szybsze os.walk() dla Pythona 3 < 3.5
59 Group: Libraries/Python
60 Requires: python3-modules >= 1:3.2
62 %description -n python3-%{module}
63 scandir() is a directory iteration function like os.listdir(), except
64 that instead of returning a list of bare filenames, it yields DirEntry
65 objects that include file type and stat information along with the
66 name. Using scandir() increases the speed of os.walk() by 2-20 times
67 (depending on the platform and file system) by avoiding unnecessary
68 calls to os.stat() in most cases. scandir is included in the Python
69 3.5+ standard library.
71 %description -n python3-%{module} -l pl.UTF-8
72 scandir() to funkcja iterująca po katalogu podobna do os.listdir(),
73 ale zamiast zwracania listy samych nazw plików, przekazująca przez
74 yield obiekty DirEntry, zawierające poza nazwą typ pliku oraz
75 informacje stat. Użycie scandir() przyspiesza os.walk() 2-20 razy (w
76 zależności od platformy i systemu plików), zapobiegając w większości
77 przypadków niepotrzebnym wywołaniom os.stat(). scandir jest zawarte w
78 bibliotece standardowej Pythona 3.5+.
81 %setup -q -n %{module}-%{version}
90 # Tests fail if unicode is not supported
92 PYTHONPATH=$(pwd)/$(echo build-2/lib.linux-*) \
93 %{__python} test/run_tests.py
102 # Tests fail if unicode is not supported
104 PYTHONPATH=$(pwd)/$(echo build-3/lib.linux-*) \
105 %{__python3} test/run_tests.py
110 rm -rf $RPM_BUILD_ROOT
121 rm -rf $RPM_BUILD_ROOT
125 %defattr(644,root,root,755)
126 %doc LICENSE.txt README.rst
127 %{py_sitedir}/scandir.py[co]
128 %attr(755,root,root) %{py_sitedir}/_scandir.so
129 %{py_sitedir}/%{egg_name}-%{version}-py*.egg-info
133 %files -n python3-%{module}
134 %defattr(644,root,root,755)
135 %doc LICENSE.txt README.rst
136 %{py3_sitedir}/scandir.py
137 %{py3_sitedir}/__pycache__/scandir.cpython-*.pyc
138 %attr(755,root,root) %{py3_sitedir}/_scandir.cpython-*.so
139 %{py3_sitedir}/%{egg_name}-%{version}-py*.egg-info