Merge pull request #1750 from nikita-bykov/pipx

[macOS] Add pipx and install yamllint through it
This commit is contained in:
Maxim Lobanov
2020-10-28 10:29:01 +03:00
committed by GitHub
16 changed files with 78 additions and 9 deletions

View File

@@ -21,7 +21,6 @@ binst_common_utils=(
gh
p7zip
ant
yamllint
aria2
)

View File

@@ -0,0 +1,18 @@
source ~/utils/utils.sh
export PATH="$PATH:/opt/pipx_bin"
toolset=$(get_toolset_path)
pipx_packages=$(jq -r ".pipx[] .package" $toolset)
for package in $pipx_packages; do
python_version=$(jq -r ".pipx[] | select(.package == \"$package\") .python" $toolset)
if [ "$python_version" != "null" ]; then
python_path="$HOME/hostedtoolcache/Python/$python_version*/x64/bin/python$python_version"
echo "Install $package into python $python_path"
pipx install $package --python $python_path
else
echo "Install $package into default python"
pipx install $package
fi
done

View File

@@ -17,3 +17,13 @@ echo "Brew Installing Python 2"
brew tap-new --no-git local/python2
FORMULA_PATH=$(brew extract python@2 local/python2 | grep "Homebrew/Library/Taps")
brew install $FORMULA_PATH
echo "Installing pipx"
export PIPX_BIN_DIR=/usr/local/opt/pipx_bin
export PIPX_HOME=/usr/local/opt/pipx
brew install pipx
echo "export PIPX_BIN_DIR=${PIPX_BIN_DIR}" >> "${HOME}/.bashrc"
echo "export PIPX_HOME=${PIPX_HOME}" >> "${HOME}/.bashrc"
echo 'export PATH="$PIPX_BIN_DIR:$PATH"' >> "${HOME}/.bashrc"

View File

@@ -96,6 +96,11 @@ function Get-PipVersion {
return "${versionPart1} ${versionPart2} ${versionPart3}"
}
function Get-PipxVersion {
$pipxVersion = Run-Command "pipx --version" -SuppressStderr
return "Pipx $pipxVersion"
}
function Get-NVMNodeVersionList {
$nvmPath = Join-Path $env:HOME ".nvm" "nvm.sh"
$nvmInitCommand = ". ${nvmPath} > /dev/null 2>&1 || true"

View File

@@ -83,6 +83,7 @@ $npmVersion = Run-Command "npm --version"
$yarnVersion = Run-Command "yarn --version"
$nugetVersion = Run-Command "nuget help" | Select-Object -First 1 | Take-Part -Part 2
$pip3Version = Get-PipVersion -Version 3
$pipxVersion = Get-PipxVersion
$condaVersion = Invoke-Expression "conda --version"
$rubyGemsVersion = Run-Command "gem --version"
$composerVersion = Run-Command "composer --version" | Take-Part -Part 2
@@ -99,6 +100,7 @@ if ($os.IsLessThanBigSur) {
$markdown += New-MDList -Style Unordered -Lines @(
"Pip ${pip3Version}",
$pipxVersion,
$bundlerVersion,
"Carthage ${carthageVersion}",
"CocoaPods ${cocoaPodsVersion}",

View File

@@ -181,7 +181,8 @@
"./provision/core/edge.sh",
"./provision/core/firefox.sh",
"./provision/core/toolcache-high-sierra.sh",
"./provision/core/pypy.sh"
"./provision/core/pypy.sh",
"./provision/core/pipx-packages.sh"
]
},
{

View File

@@ -186,7 +186,8 @@
"./provision/core/miniconda.sh",
"./provision/core/xcode-postbuild.sh",
"./provision/core/toolcache.sh",
"./provision/core/pypy.sh"
"./provision/core/pypy.sh",
"./provision/core/pipx-packages.sh"
],
"environment_vars": [
"GITHUB_FEED_TOKEN={{user `github_feed_token`}}"

View File

@@ -185,7 +185,8 @@
"./provision/core/firefox.sh",
"./provision/core/xcode-postbuild.sh",
"./provision/core/toolcache.sh",
"./provision/core/pypy.sh"
"./provision/core/pypy.sh",
"./provision/core/pipx-packages.sh"
],
"environment_vars": [
"GITHUB_FEED_TOKEN={{user `github_feed_token`}}"

View File

@@ -181,7 +181,8 @@
"./provision/core/chrome.sh",
"./provision/core/edge.sh",
"./provision/core/firefox.sh",
"./provision/core/toolcache.sh"
"./provision/core/toolcache.sh",
"./provision/core/pipx-packages.sh"
],
"environment_vars": [
"GITHUB_FEED_TOKEN={{user `github_feed_token`}}"

View File

@@ -3,10 +3,6 @@ Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1"
$os = Get-OSVersion
Describe "Linters" {
It "yamllint" {
"yamllint --version" | Should -ReturnZeroExitCode
}
It "SwiftLint" -Skip:($os.IsHighSierra) {
"swiftlint version" | Should -ReturnZeroExitCode
}

View File

@@ -0,0 +1,7 @@
Describe "PipxPackages" {
$pipxToolset = Get-ToolsetValue "pipx"
$testCases = $pipxToolset | ForEach-Object { @{package = $_.package; cmd = $_.cmd} }
It "<package>" -TestCases $testCases {
"$cmd" | Should -ReturnZeroExitCode
}
}

View File

@@ -32,6 +32,10 @@ Describe "Python" {
"pip3 --version" | Should -ReturnZeroExitCode
}
It "Pipx is available" {
"pipx --version" | Should -ReturnZeroExitCode
}
It "Pip 3 and Python 3 came from the same brew formula" {
$pip3Path = Split-Path (readlink (which pip3))
$python3Path = Split-Path (readlink (which python3))

View File

@@ -194,5 +194,11 @@
"3.6"
]
}
],
"pipx": [
{
"package": "yamllint",
"cmd": "yamllint --version"
}
]
}

View File

@@ -254,5 +254,11 @@
"1.15.*"
]
}
],
"pipx": [
{
"package": "yamllint",
"cmd": "yamllint --version"
}
]
}

View File

@@ -163,5 +163,11 @@
"1.15.*"
]
}
],
"pipx": [
{
"package": "yamllint",
"cmd": "yamllint --version"
}
]
}

View File

@@ -88,5 +88,11 @@
"1.15.*"
]
}
],
"pipx": [
{
"package": "yamllint",
"cmd": "yamllint --version"
}
]
}