Skip to content

Commit

Permalink
setup: deploy pyc files only (#6394)
Browse files Browse the repository at this point in the history
  • Loading branch information
yugangw-msft authored May 21, 2018
1 parent 3358901 commit db1644c
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions build_scripts/windows/scripts/build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,30 @@ rmdir /s /q %BUILDING_DIR%\Scripts
for /f %%a in ('dir %BUILDING_DIR%\Lib\site-packages\*.egg-info /b /s /a:d') do (
rmdir /s /q %%a
)
for /d /r %BUILDING_DIR%\Lib\site-packages %%d in (__pycache__) do (
if exist %%d rmdir /s /q "%%d"
)

:: Use universal files and remove Py3 only files
pushd %BUILDING_DIR%\Lib\site-packages\azure\mgmt
for /f %%a in ('dir /b /s *_py3.py') do (
set PY3_FILE=%%a
if exist !PY3_FILE! del !PY3_FILE!
)
for /f %%a in ('dir /b /s *_py3.*.pyc') do (
set PY3_FILE=%%a
if exist !PY3_FILE! del !PY3_FILE!
)
popd

:: Remove .py and only deploy .pyc files
pushd %BUILDING_DIR%\Lib\site-packages
for /f %%f in ('dir /b /s *.pyc') do (
set PARENT_DIR=%%~df%%~pf..
set FILENAME=%%~nf
set BASE_FILENAME=!FILENAME:~0,-11!
set pyc=!BASE_FILENAME!.pyc
del !PARENT_DIR!\!BASE_FILENAME!.py
copy %%~f !PARENT_DIR!\!pyc! >nul
del %%~f
)
popd

if %errorlevel% neq 0 goto ERROR
Expand Down

0 comments on commit db1644c

Please sign in to comment.