]> git.pld-linux.org Git - packages/python-scandir.git/blob - python-scandir.spec
03753a38e008410f8ab832d909179c5f0e52b8b1
[packages/python-scandir.git] / python-scandir.spec
1 #
2 # Conditional build:
3 %bcond_without  tests   # unit tests
4 %bcond_without  python2 # CPython 2.x module
5 %bcond_without  python3 # CPython 3.x module
6
7 %if "%{_ver_ge '%{py3_ver}' '3.9'}" == "1"
8 %undefine       with_python3
9 %endif
10
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}
16 Version:        1.10.0
17 Release:        5
18 License:        BSD
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
26 %endif
27 %if %{with python2}
28 BuildRequires:  python-modules >= 1:2.7
29 BuildRequires:  python-setuptools
30 %endif
31 %if %{with python3}
32 BuildRequires:  python3-modules >= 1:3.4
33 BuildRequires:  python3-setuptools
34 %endif
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)
39
40 %description
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.
48
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+.
57
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
63
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.
72
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+.
81
82 %prep
83 %setup -q -n %{module}-%{version}
84 %patch0 -p1
85
86 %build
87 %if %{with python2}
88 %py_build
89
90 %if %{with tests}
91 rm -rf test/testdir
92 # Tests fail if unicode is not supported
93 LC_ALL=C.UTF-8 \
94 PYTHONPATH=$(pwd)/$(echo build-2/lib.linux-*) \
95 %{__python} test/run_tests.py
96 %endif
97 %endif
98
99 %if %{with python3}
100 %py3_build
101
102 %if %{with tests}
103 rm -rf test/testdir
104 # Tests fail if unicode is not supported
105 LC_ALL=C.UTF-8 \
106 PYTHONPATH=$(pwd)/$(echo build-3/lib.linux-*) \
107 %{__python3} test/run_tests.py
108 %endif
109 %endif
110
111 %install
112 rm -rf $RPM_BUILD_ROOT
113 %if %{with python2}
114 %py_install
115 %py_postclean
116 %endif
117
118 %if %{with python3}
119 %py3_install
120 %endif
121
122 %clean
123 rm -rf $RPM_BUILD_ROOT
124
125 %if %{with python2}
126 %files
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
132 %endif
133
134 %if %{with python3}
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
142 %endif
This page took 0.057887 seconds and 2 git commands to generate.