Merge pull request #51549 from s0undt3ch/2019.2

[2019.2] Allow NOT to install pip dependencies
This commit is contained in:
Daniel Wozniak 2019-02-13 11:16:51 -07:00 committed by GitHub
commit e7ee04e6d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 75 additions and 42 deletions

View File

@ -22,22 +22,10 @@
# Load parameters
param(
[switch]$Silent
[switch]$Silent,
[switch]$NoPipDependencies
)
Write-Output "================================================================="
Write-Output ""
Write-Output " Development Environment Installation"
Write-Output ""
Write-Output " - Installs All Salt Dependencies"
Write-Output " - Detects 32/64 bit Architectures"
Write-Output ""
Write-Output " To run silently add -Silent"
Write-Output " eg: dev_env.ps1 -Silent"
Write-Output ""
Write-Output "================================================================="
Write-Output ""
#==============================================================================
# Get the Directory of actual script
#==============================================================================
@ -49,6 +37,22 @@ $script_path = $script_path.DirectoryName
#==============================================================================
$script_name = $MyInvocation.MyCommand.Name
Write-Output "================================================================="
Write-Output ""
Write-Output " Development Environment Installation"
Write-Output ""
Write-Output " - Installs All Salt Dependencies"
Write-Output " - Detects 32/64 bit Architectures"
Write-Output ""
Write-Output " To run silently add -Silent"
Write-Output " eg: ${script_name} -Silent"
Write-Output ""
Write-Output " To run skip installing pip dependencies add -NoPipDependencies"
Write-Output " eg: ${script_name} -NoPipDependencies"
Write-Output ""
Write-Output "================================================================="
Write-Output ""
#==============================================================================
# Import Modules
#==============================================================================
@ -199,12 +203,23 @@ Start_Process_and_test_exitcode "cmd" "/c $($ini['Settings']['Python2Dir'])\pyth
#==============================================================================
# Install pypi resources using pip
# Install windows specific pypi resources using pip
#==============================================================================
Write-Output " ----------------------------------------------------------------"
Write-Output " - $script_name :: Installing pypi resources using pip . . ."
Write-Output " - $script_name :: Installing windows specific pypi resources using pip . . ."
Write-Output " ----------------------------------------------------------------"
Start_Process_and_test_exitcode "cmd" "/c $($ini['Settings']['Python2Dir'])\python.exe -m pip --disable-pip-version-check --no-cache-dir install -r $($script_path)\req.txt" "pip install"
Start_Process_and_test_exitcode "cmd" "/c $($ini['Settings']['Python2Dir'])\python.exe -m pip --disable-pip-version-check --no-cache-dir install -r $($script_path)\req_win.txt" "pip install"
#==============================================================================
# Install pypi resources using pip
#==============================================================================
If ($NoPipDependencies -eq $false) {
Write-Output " ----------------------------------------------------------------"
Write-Output " - $script_name :: Installing pypi resources using pip . . ."
Write-Output " ----------------------------------------------------------------"
Start_Process_and_test_exitcode "cmd" "/c $($ini['Settings']['Python2Dir'])\python.exe -m pip --disable-pip-version-check --no-cache-dir install -r $($script_path)\req.txt" "pip install"
}
#==============================================================================

View File

