]> git.pld-linux.org Git - packages/python3-cryptography.git/blob - python3-cryptography.spec
vendorize rust extension
[packages/python3-cryptography.git] / python3-cryptography.spec
1 #
2 # Conditional build:
3 %bcond_without  doc     # Sphinx documentation
4 %bcond_without  tests   # unit test
5
6 %define         crates_ver      35.0.0
7
8 Summary:        Crypthography library for Python 3
9 Summary(pl.UTF-8):      Biblioteka Cryptography dla Pythona 3
10 Name:           python3-cryptography
11 Version:        35.0.0
12 Release:        0.1
13 License:        Apache v2.0 or BSD
14 Group:          Libraries/Python
15 #Source0Download: https://pypi.org/simple/cryptography/
16 Source0:        https://files.pythonhosted.org/packages/source/c/cryptography/cryptography-%{version}.tar.gz
17 # Source0-md5:  ba34eba3ae36cbf3d2e1ee3239f07732
18 #Source1Download: https://pypi.org/simple/cryptography_vectors/
19 Source1:        https://files.pythonhosted.org/packages/source/c/cryptography-vectors/cryptography_vectors-%{version}.tar.gz
20 # Source1-md5:  8e9d050bd601d1788883fa361c69cf85
21 # cd cryptography-%{version}/src/rust
22 # cargo vendor
23 # tar cJf python3-cryptography-crates-%{version}.tar.xz vendor Cargo.lock
24 Source2:        %{name}-crates-%{crates_ver}.tar.xz
25 # Source2-md5:  c3398eb08b99552f09b8b8f16d0d3910
26 URL:            https://cryptography.io/
27 BuildRequires:  openssl-devel >= 1.1.0
28 BuildRequires:  python3-cffi >= 1.12
29 BuildRequires:  python3-devel >= 1:3.6
30 BuildRequires:  python3-setuptools >= 18.5
31 BuildRequires:  python3-six >= 1.4.1
32 BuildRequires:  rpm-pythonprov >= 5.4.15-48
33 BuildRequires:  rpmbuild(macros) >= 2.004
34 BuildRequires:  rust >= 1.41.0
35 %if %{with tests}
36 BuildRequires:  python3-hypothesis >= 1.11.4
37 BuildRequires:  python3-iso8601
38 BuildRequires:  python3-pretend
39 BuildRequires:  python3-pytest >= 3.6.0
40 BuildRequires:  python3-pytz
41 %endif
42 %if %{with doc}
43 BuildRequires:  python3-sphinx_rtd_theme
44 BuildRequires:  sphinx-pdg-3 >= 1.6.5
45 BuildRequires:  tar >= 1:1.22
46 BuildRequires:  xz
47 %endif
48 Requires:       openssl >= 1.1.0
49 ExclusiveArch:  %{rust_arches}
50 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
51
52 %description
53 cryptography is a package which provides cryptographic recipes and
54 primitives to Python developers. Our goal is for it to be your
55 "cryptographic standard library". It supports Python 3.6+ and
56 PyPy3 7.2+.
57
58 cryptography includes both high level recipes and low level interfaces
59 to common cryptographic algorithms such as symmetric ciphers, message
60 digests, and key derivation functions.
61
62 %description -l pl.UTF-8
63 cryptography to pakiet zaprojektowany w celu udostępnienia funkcji i
64 obiektów kryptograficznych programistom Pythona. Celem jest
65 dostarczenie "standardowej biblioteki kryptograficznej". Obsługuje
66 Pythona 3.6+ oraz PyPy 7.2+.
67
68 cryptography zawiera zarówno funkcje wysokopoziomowe, jak i
69 niskopoziomowe interfejsy do popularnych algorytmów kryptograficznych,
70 takich jak szyfry symetryczne, skróty wiadomości czy funkcje
71 wyprowadzające klucze.
72
73 %package apidocs
74 Summary:        API documentation for cryptography module
75 Summary(pl.UTF-8):      Dokumentacja API modułu cryptography
76 Group:          Documentation
77 BuildArch:      noarch
78
79 %description apidocs
80 API documentation for cryptography module.
81
82 %description apidocs -l pl.UTF-8
83 Dokumentacja API modułu cryptography.
84
85 %prep
86 %setup -q -n cryptography-%{version} %{?with_tests:-a1}
87
88 %if %{with tests}
89 %{__mv} cryptography_vectors-%{version}/cryptography_vectors .
90 %endif
91
92 cd src/rust
93 tar xf %{SOURCE2}
94 # use our offline registry
95 export CARGO_HOME="$(pwd)/.cargo"
96
97 mkdir -p "$CARGO_HOME"
98 cat >.cargo/config <<EOF
99 [source.crates-io]
100 registry = 'https://github.com/rust-lang/crates.io-index'
101 replace-with = 'vendored-sources'
102
103 [source.vendored-sources]
104 directory = '$PWD/vendor'
105 EOF
106
107 %build
108 export CARGO_HOME="$(pwd)/src/rust/.cargo"
109 export CARGO_OFFLINE=true
110 export RUSTFLAGS="%{rpmrustflags}"
111 export CARGO_TERM_VERBOSE=true
112 %ifarch x32
113 export CARGO_BUILD_TARGET=x86_64-unknown-linux-gnux32
114 %endif
115
116 export CFLAGS="%{rpmcflags}"
117
118 %py3_build
119
120 %if %{with tests}
121 PYTHONPATH=$(echo $(pwd)/build-3/lib.*) \
122 %{__python3} -m pytest tests
123 %endif
124
125 %if %{with doc}
126 %{__make} -C docs html \
127         SPHINXBUILD=sphinx-build-3
128 %endif
129
130 %install
131 rm -rf $RPM_BUILD_ROOT
132
133 export CARGO_HOME="$(pwd)/src/rust/.cargo"
134 export CARGO_OFFLINE=true
135 export RUSTFLAGS="%{rpmrustflags}"
136 export CARGO_TERM_VERBOSE=true
137 %ifarch x32
138 export CARGO_BUILD_TARGET=x86_64-unknown-linux-gnux32
139 %endif
140
141 %py3_install
142
143 %clean
144 rm -rf $RPM_BUILD_ROOT
145
146 %files
147 %defattr(644,root,root,755)
148 %doc CHANGELOG.rst CONTRIBUTING.rst LICENSE LICENSE.APACHE LICENSE.BSD README.rst
149 %dir %{py3_sitedir}/cryptography
150 %{py3_sitedir}/cryptography/*.py
151 %{py3_sitedir}/cryptography/py.typed
152 %{py3_sitedir}/cryptography/__pycache__
153 %dir %{py3_sitedir}/cryptography/hazmat
154 %{py3_sitedir}/cryptography/hazmat/*.py
155 %{py3_sitedir}/cryptography/hazmat/__pycache__
156 %dir %{py3_sitedir}/cryptography/hazmat/backends
157 %{py3_sitedir}/cryptography/hazmat/backends/*.py
158 %{py3_sitedir}/cryptography/hazmat/backends/__pycache__
159 %dir %{py3_sitedir}/cryptography/hazmat/backends/openssl
160 %{py3_sitedir}/cryptography/hazmat/backends/openssl/*.py
161 %{py3_sitedir}/cryptography/hazmat/backends/openssl/__pycache__
162 %dir %{py3_sitedir}/cryptography/hazmat/bindings
163 %{py3_sitedir}/cryptography/hazmat/bindings/*.py
164 %{py3_sitedir}/cryptography/hazmat/bindings/__pycache__
165 %attr(755,root,root) %{py3_sitedir}/cryptography/hazmat/bindings/_*.so
166 %dir %{py3_sitedir}/cryptography/hazmat/bindings/_rust
167 %{py3_sitedir}/cryptography/hazmat/bindings/_rust/*.pyi
168 %dir %{py3_sitedir}/cryptography/hazmat/bindings/openssl
169 %{py3_sitedir}/cryptography/hazmat/bindings/openssl/*.py
170 %{py3_sitedir}/cryptography/hazmat/bindings/openssl/__pycache__
171 %dir %{py3_sitedir}/cryptography/hazmat/primitives
172 %{py3_sitedir}/cryptography/hazmat/primitives/*.py
173 %{py3_sitedir}/cryptography/hazmat/primitives/__pycache__
174 %dir %{py3_sitedir}/cryptography/hazmat/primitives/asymmetric
175 %{py3_sitedir}/cryptography/hazmat/primitives/asymmetric/*.py
176 %{py3_sitedir}/cryptography/hazmat/primitives/asymmetric/__pycache__
177 %dir %{py3_sitedir}/cryptography/hazmat/primitives/ciphers
178 %{py3_sitedir}/cryptography/hazmat/primitives/ciphers/*.py
179 %{py3_sitedir}/cryptography/hazmat/primitives/ciphers/__pycache__
180 %dir %{py3_sitedir}/cryptography/hazmat/primitives/kdf
181 %{py3_sitedir}/cryptography/hazmat/primitives/kdf/*.py
182 %{py3_sitedir}/cryptography/hazmat/primitives/kdf/__pycache__
183 %dir %{py3_sitedir}/cryptography/hazmat/primitives/serialization
184 %{py3_sitedir}/cryptography/hazmat/primitives/serialization/*.py
185 %{py3_sitedir}/cryptography/hazmat/primitives/serialization/__pycache__
186 %dir %{py3_sitedir}/cryptography/hazmat/primitives/twofactor
187 %{py3_sitedir}/cryptography/hazmat/primitives/twofactor/*.py
188 %{py3_sitedir}/cryptography/hazmat/primitives/twofactor/__pycache__
189 %dir %{py3_sitedir}/cryptography/x509
190 %{py3_sitedir}/cryptography/x509/*.py
191 %{py3_sitedir}/cryptography/x509/__pycache__
192 %{py3_sitedir}/cryptography-%{version}-py*.egg-info
193
194 %if %{with doc}
195 %files apidocs
196 %defattr(644,root,root,755)
197 %doc docs/_build/html/{_downloads,_static,development,hazmat,x509,*.html,*.js}
198 %endif
This page took 0.073018 seconds and 3 git commands to generate.