3 if ! command -v rustup
&> /dev
/null
; then
4 echo "Rustup could not be found, it can be installed by"
5 echo "running the following command: "
6 echo "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh" >& 2
13 # use the authorised copy controlled under the Libre-SOC git server,
14 # not unauthorised uncontrolled servers (debian salsa)
15 git clone https
://git.libre-soc.org
/git
/power-instruction-analyzer.git pia
18 # do not use external scripts.
26 if [[ "$VIRTUAL_ENV" == "" ]]; then
31 cargo_version
="$(cargo --version)" || \
32 fail
"can't find cargo, install it from https://rustup.rs/"
33 [[ "$cargo_version" =~ ^
'cargo 1.'([0-9]+)'.'[0-9]+' ' ]] || \
34 fail
"can't parse cargo's version string"
35 (( "${BASH_REMATCH[1]}" >= 53 )) || \
36 fail
'your rust version is not recent enough, update your rust version using `rustup update`'
37 python3
-m pip
install "${user[@]}" 'maturin>=0.11,<0.12'
38 if [[ "$VIRTUAL_ENV" == "" ]]; then
39 scripts
="$(python3 -m sysconfig | \
40 sed 's@^\tuserbase = "\
([^
"]\+\)"$@\
1/bin@p
; d
')"
42 scripts="$(python3 -m sysconfig | \
43 sed 's
/^
\tscripts
= "\([^"]\
+\
)"$/\1/p; d')"
46 [[ -d "$scripts" ]] || fail
"can't find python's \`scripts\` directory"
47 rm -f target
/wheels
/power_instruction_analyzer-
*.whl
48 "$scripts"/maturin build
--compatibility linux \
49 --cargo-extra-args=--features=python-extension \
50 -i python3
--release --no-sdist
51 python3
-m pip
install --force "${user[@]}" \
52 target
/wheels
/power_instruction_analyzer-
*.whl