@ -22,22 +22,10 @@
# Load parameters
param(
[switch]$Silent
[switch]$Silent,
[switch]$NoPipDependencies
)
Write-Output "================================================================="
Write-Output ""
Write-Output " Development Environment Installation"
Write-Output ""
Write-Output " - Installs All Salt Dependencies"
Write-Output " - Detects 32/64 bit Architectures"
Write-Output ""
Write-Output " To run silently add -Silent"
Write-Output " eg: dev_env.ps1 -Silent"
Write-Output ""
Write-Output "================================================================="
Write-Output ""
#==============================================================================
# Get the Directory of actual script
#==============================================================================
@ -49,6 +37,22 @@ $script_path = $script_path.DirectoryName
#==============================================================================
$script_name = $MyInvocation.MyCommand.Name
Write-Output "================================================================="
Write-Output ""
Write-Output " Development Environment Installation"
Write-Output ""
Write-Output " - Installs All Salt Dependencies"
Write-Output " - Detects 32/64 bit Architectures"
Write-Output ""
Write-Output " To run silently add -Silent"
Write-Output " eg: ${script_name} -Silent"
Write-Output ""
Write-Output " To run skip installing pip dependencies add -NoPipDependencies"
Write-Output " eg: ${script_name} -NoPipDependencies"
Write-Output ""
Write-Output "================================================================="
Write-Output ""
#==============================================================================
# Import Modules
#==============================================================================
@ -197,13 +201,24 @@ Write-Output " - $script_name :: Updating PIP and SetupTools . . ."
Write-Output " ----------------------------------------------------------------"
Start_Process_and_test_exitcode "cmd" "/c $($ini['Settings']['Python3Dir'])\python.exe -m pip --disable-pip-version-check --no-cache-dir install -r $($script_path)\req_pip.txt" "python pip"
#==============================================================================
# Install windows specific pypi resources using pip
#==============================================================================
Write-Output " ----------------------------------------------------------------"
Write-Output " - $script_name :: Installing windows specific pypi resources using pip . . ."
Write-Output " ----------------------------------------------------------------"
Start_Process_and_test_exitcode "cmd" "/c $($ini['Settings']['Python3Dir'])\python.exe -m pip --disable-pip-version-check --no-cache-dir install -r $($script_path)\req_win.txt" "pip install"
#==============================================================================
# Install pypi resources using pip
#==============================================================================
Write-Output " ----------------------------------------------------------------"
Write-Output " - $script_name :: Installing pypi resources using pip . . ."
Write-Output " ----------------------------------------------------------------"
Start_Process_and_test_exitcode "cmd" "/c $($ini['Settings']['Python3Dir'])\python.exe -m pip --disable-pip-version-check --no-cache-dir install -r $($script_path)\req.txt" "pip install"
If ($NoPipDependencies -eq $false) {
Write-Output " ----------------------------------------------------------------"
Write-Output " - $script_name :: Installing pypi resources using pip . . ."
Write-Output " ----------------------------------------------------------------"
Start_Process_and_test_exitcode "cmd" "/c $($ini['Settings']['Python3Dir'])\python.exe -m pip --disable-pip-version-check --no-cache-dir install -r $($script_path)\req.txt" "pip install"
}
#==============================================================================
# Cleaning Up PyWin32
@ -237,11 +252,13 @@ Remove-Item "$($ini['Settings']['Scripts3Dir'])\pywin32_*" -Force -Recurse
#==============================================================================
# Fix PyCrypto
#==============================================================================
Write-Output " ----------------------------------------------------------------"
Write-Output " - $script_name :: Fixing PyCrypto . . ."
Write-Output " ----------------------------------------------------------------"
$nt_file = "$($ini['Settings']['Python3Dir'])\Lib\site-packages\Crypto\Random\OSRNG\nt.py"
(Get-Content $nt_file) | Foreach-Object {$_ -replace '^import winrandom$', 'from Crypto.Random.OSRNG import winrandom'} | Set-Content $nt_file
If ($NoPipDependencies -eq $false) {
Write-Output " ----------------------------------------------------------------"
Write-Output " - $script_name :: Fixing PyCrypto . . ."
Write-Output " ----------------------------------------------------------------"
$nt_file = "$($ini['Settings']['Python3Dir'])\Lib\site-packages\Crypto\Random\OSRNG\nt.py"
(Get-Content $nt_file) | Foreach-Object {$_ -replace '^import winrandom$', 'from Crypto.Random.OSRNG import winrandom'} | Set-Content $nt_file
}
#==============================================================================
# Copy DLLs to Python Directory

View File

@ -1,3 +1,4 @@
-r req_win.txt
backports-abc==0.5
backports.ssl-match-hostname==3.7.0.1
certifi
@ -28,7 +29,6 @@ pyOpenSSL==18.0.0
python-dateutil==2.7.5
python-gnupg==0.4.3
pythonnet==2.3.0
pywin32==224
PyYAML==3.13
pyzmq==17.1.2
requests==2.21.0
@ -37,4 +37,3 @@ smmap==0.9.0
timelib==0.2.4
tornado==4.5.3
wheel==0.32.3
WMI==1.4.9

2
pkg/windows/req_win.txt Normal file
View File

@ -0,0 +1,2 @@
pywin32==224
WMI==1.4.9