[WIP] AppVeyor: optimize python modules (#569)

* AppVeyor: don't unpack python36.zip
* AppVeyor: remove __pycache__ dirs from python36/site-packages
This commit is contained in:
Paul I 2018-07-11 11:36:39 +03:00 committed by xarkes
parent 3569842ca6
commit d9d1ce3b91

View File

@ -57,16 +57,18 @@ after_build:
- ps: $env:py_version = (python --version).Split()[1]
- ps: $env:py_platform = If ($env:ARCH -eq "x64") {"amd64"} Else {"win32"}
- ps: $env:py_url = "https://www.python.org/ftp/python/${env:py_version}/python-${env:py_version}-embed-${env:py_platform}.zip"
- cmd: powershell -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; wget %py_url% -OutFile python_embed.zip; Expand-Archive .\python_embed.zip -DestinationPath .\python_embed; Remove-Item -Path .\python_embed\vcruntime140.dll"
- cmd: powershell -Command "Expand-Archive .\python_embed\python36.zip -DestinationPath .\%ARTIFACT_PATH%\python36"
- cmd: rd /s /q "%ARTIFACT_PATH%\python36\lib2to3"
- cmd: powershell -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; wget %py_url% -OutFile python_embed.zip; Expand-Archive .\python_embed.zip -DestinationPath .\python_embed"
- cmd: python -m pip install -I --no-compile -t "%ARTIFACT_PATH%\python36\site-packages" jupyter
- cmd: if exist "%ARTIFACT_PATH%\python36\site-packages\test" ( rd /s /q "%ARTIFACT_PATH%\python36\site-packages\test" )
- cmd: for /d %%p in ("%ARTIFACT_PATH%\python36\site-packages\*.dist-info" "%ARTIFACT_PATH%\python36\site-packages\*.egg-info") do rd /s /q "%%p"
- cmd: python -O -m compileall -b -q "%ARTIFACT_PATH%\python36\site-packages"
- cmd: del /s "%ARTIFACT_PATH%\python36\site-packages\*.py"
- cmd: copy python_embed\*.pyd "%ARTIFACT_PATH%\python36\" && copy python_embed\*.dll "%ARTIFACT_PATH%\"
- cmd: powershell -Command "[System.IO.File]::WriteAllLines(\"%ARTIFACT_PATH%\python36._pth\", \"python36`r`npython36\site-packages\")"
- cmd: powershell -c "Get-ChildItem -Path \"%ARTIFACT_PATH%\python36\site-packages\" -Include '__pycache__' -Recurse -Force | Remove-Item -Force -Recurse"
- cmd: copy python_embed\python36.zip "%ARTIFACT_PATH%\python36\"
- cmd: copy python_embed\*.pyd "%ARTIFACT_PATH%\python36\"
- cmd: copy python_embed\sqlite3.dll "%ARTIFACT_PATH%\python36\"
- cmd: copy python_embed\python*.dll "%ARTIFACT_PATH%\"
- cmd: powershell -Command "[System.IO.File]::WriteAllLines(\"%ARTIFACT_PATH%\python36._pth\", \"python36`r`npython36\python36.zip`r`npython36\site-packages\")"
# Tests
test: off