]> git.pld-linux.org Git - packages/python-scandir.git/blob - python-scandir.spec
bbd19c95f21f14869be883394cc5ec98054319f4
[packages/python-scandir.git] / python-scandir.spec
1 #
2 # Conditional build:
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
7
8 %define         module          scandir
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}
13 Version:        1.5
14 Release:        2
15 License:        BSD
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
24 %endif
25 %if %{with python2}
26 BuildRequires:  python-modules >= 1:2.6
27 BuildRequires:  python-setuptools
28 %endif
29 %if %{with python3}
30 BuildRequires:  python3-modules >= 1:3.2
31 BuildRequires:  python3-setuptools
32 %endif
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)
37
38 %description
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.
46
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+.
55
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
61
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.
70
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+.
79
80 %prep
81 %setup -q -n %{module}-%{version}
82 %patch0 -p1
83
84 %build
85 %if %{with python2}
86 %py_build
87
88 %if %{with tests}
89 rm -rf test/testdir
90 # Tests fail if unicode is not supported
91 LC_ALL=C.UTF-8 \
92 PYTHONPATH=$(pwd)/$(echo build-2/lib.linux-*) \
93 %{__python} test/run_tests.py
94 %endif
95 %endif
96
97 %if %{with python3}
98 %py3_build
99
100 %if %{with tests}
101 rm -rf test/testdir
102 # Tests fail if unicode is not supported
103 LC_ALL=C.UTF-8 \
104 PYTHONPATH=$(pwd)/$(echo build-3/lib.linux-*) \
105 %{__python3} test/run_tests.py
106 %endif
107 %endif
108
109 %install
110 rm -rf $RPM_BUILD_ROOT
111 %if %{with python2}
112 %py_install
113 %py_postclean
114 %endif
115
116 %if %{with python3}
117 %py3_install
118 %endif
119
120 %clean
121 rm -rf $RPM_BUILD_ROOT
122
123 %if %{with python2}
124 %files
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
130 %endif
131
132 %if %{with python3}
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
140 %endif
This page took 0.037894 seconds and 3 git commands to generate.