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

EAPI=8

PYTHON_COMPAT=( python3_14 )
# Not a plain hatchling package any more (see below); we bypass the
# eclass's own PEP517 backend verification/dependency injection entirely
# and drive the build ourselves.
DISTUTILS_USE_PEP517=standalone

RUST_MIN_VER="1.97.1"

CRATES="
	addr2line@0.25.1
	adler2@2.0.1
	aes@0.9.3
	ahash@0.8.12
	aho-corasick@1.1.4
	aho-corasick@1.1.5
	allocator-api2@0.2.21
	alsa-sys@0.3.1
	alsa@0.9.1
	android_system_properties@0.1.6
	anstream@1.0.0
	anstyle-parse@1.0.0
	anstyle-query@1.1.5
	anstyle-wincon@3.0.11
	anstyle@1.0.14
	anyhow@1.0.104
	apple-native-keyring-store@1.0.2
	ar_archive_writer@0.5.2
	ascii@1.1.0
	ast_node@5.0.0
	async-broadcast@0.7.2
	async-channel@2.5.0
	async-executor@1.14.0
	async-io@2.6.0
	async-lock@3.4.2
	async-process@2.5.0
	async-recursion@1.1.1
	async-signal@0.2.14
	async-task@4.7.1
	async-trait@0.1.92
	atomic-waker@1.1.2
	autocfg@1.5.1
	aws-lc-rs@1.18.1
	aws-lc-sys@0.45.0
	az@1.3.0
	backtrace@0.3.76
	base64-simd@0.8.0
	base64@0.22.1
	base64@0.23.1
	better_scoped_tls@1.0.1
	bincode@1.3.3
	bindgen@0.72.1
	bit-set@0.8.0
	bit-vec@0.8.0
	bitflags@1.3.2
	bitflags@2.13.1
	bitvec@1.1.1
	block-buffer@0.10.4
	block-buffer@0.12.1
	block-padding@0.4.2
	block2@0.6.2
	blocking@1.7.0
	borrow-or-share@0.2.4
	boxed_error@0.2.3
	bstr@1.13.1
	bumpalo@3.20.3
	bytecount@0.6.9
	byteorder@1.5.0
	bytes-str@0.2.8
	bytes@1.12.1
	calendrical_calculations@0.2.4
	capacity_builder@0.5.0
	capacity_builder_macros@0.3.0
	caseless@0.2.2
	cassowary@0.3.0
	castaway@0.2.4
	cbc@0.2.1
	cc@1.4.0
	cc@1.4.4
	cesu8@1.1.0
	cexpr@0.6.0
	cfg-if@1.0.4
	cfg_aliases@0.2.2
	chacha20@0.10.2
	chrono@0.4.45
	cipher@0.5.2
	clang-sys@1.8.1
	clang-sys@1.9.1
	clap@4.6.6
	clap_builder@4.6.6
	clap_derive@4.6.4
	clap_lex@1.1.0
	cmake@0.1.58
	cmov@0.5.4
	colorchoice@1.0.5
	combine@4.6.8
	compact_str@0.7.1
	compact_str@0.8.2
	concurrent-queue@2.5.0
	console@0.16.4
	const-oid@0.10.2
	convert_case@0.11.0
	cooked-waker@5.0.0
	core-foundation-sys@0.8.7
	core-foundation@0.10.1
	core-foundation@0.9.4
	core_maths@0.1.1
	coreaudio-rs@0.11.3
	coreaudio-sys@0.2.18
	cpal@0.15.3
	cpubits@0.1.1
	cpufeatures@0.2.17
	cpufeatures@0.3.1
	crc32fast@1.5.0
	crc32fast@1.5.1
	crossbeam-deque@0.8.7
	crossbeam-epoch@0.9.20
	crossbeam-utils@0.8.22
	crossterm@0.28.1
	crossterm_winapi@0.9.1
	crypto-common@0.1.7
	crypto-common@0.2.2
	ctor@1.0.11
	ctutils@0.4.2
	darling@0.24.1
	darling_core@0.24.1
	darling_macro@0.24.1
	dasp_sample@0.11.0
	data-encoding@2.11.0
	data-encoding@2.11.1
	data-url@0.3.2
	debugid@0.8.0
	deno_ast@0.53.3
	deno_core@0.409.0
	deno_error@0.7.1
	deno_error_macro@0.7.1
	deno_media_type@0.4.0
	deno_ops@0.285.0
	deno_path_util@0.6.4
	deno_terminal@0.2.3
	deno_unsync@0.4.4
	deranged@0.5.8
	digest@0.10.7
	digest@0.11.3
	diplomat-runtime@0.15.1
	diplomat@0.15.0
	diplomat_core@0.15.0
	dispatch2@0.3.1
	displaydoc@0.2.6
	displaydoc@0.2.7
	dprint-swc-ext@0.26.0
	dunce@1.0.5
	dyn-clone@1.0.20
	either@1.17.0
	either@1.18.0
	email_address@0.2.9
	encode_unicode@1.0.0
	endi@1.1.1
	enumflags2@0.7.12
	enumflags2_derive@0.7.12
	equivalent@1.0.2
	errno@0.3.14
	event-listener-strategy@0.5.4
	event-listener@5.4.2
	fancy-regex@0.18.0
	fastrand@2.5.0
	filedescriptor@0.8.3
	find-msvc-tools@0.1.11
	find-msvc-tools@0.1.9
	flate2@1.1.10
	fluent-uri@0.4.1
	fnv@1.0.7
	foldhash@0.1.5
	foldhash@0.2.0
	form_urlencoded@1.2.2
	fraction@0.15.4
	from_variant@3.0.0
	fs_extra@1.3.0
	fsevent-sys@4.1.0
	fslock@0.2.1
	funty@2.0.0
	futures-channel@0.3.33
	futures-channel@0.3.34
	futures-core@0.3.33
	futures-core@0.3.34
	futures-executor@0.3.33
	futures-executor@0.3.34
	futures-io@0.3.33
	futures-io@0.3.34
	futures-lite@2.6.1
	futures-macro@0.3.33
	futures-macro@0.3.34
	futures-sink@0.3.33
	futures-sink@0.3.34
	futures-task@0.3.33
	futures-task@0.3.34
	futures-timer@3.0.4
	futures-util@0.3.33
	futures-util@0.3.34
	futures@0.3.33
	futures@0.3.34
	generic-array@0.14.7
	getrandom@0.2.17
	getrandom@0.3.4
	getrandom@0.4.3
	gimli@0.32.3
	glob@0.3.4
	globset@0.4.20
	gzip-header@1.1.0
	hashbrown@0.14.5
	hashbrown@0.15.5
	hashbrown@0.17.1
	heck@0.5.0
	hermit-abi@0.5.2
	hermit-abi@0.5.3
	hex@0.4.3
	hkdf@0.13.0
	hmac@0.13.0
	home@0.5.12
	hostname@0.4.2
	hstr@3.0.6
	http-body-util@0.1.5
	http-body@1.1.0
	http@1.5.0
	httparse@1.10.1
	httpdate@1.0.3
	hybrid-array@0.4.15
	hyper-rustls@0.27.9
	hyper-util@0.1.20
	hyper@1.11.1
	iana-time-zone-haiku@0.1.2
	iana-time-zone@0.1.65
	icu_calendar@2.2.1
	icu_calendar_data@2.2.0
	icu_collections@2.2.0
	icu_collections@2.3.0
	icu_locale@2.2.0
	icu_locale_core@2.2.0
	icu_locale_core@2.3.0
	icu_locale_data@2.2.0
	icu_normalizer@2.2.0
	icu_normalizer@2.3.0
	icu_normalizer_data@2.2.0
	icu_normalizer_data@2.3.0
	icu_properties@2.2.0
	icu_properties@2.3.0
	icu_properties_data@2.2.0
	icu_properties_data@2.3.0
	icu_provider@2.2.0
	icu_provider@2.3.1
	ident_case@1.0.1
	idna@1.1.0
	idna_adapter@1.2.2
	if_chain@1.0.3
	ignore@0.4.33
	indexmap@2.14.0
	indexmap@2.14.1
	indoc@2.0.7
	inotify-sys@0.1.8
	inotify@0.11.5
	inout@0.2.2
	insta@1.48.0
	instability@0.3.13
	inventory@0.3.24
	ipnet@2.12.1
	is-macro@0.3.7
	is_terminal_polyfill@1.70.2
	itertools@0.13.0
	itoa@1.0.18
	ixdtf@0.6.5
	jni-macros@0.22.4
	jni-sys-macros@0.4.1
	jni-sys@0.3.1
	jni-sys@0.4.1
	jni@0.21.1
	jni@0.22.4
	jobserver@0.1.35
	js-sys@0.3.103
	js-sys@0.3.104
	jsonschema-regex@0.49.1
	jsonschema-value@0.49.1
	jsonschema@0.49.1
	keyring-core@1.0.0
	keyring@4.2.0
	kqueue-sys@1.1.2
	kqueue@1.2.1
	lazy_static@1.5.0
	libc@0.2.189
	libloading@0.8.9
	libloading@0.9.0
	libm@0.2.16
	linked-hash-map@0.5.6
	linux-raw-sys@0.12.1
	linux-raw-sys@0.4.15
	litemap@0.8.2
	litemap@0.8.3
	lock_api@0.4.14
	log@0.4.33
	log@0.4.34
	lru-slab@0.1.2
	lru@0.12.5
	mach2@0.4.3
	matchers@0.2.0
	memchr@2.8.3
	memoffset@0.9.1
	micromap@0.3.0
	minimal-lexical@0.2.1
	miniz_oxide@0.8.9
	miniz_oxide@0.9.1
	mio@1.2.2
	napi-build@2.3.2
	napi-derive-backend@6.0.0
	napi-derive@3.6.0
	napi-sys@3.3.0
	napi@3.11.0
	ndk-context@0.1.1
	ndk-sys@0.5.0+25.2.9519653
	ndk@0.8.0
	new_debug_unreachable@1.0.6
	nix@0.31.3
	nohash-hasher@0.2.0
	nom@7.1.3
	notify-types@2.1.0
	notify@8.2.0
	nu-ansi-term@0.50.3
	num-bigint@0.4.8
	num-cmp@0.1.0
	num-complex@0.4.6
	num-conv@0.2.2
	num-derive@0.4.2
	num-integer@0.1.46
	num-integer@0.1.47
	num-iter@0.1.46
	num-rational@0.4.2
	num-traits@0.2.19
	num@0.4.3
	num_cpus@1.17.0
	num_enum@0.7.6
	num_enum_derive@0.7.6
	objc2-cloud-kit@0.3.2
	objc2-core-data@0.3.2
	objc2-core-foundation@0.3.2
	objc2-core-graphics@0.3.2
	objc2-core-image@0.3.2
	objc2-core-location@0.3.2
	objc2-core-text@0.3.2
	objc2-encode@4.1.0
	objc2-foundation@0.3.2
	objc2-io-surface@0.3.2
	objc2-quartz-core@0.3.2
	objc2-ui-kit@0.3.2
	objc2-user-notifications@0.3.2
	objc2@0.6.4
	object@0.37.3
	oboe-sys@0.6.1
	oboe@0.6.1
	once_cell@1.21.4
	once_cell_polyfill@1.70.2
	onig@6.5.3
	onig_sys@69.9.3
	openssl-probe@0.2.1
	ordered-stream@0.2.0
	os_info@3.15.0
	outref@0.5.2
	par-core@2.0.0
	parking@2.2.1
	parking_lot@0.12.5
	parking_lot_core@0.9.12
	paste@1.0.15
	pathdiff@0.2.3
	percent-encoding@2.3.2
	phf@0.11.3
	phf_generator@0.11.3
	phf_macros@0.11.3
	phf_shared@0.11.3
	pin-project-internal@1.1.13
	pin-project-lite@0.2.17
	pin-project@1.1.13
	piper@0.2.5
	pkg-config@0.3.34
	plist@1.10.0
	polling@3.11.0
	portable-atomic@1.14.0
	potential_utf@0.1.5
	potential_utf@0.1.6
	powerfmt@0.2.0
	ppv-lite86@0.2.21
	prettyplease@0.2.37
	proc-macro-crate@3.5.0
	proc-macro2@1.0.107
	psm@0.1.31
	pulldown-cmark@0.10.3
	pyo3-build-config@0.29.0
	pyo3-ffi@0.29.0
	pyo3-macros-backend@0.29.0
	pyo3-macros@0.29.0
	pyo3@0.29.0
	quick-xml@0.41.0
	quinn-proto@0.11.17
	quinn-udp@0.5.15
	quinn@0.11.11
	quote@1.0.47
	r-efi@5.3.0
	r-efi@6.0.0
	radium@0.7.0
	rand@0.10.2
	rand@0.8.7
	rand@0.8.8
	rand@0.9.5
	rand_chacha@0.3.1
	rand_chacha@0.9.0
	rand_core@0.10.1
	rand_core@0.6.4
	rand_core@0.9.5
	rand_pcg@0.10.2
	ratatui@0.29.0
	redox_syscall@0.5.18
	ref-cast-impl@1.0.26
	ref-cast@1.0.26
	referencing@0.49.1
	regex-automata@0.4.16
	regex-automata@0.4.18
	regex-syntax@0.8.11
	regex@1.13.1
	relative-path@1.9.3
	reqwest@0.13.4
	resb@0.1.2
	ring@0.17.14
	rmcp@3.1.2
	rstest@0.26.1
	rstest_macros@0.26.1
	rustc-demangle@0.1.28
	rustc-hash@2.1.3
	rustc_version@0.4.1
	rustix@0.38.44
	rustix@1.1.4
	rustls-native-certs@0.8.4
	rustls-pki-types@1.15.1
	rustls-platform-verifier-android@0.1.1
	rustls-platform-verifier@0.7.0
	rustls-webpki@0.103.15
	rustls@0.23.43
	rustversion@1.0.23
	ryu-js@1.0.3
	ryu@1.0.23
	same-file@1.0.6
	schannel@0.1.29
	schemars@1.2.2
	schemars_derive@1.2.2
	scoped-tls@1.0.1
	scopeguard@1.2.0
	secret-service@5.2.0
	security-framework-sys@2.17.0
	security-framework@3.7.0
	semver@1.0.28
	sentry-backtrace@0.49.2
	sentry-contexts@0.49.2
	sentry-core@0.49.2
	sentry-tracing@0.49.2
	sentry-types@0.49.2
	sentry@0.49.2
	seq-macro@0.3.6
	serde@1.0.229
	serde_core@1.0.229
	serde_derive@1.0.229
	serde_derive_internals@0.30.0
	serde_json@1.0.151
	serde_repr@0.1.21
	serde_v8@0.318.0
	sha1@0.10.7
	sha1_smol@1.0.1
	sha2@0.11.0
	sharded-slab@0.1.7
	shlex@1.3.0
	shlex@2.0.1
	signal-hook-mio@0.2.5
	signal-hook-registry@1.4.8
	signal-hook@0.3.18
	simd-adler32@0.3.10
	simd_cesu8@1.2.0
	simdutf8@0.1.5
	similar@2.7.0
	siphasher@0.3.11
	siphasher@1.0.3
	slab@0.4.12
	smallvec@1.15.2
	smartstring@1.0.1
	socket2@0.6.5
	sourcemap@9.3.2
	stable_deref_trait@1.2.1
	stacker@0.1.24
	static_assertions@1.1.0
	strck@1.0.0
	string_enum@1.0.2
	stringcase@0.4.0
	strsim@0.11.1
	strum@0.26.3
	strum@0.27.2
	strum@0.28.0
	strum_macros@0.26.4
	strum_macros@0.27.2
	strum_macros@0.28.0
	subtle@2.6.1
	swc_allocator@4.0.1
	swc_atoms@9.0.0
	swc_common@17.0.1
	swc_config@3.1.2
	swc_config_macro@1.0.1
	swc_ecma_ast@18.0.0
	swc_ecma_codegen@20.0.2
	swc_ecma_codegen_macros@2.0.2
	swc_ecma_lexer@26.0.0
	swc_ecma_loader@17.0.0
	swc_ecma_parser@27.0.7
	swc_ecma_transforms_base@30.0.1
	swc_ecma_transforms_classes@30.0.0
	swc_ecma_transforms_macros@1.0.1
	swc_ecma_transforms_proposal@30.0.0
	swc_ecma_transforms_react@33.0.0
	swc_ecma_transforms_typescript@33.0.0
	swc_ecma_utils@24.0.0
	swc_ecma_visit@18.0.1
	swc_eq_ignore_macros@1.0.1
	swc_macros_common@1.0.1
	swc_sourcemap@9.3.4
	swc_visit@2.0.1
	syn-match@0.3.1
	syn@2.0.119
	syn@3.0.3
	syn@3.0.4
	sync_wrapper@1.0.2
	synstructure@0.13.2
	syntect@5.3.0
	sys_traits@0.1.28
	sys_traits_macros@0.1.0
	system-configuration-sys@0.6.0
	system-configuration@0.7.0
	tap@1.0.1
	target-lexicon@0.13.5
	tempfile@3.27.0
	temporal_capi@0.2.4
	temporal_rs@0.2.4
	termcolor@1.4.1
	text_lines@0.6.0
	thiserror-impl@1.0.69
	thiserror-impl@2.0.19
	thiserror-impl@2.0.20
	thiserror@1.0.69
	thiserror@2.0.19
	thiserror@2.0.20
	thread_local@1.1.10
	time-core@0.1.9
	time-macros@0.2.32
	time@0.3.55
	timezone_provider@0.2.4
	tinystr@0.8.3
	tinystr@0.8.4
	tinyvec@1.13.2
	tinyvec_macros@0.1.1
	tokio-macros@2.7.1
	tokio-macros@2.7.2
	tokio-rustls@0.26.4
	tokio-tungstenite@0.24.0
	tokio-util@0.7.19
	tokio@1.53.1
	toml_datetime@1.1.1+spec-1.1.0
	toml_edit@0.25.13+spec-1.1.0
	toml_edit@0.25.15+spec-1.1.0
	toml_parser@1.1.3+spec-1.1.0
	toml_writer@1.1.2+spec-1.1.0
	tower-http@0.6.11
	tower-layer@0.3.3
	tower-service@0.3.3
	tower@0.5.3
	tracing-attributes@0.1.31
	tracing-core@0.1.36
	tracing-log@0.2.0
	tracing-subscriber@0.3.23
	tracing@0.1.44
	triomphe@0.1.16
	try-lock@0.2.5
	tungstenite@0.24.0
	two-face@0.5.2+bat-0.26.1
	typenum@1.20.1
	uds_windows@1.2.1
	uname@0.1.1
	unicase@2.9.0
	unicode-general-category@1.1.0
	unicode-id-start@1.4.0
	unicode-ident@1.0.24
	unicode-normalization@0.1.25
	unicode-segmentation@1.13.3
	unicode-truncate@1.1.0
	unicode-width@0.1.14
	unicode-width@0.2.0
	unicode-width@0.2.2
	untrusted@0.9.0
	ureq-proto@0.6.1
	ureq@3.4.0
	url@2.5.8
	utf-8@0.7.6
	utf8-zero@0.8.1
	utf8_iter@1.0.4
	utf8parse@0.2.2
	uuid-simd@0.8.0
	uuid@1.24.0
	uuid@1.26.0
	v8@150.3.0
	valuable@0.1.1
	version_check@0.9.5
	vsimd@0.8.0
	walkdir@2.5.0
	want@0.3.1
	wasi@0.11.1+wasi-snapshot-preview1
	wasip2@1.0.4+wasi-0.2.12
	wasm-bindgen-futures@0.4.77
	wasm-bindgen-macro-support@0.2.126
	wasm-bindgen-macro-support@0.2.127
	wasm-bindgen-macro@0.2.126
	wasm-bindgen-macro@0.2.127
	wasm-bindgen-shared@0.2.126
	wasm-bindgen-shared@0.2.127
	wasm-bindgen@0.2.126
	wasm-bindgen@0.2.127
	wasm_dep_analyzer@0.4.0
	web-sys@0.3.104
	web-time@1.1.0
	webpki-root-certs@1.0.9
	webpki-roots@1.0.9
	which@6.0.3
	winapi-i686-pc-windows-gnu@0.4.0
	winapi-util@0.1.11
	winapi-x86_64-pc-windows-gnu@0.4.0
	winapi@0.3.9
	windows-core@0.54.0
	windows-core@0.62.2
	windows-implement@0.60.2
	windows-interface@0.59.3
	windows-link@0.2.1
	windows-native-keyring-store@1.1.0
	windows-registry@0.6.1
	windows-result@0.1.2
	windows-result@0.4.1
	windows-strings@0.5.1
	windows-sys@0.45.0
	windows-sys@0.52.0
	windows-sys@0.59.0
	windows-sys@0.60.2
	windows-sys@0.61.2
	windows-targets@0.42.2
	windows-targets@0.52.6
	windows-targets@0.53.5
	windows@0.54.0
	windows_aarch64_gnullvm@0.42.2
	windows_aarch64_gnullvm@0.52.6
	windows_aarch64_gnullvm@0.53.1
	windows_aarch64_msvc@0.42.2
	windows_aarch64_msvc@0.52.6
	windows_aarch64_msvc@0.53.1
	windows_i686_gnu@0.42.2
	windows_i686_gnu@0.52.6
	windows_i686_gnu@0.53.1
	windows_i686_gnullvm@0.52.6
	windows_i686_gnullvm@0.53.1
	windows_i686_msvc@0.42.2
	windows_i686_msvc@0.52.6
	windows_i686_msvc@0.53.1
	windows_x86_64_gnu@0.42.2
	windows_x86_64_gnu@0.52.6
	windows_x86_64_gnu@0.53.1
	windows_x86_64_gnullvm@0.42.2
	windows_x86_64_gnullvm@0.52.6
	windows_x86_64_gnullvm@0.53.1
	windows_x86_64_msvc@0.42.2
	windows_x86_64_msvc@0.52.6
	windows_x86_64_msvc@0.53.1
	winnow@1.0.4
	winsafe@0.0.19
	wit-bindgen@0.57.1
	writeable@0.6.3
	writeable@0.6.4
	wyz@0.5.1
	yaml-rust@0.4.5
	yoke-derive@0.8.2
	yoke@0.8.3
	zbus-secret-service-keyring-store@1.0.1
	zbus@5.19.0
	zbus_macros@5.19.0
	zbus_names@4.3.4
	zcheapstr@1.1.0
	zerocopy-derive@0.8.55
	zerocopy-derive@0.8.56
	zerocopy@0.8.55
	zerocopy@0.8.56
	zerofrom-derive@0.1.7
	zerofrom@0.1.8
	zeroize@1.9.0
	zerotrie@0.2.4
	zerotrie@0.2.5
	zerovec-derive@0.11.3
	zerovec-derive@0.11.6
	zerovec@0.11.6
	zerovec@0.11.8
	zlib-rs@0.6.7
	zmij@1.0.23
	zoneinfo64@0.3.0
	zvariant@5.15.0
	zvariant_derive@5.15.0
	zvariant_utils@4.2.0
