Skip to content

Commit

Permalink
Merge pull request #60 from microsoft/59-improve-python3pip3-detection
Browse files Browse the repository at this point in the history
Improve Python/pip detection
  • Loading branch information
markphip authored May 14, 2024
2 parents db45cdc + 74f875c commit f94b482
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/artifacts-helper/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Azure Artifacts Credential Helper",
"id": "artifacts-helper",
"version": "1.0.6",
"version": "1.0.7",
"description": "Configures Codespace to authenticate with Azure Artifact feeds",
"options": {
"nugetURIPrefixes": {
Expand Down
18 changes: 4 additions & 14 deletions src/artifacts-helper/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,8 @@ if command -v sudo >/dev/null 2>&1; then
sudo -u ${_REMOTE_USER} bash -c "/tmp/install-provider.sh ${USENET6}"
rm /tmp/install-provider.sh
if [ "${INSTALL_PIP_HELPER}" = "true" ]; then
# check if python is installed
if command -v pip >/dev/null 2>&1; then
sudo -u ${_REMOTE_USER} bash -c "/tmp/install-python-keyring.sh"
rm /tmp/install-python-keyring.sh
else
echo "Python pip installation not detected, keyring helper not installed."
fi
sudo -u ${_REMOTE_USER} bash -c "/tmp/install-python-keyring.sh"
rm /tmp/install-python-keyring.sh
fi
exit 0
fi
Expand Down Expand Up @@ -151,13 +146,8 @@ if [ "${ALIAS_RUSH}" = "true" ]; then
fi

if [ "${INSTALL_PIP_HELPER}" = "true" ]; then
# check if python is installed
if command -v pip >/dev/null 2>&1; then
bash -c "/tmp/install-python-keyring.sh"
rm /tmp/install-python-keyring.sh
else
echo "Python pip installation not detected, keyring helper not installed."
fi
bash -c "/tmp/install-python-keyring.sh"
rm /tmp/install-python-keyring.sh
fi
rm /tmp/install-provider.sh

Expand Down
12 changes: 11 additions & 1 deletion src/artifacts-helper/scripts/install-python-keyring.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
#!/bin/bash


cd /tmp
wget https://github.com/microsoft/codespace-features/releases/download/latest/codespaces_artifacts_helper_keyring-0.1.0-py3-none-any.whl
pip install codespaces_artifacts_helper_keyring-0.1.0-py3-none-any.whl
if command -v python3 &> /dev/null
then
python3 -m pip install codespaces_artifacts_helper_keyring-0.1.0-py3-none-any.whl
elif command -v python &> /dev/null
then
python -m pip install codespaces_artifacts_helper_keyring-0.1.0-py3-none-any.whl
else
echo "Python installation not detected. Artifacts Helper keyring not installed."
exit 1
fi

0 comments on commit f94b482

Please sign in to comment.