# Copyright 2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8
CRATES="
	addr2line@0.25.1
	adler2@2.0.1
	adler32@1.2.0
	aho-corasick@1.1.4
	android_system_properties@0.1.5
	anes@0.1.6
	ansi_term@0.12.1
	anstream@1.0.0
	anstyle@1.0.14
	anstyle-parse@1.0.0
	anstyle-query@1.1.5
	anstyle-wincon@3.0.11
	anyhow@1.0.104
	ar@0.9.0
	arc-swap@1.9.2
	async-trait@0.1.91
	atty@0.2.14
	autocfg@1.5.1
	backtrace@0.3.76
	better-panic@0.3.0
	bindgen@0.71.1
	bitflags@1.3.2
	bitflags@2.13.1
	bitvec@1.1.1
	block-buffer@0.10.4
	borsh@1.8.0
	bumpalo@3.20.3
	byteorder@1.5.0
	bytes@1.12.1
	cast@0.3.0
	cc@1.4.0
	cexpr@0.6.0
	cfg-if@1.0.4
	cfg_aliases@0.2.2
	chrono@0.4.45
	ciborium@0.2.2
	ciborium-io@0.2.2
	ciborium-ll@0.2.2
	clang-sys@1.9.1
	clap@3.2.25
	clap@4.6.5
	clap_builder@4.6.5
	clap_derive@4.6.4
	clap_lex@0.2.4
	clap_lex@1.1.0
	cmake@0.1.58
	colorchoice@1.0.5
	console@0.15.11
	console_error_panic_hook@0.1.7
	const_format@0.2.36
	const_format_proc_macros@0.2.34
	core-foundation-sys@0.8.7
	cpufeatures@0.2.17
	crc32fast@1.5.0
	criterion@0.5.1
	criterion-plot@0.5.0
	crossbeam-deque@0.8.7
	crossbeam-epoch@0.9.20
	crossbeam-utils@0.8.22
	crunchy@0.2.4
	crypto-common@0.1.7
	digest@0.10.7
	dynasm@1.2.3
	dynasmrt@1.2.3
	either@1.17.0
	encode_unicode@1.0.0
	errno@0.3.14
	fern@0.7.1
	find-msvc-tools@0.1.9
	flate2@1.1.9
	funty@2.0.0
	generic-array@0.14.7
	gimli@0.32.3
	glob@0.3.4
	goblin@0.10.7
	goblin@0.9.3
	half@2.7.1
	hashbrown@0.12.3
	heck@0.5.0
	hermit-abi@0.1.19
	hermit-abi@0.5.2
	hex@0.4.3
	hexyl@0.15.0
	iana-time-zone@0.1.65
	iana-time-zone-haiku@0.1.2
	indexmap@1.9.3
	indoc@2.0.7
	inflate@0.4.5
	is-terminal@0.4.17
	is_ci@1.2.0
	is_terminal_polyfill@1.70.2
	itertools@0.10.5
	itertools@0.13.0
	itertools@0.14.0
	itoa@1.0.18
	js-sys@0.3.77
	konst@0.2.20
	konst_macro_rules@0.2.19
	lazy_static@1.5.0
	libc@0.2.189
	libloading@0.8.9
	linux-raw-sys@0.12.1
	log@0.4.33
	memchr@2.8.3
	memmap2@0.5.10
	memoffset@0.9.1
	minimal-lexical@0.2.1
	miniz_oxide@0.8.9
	nom@7.1.3
	num-traits@0.2.19
	object@0.36.7
	object@0.37.3
	once_cell@1.21.4
	once_cell_polyfill@1.70.2
	oorandom@11.1.5
	os_str_bytes@6.6.1
	owo-colors@4.3.0
	pin-project-lite@0.2.17
	pkg-config@0.3.33
	plain@0.2.3
	plotters@0.3.7
	plotters-backend@0.3.7
	plotters-svg@0.3.7
	portable-atomic@1.14.0
	prettyplease@0.2.37
	proc-macro-error@1.0.4
	proc-macro-error-attr@1.0.4
	proc-macro2@1.0.107
	prost@0.13.5
	prost-derive@0.13.5
	pyo3@0.27.2
	pyo3-build-config@0.27.2
	pyo3-ffi@0.27.2
	pyo3-log@0.13.4
	pyo3-macros@0.27.2
	pyo3-macros-backend@0.27.2
	python3-dll-a@0.2.15
	quote@1.0.47
	radium@0.7.0
	rayon@1.12.0
	rayon-core@1.13.0
	regex@1.13.1
	regex-automata@0.4.16
	regex-syntax@0.8.11
	rustc-demangle@0.1.28
	rustc-hash@2.1.3
	rustix@1.1.4
	rustversion@1.0.23
	ruzstd@0.7.3
	same-file@1.0.6
	scroll@0.12.0
	scroll@0.13.0
	scroll_derive@0.12.1
	scroll_derive@0.13.1
	serde@1.0.229
	serde_core@1.0.229
	serde_derive@1.0.229
	serde_json@1.0.151
	sha2@0.10.9
	sha256@1.6.0
	shlex@1.3.0
	shlex@2.0.1
	simd-adler32@0.3.10
	smallvec@1.15.2
	smol_str@0.3.6
	static_assertions@1.1.0
	strsim@0.10.0
	strsim@0.11.1
	supports-color@3.0.2
	syn@1.0.109
	syn@2.0.119
	syn@3.0.3
	tap@1.0.1
	target-lexicon@0.13.5
	termcolor@1.4.1
	terminal_size@0.4.4
	textwrap@0.16.2
	thiserror@1.0.69
	thiserror@2.0.19
	thiserror-impl@1.0.69
	thiserror-impl@2.0.19
	tinytemplate@1.2.1
	tokio@1.53.1
	twox-hash@1.6.3
	typenum@1.20.1
	unicode-ident@1.0.24
	unicode-xid@0.2.6
	unicorn-engine@2.1.5
	unicorn-engine-sys@2.1.5
	unindent@0.2.4
	utf8parse@0.2.2
	version_check@0.9.5
	walkdir@2.5.0
	wasm-bindgen@0.2.100
	wasm-bindgen-backend@0.2.100
	wasm-bindgen-macro@0.2.100
	wasm-bindgen-macro-support@0.2.100
	wasm-bindgen-shared@0.2.100
	web-sys@0.3.77
	widestring@1.2.1
	winapi@0.3.9
	winapi-i686-pc-windows-gnu@0.4.0
	winapi-util@0.1.11
	winapi-x86_64-pc-windows-gnu@0.4.0
	windows-core@0.62.2
	windows-implement@0.60.2
	windows-interface@0.59.3
	windows-link@0.2.1
	windows-result@0.4.1
	windows-strings@0.5.1
	windows-sys@0.59.0
	windows-sys@0.61.2
	windows-targets@0.52.6
	windows_aarch64_gnullvm@0.52.6
	windows_aarch64_msvc@0.52.6
	windows_i686_gnu@0.52.6
	windows_i686_gnullvm@0.52.6
	windows_i686_msvc@0.52.6
	windows_x86_64_gnu@0.52.6
	windows_x86_64_gnullvm@0.52.6
	windows_x86_64_msvc@0.52.6
	wyz@0.5.1
	zerocopy@0.8.55
	zerocopy-derive@0.8.55
	zmij@1.0.23
	zydis@4.1.1
"
DISTUTILS_EXT=1
DISTUTILS_USE_PEP517=maturin
PYTHON_COMPAT=( python3_1{0,1,2,3,4} )

inherit cargo distutils-r1

DESCRIPTION="Python library for parsing, compiling, and matching FLIRT signatures."
HOMEPAGE="https://pypi.org/project/python-flirt/"
SRC_URI="https://github.com/williballenthin/lancelot/archive/refs/tags/v${PV}.tar.gz -> lancelot-${PV}.gh.tar.gz
	${CARGO_CRATE_URIS}"
S="${WORKDIR}/lancelot-${PV}/pyflirt"

LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="~amd64"

BDEPEND="test? (
	dev-python/pytest-sugar[${PYTHON_USEDEP}]
	dev-python/pytest-instafail[${PYTHON_USEDEP}]
)"

python_prepare_all() {
	sed -re 's/^ar =.*/ar = "0.9"/' -i ../bin/Cargo.toml || die
	distutils-r1_python_prepare_all
}

EPYTEST_PLUGINS=( pytest-instafail pytest-sugar )
distutils_enable_tests pytest