| 5 |
5 |
|
| 6 |
6 |
CARGO_OPTIONAL=yes
|
| 7 |
7 |
DISTUTILS_USE_PEP517=setuptools
|
| 8 |
|
PYTHON_COMPAT=( python3_{11..14} pypy3_11 )
|
|
8 |
PYTHON_COMPAT=( python3_{12..15} )
|
| 9 |
9 |
|
| 10 |
|
RUST_MIN_VER=1.83.0
|
|
10 |
RUST_MIN_VER=1.85.0
|
| 11 |
11 |
CRATES="
|
| 12 |
12 |
autocfg@1.3.0
|
|
13 |
autocfg@1.5.1
|
| 13 |
14 |
bitflags@2.5.0
|
| 14 |
15 |
cfg-if@1.0.0
|
| 15 |
|
cssparser-macros@0.6.1
|
| 16 |
|
cssparser@0.36.0
|
|
16 |
cssparser-macros@0.7.0
|
|
17 |
cssparser@0.37.0
|
| 17 |
18 |
derive_more-impl@2.1.1
|
| 18 |
19 |
derive_more@2.1.1
|
| 19 |
20 |
dtoa-short@0.3.4
|
| 20 |
21 |
dtoa@1.0.9
|
| 21 |
|
ego-tree@0.10.0
|
|
22 |
ego-tree@0.11.0
|
| 22 |
23 |
fastrand@2.3.0
|
| 23 |
|
futf@0.1.5
|
| 24 |
24 |
getopts@0.2.24
|
| 25 |
25 |
heck@0.5.0
|
| 26 |
|
html5ever@0.36.1
|
|
26 |
html5ever@0.39.0
|
|
27 |
indoc@2.0.7
|
| 27 |
28 |
itoa@1.0.17
|
| 28 |
29 |
libc@0.2.154
|
|
30 |
libc@0.2.186
|
| 29 |
31 |
lock_api@0.4.12
|
| 30 |
32 |
log@0.4.21
|
| 31 |
|
mac@0.1.1
|
| 32 |
|
markup5ever@0.36.1
|
|
33 |
markup5ever@0.39.0
|
|
34 |
memoffset@0.9.1
|
| 33 |
35 |
new_debug_unreachable@1.0.6
|
| 34 |
36 |
once_cell@1.21.3
|
|
37 |
once_cell@1.21.4
|
| 35 |
38 |
parking_lot@0.12.2
|
| 36 |
39 |
parking_lot_core@0.9.10
|
| 37 |
40 |
phf@0.13.1
|
| ... | ... | |
| 39 |
42 |
phf_generator@0.13.1
|
| 40 |
43 |
phf_macros@0.13.1
|
| 41 |
44 |
phf_shared@0.13.1
|
|
45 |
portable-atomic@1.13.1
|
| 42 |
46 |
portable-atomic@1.6.0
|
| 43 |
47 |
precomputed-hash@0.1.1
|
| 44 |
48 |
proc-macro2@1.0.106
|
| 45 |
49 |
proc-macro2@1.0.82
|
| 46 |
|
pyo3-build-config@0.28.2
|
| 47 |
|
pyo3-ffi@0.28.2
|
| 48 |
|
pyo3-macros-backend@0.28.2
|
| 49 |
|
pyo3-macros@0.28.2
|
| 50 |
|
pyo3@0.28.2
|
|
50 |
pyo3-build-config@0.27.2
|
|
51 |
pyo3-build-config@0.28.3
|
|
52 |
pyo3-ffi@0.27.2
|
|
53 |
pyo3-ffi@0.28.3
|
|
54 |
pyo3-macros-backend@0.27.2
|
|
55 |
pyo3-macros-backend@0.28.3
|
|
56 |
pyo3-macros@0.27.2
|
|
57 |
pyo3-macros@0.28.3
|
|
58 |
pyo3@0.27.2
|
|
59 |
pyo3@0.28.3
|
| 51 |
60 |
quote@1.0.44
|
|
61 |
quote@1.0.46
|
| 52 |
62 |
redox_syscall@0.5.1
|
| 53 |
63 |
rustc-hash@2.1.1
|
| 54 |
64 |
rustc_version@0.4.1
|
|
65 |
rustversion@1.0.22
|
| 55 |
66 |
scopeguard@1.2.0
|
| 56 |
|
scraper@0.25.0
|
| 57 |
|
selectors@0.33.0
|
|
67 |
scraper@0.27.0
|
|
68 |
selectors@0.38.0
|
| 58 |
69 |
semver@1.0.27
|
| 59 |
70 |
serde@1.0.200
|
| 60 |
71 |
serde_derive@1.0.200
|
| ... | ... | |
| 64 |
75 |
stable_deref_trait@1.2.0
|
| 65 |
76 |
string_cache@0.9.0
|
| 66 |
77 |
string_cache_codegen@0.6.1
|
|
78 |
syn@2.0.118
|
| 67 |
79 |
syn@2.0.61
|
| 68 |
80 |
target-lexicon@0.13.4
|
| 69 |
81 |
target-lexicon@0.13.5
|
| 70 |
|
tendril@0.4.3
|
|
82 |
tendril@0.5.0
|
| 71 |
83 |
unicode-ident@1.0.12
|
|
84 |
unicode-ident@1.0.24
|
| 72 |
85 |
unicode-width@0.2.2
|
|
86 |
unindent@0.2.4
|
| 73 |
87 |
utf-8@0.7.6
|
| 74 |
88 |
web_atoms@0.2.3
|
| 75 |
89 |
windows-targets@0.52.5
|
| ... | ... | |
| 101 |
115 |
# crates are used at test time only, update via pycargoebuild -L -i ...
|
| 102 |
116 |
LICENSE="MIT"
|
| 103 |
117 |
SLOT="0"
|
| 104 |
|
KEYWORDS="amd64 arm arm64 ~loong ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
|
|
118 |
KEYWORDS="~amd64 ~arm ~arm64 ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
|
| 105 |
119 |
IUSE="test"
|
| 106 |
120 |
RESTRICT="!test? ( test )"
|
| 107 |
121 |
|
| ... | ... | |
| 116 |
130 |
test? (
|
| 117 |
131 |
${RDEPEND}
|
| 118 |
132 |
dev-python/beautifulsoup4[${PYTHON_USEDEP}]
|
| 119 |
|
$(python_gen_cond_dep '
|
| 120 |
|
dev-python/cffi[${PYTHON_USEDEP}]
|
| 121 |
|
' 'python*')
|
|
133 |
dev-python/cffi[${PYTHON_USEDEP}]
|
| 122 |
134 |
dev-python/lxml[${PYTHON_USEDEP}]
|
| 123 |
|
dev-python/pytest[${PYTHON_USEDEP}]
|
| 124 |
135 |
)
|
| 125 |
136 |
"
|
| 126 |
137 |
|
| 127 |
138 |
export PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1
|
| 128 |
139 |
|
|
140 |
EPYTEST_PLUGINS=()
|
|
141 |
distutils_enable_tests pytest
|
|
142 |
|
| 129 |
143 |
src_unpack() {
|
| 130 |
144 |
cargo_src_unpack
|
| 131 |
145 |
}
|
| 132 |
146 |
|
| 133 |
147 |
python_test() {
|
| 134 |
|
local examples=(
|
| 135 |
|
html-py-ever
|
| 136 |
|
namespace_package
|
| 137 |
|
rust_with_cffi
|
| 138 |
|
)
|
| 139 |
|
for example_dir in ${examples[@]}; do
|
| 140 |
|
pushd examples/${example_dir} >/dev/null || die
|
| 141 |
|
einfo "Running ${example_dir} test"
|
| 142 |
|
esetup.py build --build-lib=build/lib
|
|
148 |
epytest tests
|
|
149 |
|
|
150 |
local -x PATH=${BUILD_DIR}/test/usr/bin:${PATH}
|
|
151 |
|
|
152 |
for example_dir in examples/*; do
|
|
153 |
pushd "${example_dir}" >/dev/null || die
|
|
154 |
einfo "Testing with ${example_dir}"
|
|
155 |
|
|
156 |
cp -a "${BUILD_DIR}"/{install,test} || die
|
|
157 |
distutils_pep517_install "${BUILD_DIR}"/test
|
|
158 |
|
|
159 |
# logic roughly copied from noxfile.pys
|
|
160 |
# for html-py-ever, pytest requires pytest-benchmark
|
|
161 |
# but run_all.py does the exact same tests without
|
|
162 |
if [[ ${example_dir} == */html-py-ever ]]; then
|
|
163 |
pushd tests >/dev/null || die
|
|
164 |
${EPYTHON} run_all.py || die "Tests failed with ${EPYTHON}"
|
|
165 |
popd >/dev/null || die
|
|
166 |
elif [[ -d tests ]]; then
|
|
167 |
epytest -o addopts= tests
|
|
168 |
fi
|
| 143 |
169 |
|
| 144 |
170 |
case ${example_dir} in
|
| 145 |
|
html-py-ever)
|
| 146 |
|
pushd tests >/dev/null || die
|
| 147 |
|
local -x PYTHONPATH=../build/lib
|
| 148 |
|
${EPYTHON} run_all.py || die "Tests failed with ${EPYTHON}"
|
| 149 |
|
popd >/dev/null || die
|
|
171 |
*/hello-world-script)
|
|
172 |
hello-world-script || die
|
| 150 |
173 |
;;
|
| 151 |
|
*)
|
| 152 |
|
pushd build/lib >/dev/null || die
|
| 153 |
|
epytest ../../tests
|
| 154 |
|
popd >/dev/null || die
|
|
174 |
*/hello-world)
|
|
175 |
print-hello || die
|
|
176 |
"${EPYTHON}" "${BUILD_DIR}/test/usr/bin/sum-cli" 5 7 || die
|
|
177 |
"${EPYTHON}" "${BUILD_DIR}/test/usr/bin/rust-demo" 5 7 || die
|
| 155 |
178 |
;;
|
| 156 |
179 |
esac
|
| 157 |
180 |
|
| 158 |
|
rm -rf build || die
|
|
181 |
rm -r "${BUILD_DIR}"/test || die
|
| 159 |
182 |
popd >/dev/null || die
|
| 160 |
183 |
done
|
| 161 |
184 |
}
|