blender/build_files/windows/format.cmd
Ray Molenkamp 9f1f869e16 make.bat: Enable .py formatting with make format
autopep8_format_paths.py was never wired up in the windows tooling,
this PR wires it up, to get around a 8191 limitation for command
lines on windows an alternative "--no-subprocess" option has been
introduced to call the pep8 module directly from python.

TODO: A subprocess is still used for getting the version information

Contributors:

- @campbellbarton fixes to autopep8_format_paths.py to support
  the -no-subprocess option.

Pull Request: https://projects.blender.org/blender/blender/pulls/120794
2024-06-06 09:10:19 -06:00

33 lines
794 B
Batchfile

if EXIST %BLENDER_DIR%\lib\windows_x64\llvm\bin\clang-format.exe (
set CF_PATH=lib\windows_x64\llvm\bin
goto detect_done
)
if EXIST %BLENDER_DIR%\lib\windows_arm64\llvm\bin\clang-format.exe (
set CF_PATH=lib\windows_arm64\llvm\bin
goto detect_done
)
echo clang-format not found
exit /b 1
:detect_done
echo found clang-format in %CF_PATH%
if NOT EXIST %PYTHON% (
echo python not found, required for this operation
exit /b 1
)
set FORMAT_PATHS=%BLENDER_DIR%\tools\utils_maintenance\clang_format_paths.py
REM The formatting script expects clang-format to be in the current PATH.
set PATH=%CF_PATH%;%PATH%
REM Use -B to avoid writing __pycache__ in lib directory and causing update conflicts.
%PYTHON% -B %FORMAT_PATHS% %FORMAT_ARGS%
call "%~dp0\autopep8.cmd"
:EOF