# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

DISTUTILS_EXT=1
DISTUTILS_USE_PEP517=maturin
PYTHON_COMPAT=( python3_{11..14} )
CRATES="aho-corasick@1.1.4
	anes@0.1.6
	anstream@0.6.21
	anstyle-parse@0.2.7
	anstyle-query@1.1.4
	anstyle-wincon@3.0.10
	anstyle@1.0.13
	assert_cmd@2.1.1
	autocfg@1.5.0
	bit-set@0.8.0
	bit-vec@0.8.0
	bitflags@2.10.0
	bstr@1.12.1
	bumpalo@3.19.0
	cast@0.3.0
	cc@1.2.43
	cfg-if@1.0.4
	ciborium-io@0.2.2
	ciborium-ll@0.2.2
	ciborium@0.2.2
	clap@4.5.51
	clap_builder@4.5.51
	clap_derive@4.5.49
	clap_lex@0.7.6
	colorchoice@1.0.4
	criterion-plot@0.6.0
	criterion@0.7.0
	crossbeam-deque@0.8.6
	crossbeam-epoch@0.9.18
	crossbeam-utils@0.8.21
	crunchy@0.2.4
	difflib@0.4.0
	either@1.15.0
	equivalent@1.0.2
	errno@0.3.14
	fastrand@2.3.0
	find-msvc-tools@0.1.4
	fixedbitset@0.5.7
	float-cmp@0.10.0
	fnv@1.0.7
	foldhash@0.1.5
	futures-core@0.3.31
	futures-macro@0.3.31
	futures-task@0.3.31
	futures-timer@3.0.3
	futures-util@0.3.31
	getrandom@0.3.4
	glob@0.3.3
	grex@1.4.6
	half@2.7.1
	hashbrown@0.15.5
	hashbrown@0.16.0
	heck@0.5.0
	indexmap@2.12.0
	indoc@2.0.7
	is_terminal_polyfill@1.70.2
	itertools@0.13.0
	itertools@0.14.0
	itoa@1.0.15
	js-sys@0.3.82
	libc@0.2.177
	linux-raw-sys@0.11.0
	matrixmultiply@0.3.10
	memchr@2.7.6
	memoffset@0.9.1
	minicov@0.3.7
	ndarray@0.17.1
	normalize-line-endings@0.3.0
	num-complex@0.4.6
	num-integer@0.1.46
	num-traits@0.2.19
	once_cell@1.21.3
	once_cell_polyfill@1.70.2
	oorandom@11.1.5
	petgraph@0.8.3
	pin-project-lite@0.2.16
	pin-utils@0.1.0
	plotters-backend@0.3.7
	plotters-svg@0.3.7
	plotters@0.3.7
	portable-atomic-util@0.2.4
	portable-atomic@1.11.1
	ppv-lite86@0.2.21
	predicates-core@1.0.9
	predicates-tree@1.0.12
	predicates@3.1.3
	proc-macro-crate@3.4.0
	proc-macro2@1.0.103
	proptest@1.9.0
	pyo3-build-config@0.27.1
	pyo3-ffi@0.27.1
	pyo3-macros-backend@0.27.1
	pyo3-macros@0.27.1
	pyo3@0.27.1
	python3-dll-a@0.2.14
	quick-error@1.2.3
	quote@1.0.41
	r-efi@5.3.0
	rand@0.9.2
	rand_chacha@0.9.0
	rand_core@0.9.3
	rand_xorshift@0.4.0
	rawpointer@0.2.1
	rayon-core@1.13.0
	rayon@1.11.0
	regex-automata@0.4.13
	regex-syntax@0.8.8
	regex@1.12.2
	relative-path@1.9.3
	rstest@0.26.1
	rstest_macros@0.26.1
	rustc_version@0.4.1
	rustix@1.1.2
	rustversion@1.0.22
	rusty-fork@0.3.1
	ryu@1.0.20
	same-file@1.0.6
	semver@1.0.27
	serde@1.0.228
	serde_core@1.0.228
	serde_derive@1.0.228
	serde_json@1.0.145
	shlex@1.3.0
	slab@0.4.11
	strsim@0.11.1
	syn@2.0.108
	target-lexicon@0.13.3
	tempfile@3.23.0
	terminal_size@0.4.3
	termtree@0.5.1
	tinytemplate@1.2.1
	toml_datetime@0.7.3
	toml_edit@0.23.7
	toml_parser@1.0.4
	unarray@0.1.4
	unicode-general-category@1.1.0
	unicode-ident@1.0.20
	unicode-segmentation@1.12.0
	unindent@0.2.4
	utf8parse@0.2.2
	wait-timeout@0.2.1
	walkdir@2.5.0
	wasip2@1.0.1+wasi-0.2.4
	wasm-bindgen-futures@0.4.55
	wasm-bindgen-macro-support@0.2.105
	wasm-bindgen-macro@0.2.105
	wasm-bindgen-shared@0.2.105
	wasm-bindgen-test-macro@0.3.55
	wasm-bindgen-test@0.3.55
	wasm-bindgen@0.2.105
	web-sys@0.3.82
	winapi-util@0.1.11
	windows-link@0.2.1
	windows-sys@0.60.2
	windows-sys@0.61.2
	windows-targets@0.53.5
	windows_aarch64_gnullvm@0.53.1
	windows_aarch64_msvc@0.53.1
	windows_i686_gnu@0.53.1
	windows_i686_gnullvm@0.53.1
	windows_i686_msvc@0.53.1
	windows_x86_64_gnu@0.53.1
	windows_x86_64_gnullvm@0.53.1
	windows_x86_64_msvc@0.53.1
	winnow@0.7.13
	wit-bindgen@0.46.0
	zerocopy-derive@0.8.27
	zerocopy@0.8.27"
RUST_MIN_VER="1.82.0"

inherit cargo distutils-r1

DESCRIPTION="A CLI tool for generating regular expressions"
HOMEPAGE="https://github.com/pemistahl/grex"
SRC_URI="${CARGO_CRATE_URIS}"

LICENSE="Apache-2.0 Apache-2.0-with-LLVM-exceptions Boost-1.0 MIT Unlicense"
SLOT="0"
KEYWORDS="~amd64"

DOCS=( {README,RELEASE_NOTES}.md )

QA_FLAGS_IGNORED="usr/bin/grex
	usr/lib/python.*/site-packages/grex/grex.cpython-.*-x86_64-linux-gnu.so"

distutils_enable_tests pytest

src_configure() {
	cargo_src_configure
	distutils-r1_src_configure
}

src_compile() {
	cargo_src_compile
	distutils-r1_src_compile
}

src_test() {
	cargo_src_test
	distutils-r1_src_test
}

src_install() {
	einstalldocs
	cargo_src_install
	distutils-r1_src_install
}