"

inherit cargo distutils-r1

DESCRIPTION="Minimal CLI coding agent by Mistral"
HOMEPAGE="https://github.com/mistralai/mistral-vibe"

# Upstream switched from a pure-Python hatchling build to a custom
# maturin-based backend (build_backend/maturin_backend.py, referenced from
# pyproject.toml's build-backend = "maturin_backend") that compiles two
# Rust components and bundles them into the wheel:
#   - harness/core: staged into .native-build/harness-core and built by
#     maturin itself as the actual PEP517 extension module
#     (mistralai_vibe_local_harness._native)
#   - vibe/cli-rust: a standalone "vibe-rs" binary built via a plain
#     cargo-build subprocess call and copied into vibe/_bin/
# CRATES above is the union of both components' Cargo.lock files (only the
# two root workspace crates themselves are excluded, as they're local paths
# with no SRC_URI of their own).
#
# The "v8" crate (rusty_v8 bindings, pulled in transitively) doesn't build
# V8 from source; its build.rs downloads a prebuilt static lib archive from
# GitHub releases at compile time, which the network-sandboxed build phase
# can't reach. Fetch it via SRC_URI instead and point RUSTY_V8_ARCHIVE (a
# build.rs-recognized override -- see its static_lib_url()/download_file())
# at the local copy; it auto-detects and decompresses the gzip archive
# itself, so no separate unpacking is needed. The exact filename encodes
# the crate version, enabled cargo features (here just "simdutf"), and
# target triple, so it'll need updating if the "v8" crate version above
# ever changes.
export RUSTY_V8_ARCHIVE="${DISTDIR}/librusty_v8_simdutf_release_x86_64-unknown-linux-gnu-150.3.0.a.gz"

