+az (azure-cli)#451
Conversation
|
|
The test is actually not working properly. It works locally on macOS. I guess it's something with the virtualenv. Will continue to check |
| script: | | ||
| python -m venv {{prefix}}/venv | ||
| cd {{prefix}}/venv | ||
| pip install {{prefix}}/../src-v{{version}}/src/azure-cli | ||
| pip install {{prefix}}/../src-v{{version}}/src/azure-cli-core | ||
| pip install {{prefix}}/../src-v{{version}}/src/azure-cli-telemetry | ||
| mkdir -p ../bin | ||
|
|
||
| cat <<EOF > ../bin/"az" | ||
| #!/bin/sh | ||
| export VIRTUAL_ENV="\$(cd "\$(dirname "\$0")"/.. && pwd)/venv" | ||
| TEA_PYTHON="\$(which python)" | ||
| TEA_PYHOME="\$(dirname "\$TEA_PYTHON")" | ||
| cat <<EOSH > \$VIRTUAL_ENV/pyvenv.cfg | ||
| home = \$TEA_PYHOME | ||
| include-system-site-packages = false | ||
| executable = \$TEA_PYTHON | ||
| EOSH | ||
| find "\$VIRTUAL_ENV"/bin -maxdepth 1 -type f | xargs \\ | ||
| sed -i.bak "1s|.*|#!\$VIRTUAL_ENV/bin/python|" | ||
| rm "\$VIRTUAL_ENV"/bin/*.bak | ||
| ln -sf "\$TEA_PYTHON" "\$VIRTUAL_ENV"/bin/python | ||
| exec "\$VIRTUAL_ENV"/bin/az "\$@" | ||
| EOF | ||
|
|
||
| chmod +x ../bin/"az" |
There was a problem hiding this comment.
Does our existing python-venv.sh script not work for this?
There was a problem hiding this comment.
no because in the root of the repo there's no setup.py. azure has three subrepos (see line 27-29)
There was a problem hiding this comment.
It works locally, but I feel like something's not right here
There was a problem hiding this comment.
Hm. What if you ran them back-to-front:
for venv in azure-cli{-telemetry,-core,}; do
python-venv.sh "{{prefix}}"/az
done?
Just thinking that gets the most battle-testing in terms of venv management.
There was a problem hiding this comment.
Doesn't work like that unfortunately, or I don't understand where you'd like to add it. We need some things that python-venv.sh is doing but not all
There was a problem hiding this comment.
Roger. I figure that'd build all three parts into the venv, and overwrite the final linkage each time; but if it's doesn't work, it doesn't work.
There was a problem hiding this comment.
Ok I may have found a way:
for venv in azure-cli{-telemetry,-core,}; do
SRCROOT={{prefix}}/../src-v{{version}}/src/"$venv" python-venv.sh "{{prefix}}"/bin/az
done
There was a problem hiding this comment.
Magical. I love standardization.
|
Cool it worked and tests pass too |
| freedesktop.org/pkg-config: '*' | ||
| script: | | ||
| for venv in azure-cli{-telemetry,-core,}; do | ||
| SRCROOT={{prefix}}/../src-v{{version}}/src/"$venv" python-venv.sh "{{prefix}}"/bin/az |
There was a problem hiding this comment.
I think {{prefix}}/../src-v{{version}}/src/"$venv" is the same thing as ./src/"$venv".
There was a problem hiding this comment.
throws an error if i do that
Error: invalid absolute path: ./src/azure-cli-telemetry
at new Path (file:///opt/tea.xyz/src-v0.24.9/src/vendor/Path.ts:37:19)
at from_env (file:///opt/tea.xyz/src-v0.24.9/src/app.ts:175:22)
at injection (file:///opt/tea.xyz/src-v0.24.9/src/app.ts:165:16)
at file:///opt/tea.xyz/src-v0.24.9/src/app.ts:34:36
There was a problem hiding this comment.
Hm. Guess that only works for TEA_PANTRY_PATH. Other packages (like tea.xyz/gx/cc) suggest that $SRCROOT might be set by default. I don't know if this better:
_SRCROOT="$SRCROOT"
for ......
SRCROOT="$_SRCROOT"/src/"$venv" ...
...That's not much of an improvement, but it protects against future changes.
There was a problem hiding this comment.
I don't really understand this _SRCROOT="$SRCROOT" but it works :)
There was a problem hiding this comment.
Ha. Captures the original $SRCROOT before we start overwriting it.
closes #302