Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions language-extensions/python/build/linux/restore-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,27 @@ sed -i 's/using gcc[^;]*;/using gcc : foo : g++ : <cxxflags>-fPIC ;/g' project-c

cp -rf boost /usr/local/include/

# Remove unused Boost library sources to avoid false Component Governance alerts.
# Only boost_python and boost_numpy are compiled (b2 --with-python).
# Headers under boost/ at the root are kept since they are needed at compile time.
# This runs after the build so that Jamfiles are available for b2's dependency resolution.
#
BOOST_LIBS_DIR=/usr/local/lib/boost_${BOOST_VERSION_IN_UNDERSCORE}/libs
if [ -d "${BOOST_LIBS_DIR}" ]; then
echo "-- Removing unused Boost library sources --"
pushd "${BOOST_LIBS_DIR}"
for dir in */; do
case "${dir%/}" in
python|numpy|headers) ;;
*) rm -rf "$dir" ;;
esac
done
popd
echo "-- Finished removing unused Boost library sources --"
else
echo "WARNING: Boost libs directory not found at ${BOOST_LIBS_DIR}, skipping cleanup."
fi

popd

exit $?
21 changes: 21 additions & 0 deletions language-extensions/python/build/windows/restore-packages.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ echo -- Finished Boost Zip extration -- Time: %time% --
REM Boost cleanup
echo Delete 7z boost archive
del boost_%BOOST_VERSION_IN_UNDERSCORE%.7z

echo go to dir with boost unarchived
echo %cd%
dir
Expand Down Expand Up @@ -109,6 +110,26 @@ echo -- Beginning Boost build using compiled b2.exe -- Time: %time% --
b2.exe -j12 --with-python toolset=msvc-14.2 address-model=64 link=static,shared threading=multi
echo -- Finished Boost build -- Time: %time% --

REM Remove unused Boost library sources to avoid false Component Governance alerts.
REM Only boost_python and boost_numpy are compiled (b2 --with-python).
REM Headers under boost/ at the root are kept since they are needed at compile time.
REM This runs after the build so that Jamfiles are available for b2's dependency resolution.
REM
SET BOOST_LIBS_DIR=%PACKAGES_ROOT%\boost_%BOOST_VERSION_IN_UNDERSCORE%\libs
IF EXIST "%BOOST_LIBS_DIR%" (
echo -- Removing unused Boost library sources -- Time: !time! --
pushd "%BOOST_LIBS_DIR%"
for /d %%D in (*) do (
if /I not "%%D"=="python" if /I not "%%D"=="numpy" if /I not "%%D"=="headers" (
RMDIR /s /q "%%D"
)
)
popd
echo -- Finished removing unused Boost library sources -- Time: !time! --
) ELSE (
echo WARNING: Boost libs directory not found at %BOOST_LIBS_DIR%, skipping cleanup.
)

REM If building in pipeline, set the PYTHONHOME here to overwrite the existing PYTHONHOME
REM
if NOT "%BUILD_BUILDID%"=="" (
Expand Down
Loading