SRC_URI="
	https://github.com/mistralai/${PN}/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
	https://github.com/denoland/rusty_v8/releases/download/v150.3.0/librusty_v8_simdutf_release_x86_64-unknown-linux-gnu.a.gz -> librusty_v8_simdutf_release_x86_64-unknown-linux-gnu-150.3.0.a.gz
	${CARGO_CRATE_URIS}
"

LICENSE="Apache-2.0"
# Not itemizing every one of the ~630 vendored crates' individual licenses
# here (mostly MIT/Apache-2.0-dual, as usual for the Rust ecosystem); this
# is a personal overlay, not ::gentoo, so skipping the full audit.
SLOT="0"
KEYWORDS="~amd64"

RDEPEND="
	>=dev-libs/tree-sitter-bash-0.25.1[${PYTHON_USEDEP}]
	>=dev-python/agent-client-protocol-0.9.0[${PYTHON_USEDEP}]
	>=dev-python/anyio-4.12[${PYTHON_USEDEP}]
	dev-python/cachetools[${PYTHON_USEDEP}]
	>=dev-python/cryptography-44.0.0[${PYTHON_USEDEP}]
	>=dev-python/debugpy-1.8.19[${PYTHON_USEDEP}]
	>=dev-python/gitpython-3.1.46[${PYTHON_USEDEP}]
	>=dev-python/giturlparse-0.14.0[${PYTHON_USEDEP}]
	dev-python/google-auth[${PYTHON_USEDEP}]
	>=dev-python/httpx-0.28.1[${PYTHON_USEDEP}]
	>=dev-python/keyring-25.6.0[${PYTHON_USEDEP}]
	dev-python/markdownify[${PYTHON_USEDEP}]
	>=dev-python/mcp-1.14.0[${PYTHON_USEDEP}]
	>=dev-python/mistralai-2.4.1[${PYTHON_USEDEP}]
	dev-python/opentelemetry-api[${PYTHON_USEDEP}]
	dev-python/opentelemetry-sdk[${PYTHON_USEDEP}]
	dev-python/opentelemetry-semantic-conventions[${PYTHON_USEDEP}]
	>=dev-python/pexpect-4.9.0[${PYTHON_USEDEP}]
	>=dev-python/packaging-24.1[${PYTHON_USEDEP}]
	dev-python/pydantic[${PYTHON_USEDEP}]
	dev-python/pydantic-settings[${PYTHON_USEDEP}]
	>=dev-python/pyperclip-1.11.0[${PYTHON_USEDEP}]
	>=dev-python/python-dotenv-1.0.0[${PYTHON_USEDEP}]
	dev-python/pyyaml[${PYTHON_USEDEP}]
	dev-python/requests[${PYTHON_USEDEP}]
	>=dev-python/rich-14.0.0[${PYTHON_USEDEP}]
	>=dev-python/textual-8.1.1[${PYTHON_USEDEP}]
	dev-python/textual_speedups[${PYTHON_USEDEP}]
	>=dev-python/tomli-w-1.2.0[${PYTHON_USEDEP}]
	>=dev-python/tree-sitter-0.25.2[${PYTHON_USEDEP}]
	>=dev-python/sounddevice-0.5.1[${PYTHON_USEDEP}]
	dev-python/watchfiles[${PYTHON_USEDEP}]
	dev-python/websockets[${PYTHON_USEDEP}]
	>=dev-python/zstandard-0.25.0[${PYTHON_USEDEP}]
	dev-python/opentelemetry-exporter-otlp-proto-http[${PYTHON_USEDEP}]
	dev-python/jsonpatch[${PYTHON_USEDEP}]
