]>
Commit | Line | Data |
---|---|---|
db7f2496 | 1 | # |
2bef8222 | 2 | # Conditional build: |
db7f2496 | 3 | %bcond_without tests # unit tests |
2bef8222 | 4 | %bcond_without python2 # CPython 2.x module |
6f393d6e | 5 | %bcond_without python3 # CPython 3.x module |
2bef8222 | 6 | |
2c856c10 JP |
7 | %if "%{_ver_ge '%{py3_ver}' '3.9'}" == "1" |
8 | %undefine with_python3 | |
9 | %endif | |
10 | ||
2bef8222 ER |
11 | %define module scandir |
12 | %define egg_name scandir | |
45efccd0 JB |
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 | |
2bef8222 | 15 | Name: python-%{module} |
8e00432f | 16 | Version: 1.10.0 |
5dc16492 | 17 | Release: 6 |
2bef8222 ER |
18 | License: BSD |
19 | Group: Libraries/Python | |
20 | Source0: https://github.com/benhoyt/scandir/archive/v%{version}/%{module}-%{version}.tar.gz | |
8e00432f | 21 | # Source0-md5: 6357f342d776a2ce056e1731e67631ae |
2928c4fd | 22 | Patch0: %{name}-linux.patch |
2bef8222 | 23 | URL: https://github.com/benhoyt/scandir |
db7f2496 | 24 | %if %{with tests} && %(locale -a | grep -q '^C\.utf8$'; echo $?) |
45efccd0 JB |
25 | BuildRequires: glibc-localedb-all |
26 | %endif | |
2bef8222 | 27 | %if %{with python2} |
8e00432f | 28 | BuildRequires: python-modules >= 1:2.7 |
2bef8222 ER |
29 | BuildRequires: python-setuptools |
30 | %endif | |
31 | %if %{with python3} | |
db7f2496 | 32 | BuildRequires: python3-modules >= 1:3.4 |
2bef8222 ER |
33 | BuildRequires: python3-setuptools |
34 | %endif | |
45efccd0 | 35 | BuildRequires: rpm-pythonprov |
2c856c10 | 36 | BuildRequires: rpmbuild(macros) >= 1.750 |
8e00432f | 37 | Requires: python-modules >= 1:2.7 |
2bef8222 ER |
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 | ||
45efccd0 JB |
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 | ||
2bef8222 | 58 | %package -n python3-%{module} |
45efccd0 JB |
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 | |
2bef8222 | 61 | Group: Libraries/Python |
db7f2496 | 62 | Requires: python3-modules >= 1:3.4 |
2bef8222 ER |
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 | ||
45efccd0 JB |
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 | ||
2bef8222 ER |
82 | %prep |
83 | %setup -q -n %{module}-%{version} | |
2928c4fd | 84 | %patch0 -p1 |
2bef8222 ER |
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 | |
45efccd0 | 93 | LC_ALL=C.UTF-8 \ |
2928c4fd | 94 | PYTHONPATH=$(pwd)/$(echo build-2/lib.linux-*) \ |
2bef8222 ER |
95 | %{__python} test/run_tests.py |
96 | %endif | |
2bef8222 ER |
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 | |
45efccd0 | 105 | LC_ALL=C.UTF-8 \ |
2928c4fd | 106 | PYTHONPATH=$(pwd)/$(echo build-3/lib.linux-*) \ |
2bef8222 ER |
107 | %{__python3} test/run_tests.py |
108 | %endif | |
2bef8222 ER |
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) | |
45efccd0 JB |
128 | %doc LICENSE.txt README.rst |
129 | %{py_sitedir}/scandir.py[co] | |
130 | %attr(755,root,root) %{py_sitedir}/_scandir.so | |
2bef8222 ER |
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) | |
45efccd0 JB |
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 | |
2bef8222 ER |
141 | %{py3_sitedir}/%{egg_name}-%{version}-py*.egg-info |
142 | %endif |