Created
February 14, 2016 20:45
-
-
Save lamchau/8c70dc2a0a0d24746dbd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$pip_file = "requirements.txt" | |
try { | |
pip freeze > $pip_file | |
# PowerShell creates UTF16 LE with Windows line endings so we must convert | |
# for pip to consume | |
# http://stackoverflow.com/questions/8852682/convert-file-from-windows-to-unix-through-powershell-or-batch | |
Get-ChildItem $pip_file | ForEach-Object { | |
$contents = [IO.File]::ReadAllText($_) -replace "`r`n?", "`n" | |
$utf8 = New-Object System.Text.UTF8Encoding $false | |
[IO.File]::WriteAllText($_, $contents, $utf8) | |
} | |
Write-Output "Created '$pip_file'" | |
} catch { | |
Remove-Item $pip_file | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment