]> git.pld-linux.org Git - packages/python3-adblock.git/blob - python3-adblock.spec
rebuild with python 3.10
[packages/python3-adblock.git] / python3-adblock.spec
1 %define         crates_ver      0.5.2
2 %define         module  adblock
3
4 Summary:        Brave's adblock library in Python
5 Name:           python3-%{module}
6 Version:        0.5.2
7 Release:        2
8 License:        MIT or Apache v2.0
9 Group:          Libraries/Python
10 Source0:        https://files.pythonhosted.org/packages/source/a/adblock/%{module}-%{version}.tar.gz
11 # Source0-md5:  bc38178bd980bbb0472bead80f835367
12 # ./create-crates.sh
13 Source1:        %{name}-crates-%{crates_ver}.tar.xz
14 # Source1-md5:  bc781735a3f336a7e403fe8dc3ef3749
15 URL:            https://github.com/ArniDagur/python-adblock
16 BuildRequires:  cargo
17 BuildRequires:  maturin >= 0.10
18 BuildRequires:  python3-devel >= 1:3.6
19 BuildRequires:  rpm-pythonprov
20 BuildRequires:  rpmbuild(macros) >= 2.012
21 BuildRequires:  rust >= 1.45
22 BuildRequires:  tar >= 1:1.22
23 BuildRequires:  xz
24 ExclusiveArch:  %{rust_arches}
25 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
26
27 %description
28 Python wrapper for Brave's adblocking library, which is written in
29 Rust.
30
31 %prep
32 %setup -q -n %{module}-%{version} -a1
33
34 %{__mv} %{module}-%{crates_ver}/* .
35 sed -i -e 's/@@VERSION@@/%{version}/' Cargo.lock
36
37 # use our offline registry
38 export CARGO_HOME="$(pwd)/.cargo"
39
40 mkdir -p "$CARGO_HOME"
41 cat >.cargo/config <<EOF
42 [source.crates-io]
43 registry = 'https://github.com/rust-lang/crates.io-index'
44 replace-with = 'vendored-sources'
45
46 [source.vendored-sources]
47 directory = '$PWD/vendor'
48 EOF
49
50 %build
51 export CARGO_HOME="$(pwd)/.cargo"
52 export CARGO_NET_OFFLINE=true
53 export CARGO_TERM_VERBOSE=true
54 %{?__jobs:export CARGO_BUILD_JOBS="%{__jobs}"}
55 export RUSTFLAGS="%{rpmrustflags}"
56 %ifarch %{ix86}
57 export RUSTFLAGS="$RUSTFLAGS -C opt-level=1"
58 %endif
59 /usr/bin/maturin build --release --no-sdist \
60         --target %{rust_target}
61
62 %install
63 rm -rf $RPM_BUILD_ROOT
64
65 install -d $RPM_BUILD_ROOT%{py3_sitedir}
66 cp -p %{cargo_objdir}/libadblock.so $RPM_BUILD_ROOT%{py3_sitedir}/%{module}.so
67
68 %clean
69 rm -rf $RPM_BUILD_ROOT
70
71 %files -n python3-%{module}
72 %defattr(644,root,root,755)
73 %doc CHANGELOG.md README.md
74 %attr(755,root,root) %{py3_sitedir}/%{module}.so
This page took 0.148131 seconds and 3 git commands to generate.