"

# maturin was pinned exactly to 1.14.1 to match pyproject.toml's own
# requires = [maturin==1.14.1] (an isolated-build-only constraint we don't
# honor anyway, see DISTUTILS_USE_PEP517=standalone above); floored instead
# so this doesn't block other packages on this system from pulling in a
# newer maturin -- the PEP517 build_wheel()/build_editable() entry points
# this backend calls are stable across minor releases.
BDEPEND="
	dev-python/editables[${PYTHON_USEDEP}]
	dev-python/truststore[${PYTHON_USEDEP}]
	>=dev-util/maturin-1.14.1[${PYTHON_USEDEP}]
"

RESTRICT="test"

src_unpack() {
	cargo_src_unpack
}

python_prepare_all() {
	# _maturin_environment() unconditionally passes --zig and
	# --compatibility manylinux_2_28 to maturin for the wheel we actually
	# install, targeting a portable, hermetically-linked redistributable
	# wheel (via ziglang's bundled cross-libc). We're building natively
	# for this system with our own toolchain, so that's both unwanted and
	# an extra (unpackaged) ziglang dependency for nothing; neutralize it.
	sed -e '/^def _maturin_environment/a\    portable_linux_wheel = False  # Gentoo: native build, no zig cross-compile shim' \
		-i build_backend/maturin_backend.py || die
	grep -q 'Gentoo: native build' build_backend/maturin_backend.py || die "zig/manylinux patch didn't apply"

	distutils-r1_python_prepare_all
}

src_configure() {
	distutils-r1_src_configure
}

src_compile() {
	distutils-r1_src_compile
}

src_install() {
	distutils-r1_src_install
}