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

# Autogenerated by pycargoebuild 0.13.3

EAPI=8

CRATES="
	aho-corasick@1.1.3
	anstream@0.6.15
	anstyle-parse@0.2.5
	anstyle-query@1.1.1
	anstyle-wincon@3.0.4
	anstyle@1.0.8
	bitflags@2.6.0
	block-buffer@0.10.4
	cfg-if@1.0.0
	clap@4.5.16
	clap_builder@4.5.15
	clap_lex@0.7.2
	colorchoice@1.0.2
	cpufeatures@0.2.13
	crypto-common@0.1.6
	digest@0.10.7
	dirs-sys@0.4.1
	dirs@5.0.1
	env_filter@0.1.2
	env_logger@0.11.5
	equivalent@1.0.1
	errno@0.3.9
	fastrand@2.1.1
	generic-array@0.14.7
	getopts@0.2.21
	getrandom@0.2.15
	hashbrown@0.14.5
	hermit-abi@0.4.0
	humantime@2.1.0
	indexmap@2.5.0
	is-terminal@0.4.13
	is_terminal_polyfill@1.70.1
	itertools@0.4.19
	lazy_static@0.1.16
	lazy_static@1.5.0
	libc@0.2.158
	libredox@0.1.3
	linux-raw-sys@0.4.14
	log@0.4.22
	memchr@2.7.4
	once_cell@1.19.0
	option-ext@0.2.0
	proc-macro2@1.0.86
	pulldown-cmark-escape@0.11.0
	pulldown-cmark@0.12.0
	quote@1.0.37
	redox_users@0.4.6
	regex-automata@0.4.7
	regex-syntax@0.8.4
	regex@1.10.6
	rustc_version@0.1.7
	rustix@0.38.35
	scan-rules@0.2.0
	semver@0.1.20
	serde@1.0.209
	serde_derive@1.0.209
	serde_spanned@0.6.7
	sha1@0.10.6
	shell-words@1.1.0
	strcursor@0.2.5
	strsim@0.11.1
	syn@2.0.77
	tempfile@3.12.0
	thiserror-impl@1.0.63
	thiserror@1.0.63
	toml@0.8.19
	toml_datetime@0.6.8
	toml_edit@0.22.20
	typenum@1.17.0
	unicase@2.7.0
	unicode-ident@1.0.12
	unicode-segmentation@0.1.2
	unicode-width@0.1.13
	utf8parse@0.2.2
	version_check@0.9.5
	wasi@0.11.0+wasi-snapshot-preview1
	windows-sys@0.48.0
	windows-sys@0.52.0
	windows-sys@0.59.0
	windows-targets@0.48.5
	windows-targets@0.52.6
	windows_aarch64_gnullvm@0.48.5
	windows_aarch64_gnullvm@0.52.6
	windows_aarch64_msvc@0.48.5
	windows_aarch64_msvc@0.52.6
	windows_i686_gnu@0.48.5
	windows_i686_gnu@0.52.6
	windows_i686_gnullvm@0.52.6
	windows_i686_msvc@0.48.5
	windows_i686_msvc@0.52.6
	windows_x86_64_gnu@0.48.5
	windows_x86_64_gnu@0.52.6
	windows_x86_64_gnullvm@0.48.5
	windows_x86_64_gnullvm@0.52.6
	windows_x86_64_msvc@0.48.5
	windows_x86_64_msvc@0.52.6
	winnow@0.6.18
	winreg@0.52.0
"

inherit cargo

DESCRIPTION="Command-line tool to run Rust scripts which can make use of crates"
HOMEPAGE="https://rust-script.org"
SRC_URI="
	https://github.com/fornwall/rust-script/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz
	${CARGO_CRATE_URIS}
"

LICENSE="|| ( Apache-2.0 MIT )"
# Dependent crate licenses
LICENSE+=" MIT MPL-2.0 Unicode-DFS-2016"
SLOT="0"
KEYWORDS="~amd64"

BDEPEND=">=virtual/rust-1.74"

QA_FLAGS_IGNORED="usr/bin/.*"

PATCHES=(
	# tests does not work with CARGO_BUILD_TARGET defined
	"${FILESDIR}/${PN}-0.34.0-fix-test.patch"
)

src_prepare() {
	default
	sed -i "s|\"target\"|\"$(cargo_target_dir)\"|" tests/util/mod.rs || die
}