]> git.pld-linux.org Git - packages/python3-adblock.git/blob - python3-adblock.spec
91148dbb84445ec224657b2feff4c39b99afffe7
[packages/python3-adblock.git] / python3-adblock.spec
1 %define         crates_ver      0.4.4
2 %define         module  adblock
3
4 Summary:        Brave's adblock library in Python
5 Name:           python3-%{module}
6 Version:        0.4.4
7 Release:        1
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:  6958de33e5034c1241a69c91989f0e86
12 # ./create-crates.sh
13 Source1:        %{name}-crates-%{crates_ver}.tar.xz
14 # Source1-md5:  932c699a7fa6016098e56026ae389322
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.004
21 BuildRequires:  rust >= 1.45
22 ExclusiveArch:  %{rust_arches}
23 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
24
25 %description
26 Python wrapper for Brave's adblocking library, which is written in
27 Rust.
28
29 %prep
30 %setup -q -n %{module}-%{version} -a1
31
32 %{__mv} %{module}-%{crates_ver}/* .
33 sed -i -e 's/@@VERSION@@/%{version}/' Cargo.lock
34
35 # use our offline registry
36 export CARGO_HOME="$(pwd)/.cargo"
37
38 mkdir -p "$CARGO_HOME"
39 cat >.cargo/config <<EOF
40 [source.crates-io]
41 registry = 'https://github.com/rust-lang/crates.io-index'
42 replace-with = 'vendored-sources'
43
44 [source.vendored-sources]
45 directory = '$PWD/vendor'
46 EOF
47
48 %build
49 CARGO_HOME="$(pwd)/.cargo" \
50 CARGO_NET_OFFLINE=true \
51 CARGO_TERM_VERBOSE=true \
52 RUSTFLAGS="%{rpmrustflags}" \
53 /usr/bin/maturin build --release --no-sdist \
54 %ifarch x32
55         --target x86_64-unknown-linux-gnux32
56 %endif
57
58 %install
59 rm -rf $RPM_BUILD_ROOT
60
61 install -d $RPM_BUILD_ROOT%{py3_sitedir}
62 cp -p target/release/libadblock.so $RPM_BUILD_ROOT%{py3_sitedir}/%{module}.so
63
64 %clean
65 rm -rf $RPM_BUILD_ROOT
66
67 %files -n python3-%{module}
68 %defattr(644,root,root,755)
69 %doc CHANGELOG.md README.md
70 %attr(755,root,root) %{py3_sitedir}/%{module}.so
This page took 0.069593 seconds and 2 git commands to generate.