Skip to content

Commit 7503e47

Browse files
AarjunCmeta-codesync[bot]
authored andcommitted
CMake and Docker changes for thrift-python migration.
Summary: Changes to support the thrift-py-deprecated to thrift-python migration in the OSS build environment. Changes: 1. CMakeLists.txt — Complete migration to thrift-python: - Remove include(FBThriftPyLibrary), all add_fbthrift_py_library() targets - Add 15 add_fbthrift_python_library() targets with correct NAMESPACE values matching mstch_python generator output paths - Add all transitive thrift deps (fb303, common, mpls, Address, link, prbs, io_stats, fboss, bcm_config, asic_config) - Key insight: NAMESPACE must be <namespace_py3>.<basename> to match the generator's output directory structure 2. Consumer cmake files — switch to add_fb_thrift_python_executable: - AsicConfigV2ConfigCli.cmake (+ add wedge800bact.py to SOURCES) - PlatformMappingGenUnitTest.cmake - PlatformMappingGenNoRegressionTest.cmake - PlatformMappingV2ConfigCli.cmake 3. Address.thrift — - Replace `package;` with `package "facebook.com/network/address"` - Remove thrift.AllowLegacyMissingUris (unnecessary with non-empty package) - Required because struct "Address" collides with module name "Address" when package is empty 4. CMakeLists.txt — Detect Python sysconfig -march flag and apply to CMAKE_CXX_FLAGS to avoid F14LinkCheck ABI mismatch with folly-python. 5. run-getdeps.py — detect -march flag from Python sysconfig and propagate to CXXFLAGS for all dependency builds. Required because Cython extensions inherit -march=x86-64-v2 from Python 3.12 sysconfig on CentOS Stream 9, but cmake does not. 8. Dockerfiles — install Cython, wheel, auditwheel, patchelf, setuptools, filelock for building folly-python/fbthrift-python Cython extensions and wheels. Install Python 3.12 as system default on CentOS (required >= 3.10). OK : 6 FAILED : 0 SKIPPED : 0 TIMEOUT : 0 ./bin/run_test.py link --agent-run-mode multi_switch --hw-agent-bin-path /opt/fboss/bin/fboss_hw_agent-sai_impl --config /opt/fboss/share/link_test_configs/montblanc.materialized_JSON --qsfp-config /opt/fboss/share/qsfp_test_configs/montblanc.materialized_JSON --filter AgentEnsembleQsfpFsdbTest.* 2>&1 | tee "coldboot_Test.log" ... Removed '/etc/systemd/system/multi-user.target.wants/fboss_hw_agent_oss@0.service'. Removed '/etc/systemd/system/fboss_hw_agent_oss@0.service'. Cleaning up qsfp_service_oss Cleaning up fsdb_service_oss Cleaning up FBOSS HW Agent Service for index=0... Running all tests took 0:12:14.758873 between 2026-03-31 14:07:59.506379 and 2026-03-31 14:20:14.265252 [ OK ] warm_boot.AgentEnsembleQsfpFsdbTest.tcvr (33887 ms) [ OK ] warm_boot.AgentEnsembleQsfpFsdbTest.phy (33943 ms) [ OK ] warm_boot.AgentEnsembleQsfpFsdbTest.portState (25910 ms) [ OK ] warm_boot.AgentEnsembleQsfpFsdbTest.portStateWithResetHold (53598 ms) OK : 4 FAILED : 0 SKIPPED : 0 TIMEOUT : 0 [root@fboss330347219.ash6 /opt/fboss]# ./bin/run_test.py sai_agent --agent-run-mode multi_switch --num-npus 2 --hw-agent-bin-path /opt/fboss/bin/fboss_hw_agent-sai_impl --filter '*AgentEmpty*:*Vlan*' --config /opt/fboss/share/hw_test_configs/montblanc.agent.materialized_JSON --qsfp-config /opt/fboss/share/qsfp_test_configs/montblanc.materialized_JSON --skip-known-bad-tests "brcm/13.3.0.0_dnx_odp/13.3.0.0_dnx_odp/jericho3" 2>&1 | tee "test_output_$(date +%Y%m%d_%H%M%S).log" ... Failed to stop fboss_hw_agent@0.service: Unit fboss_hw_agent@0.service not loaded. Failed to stop fboss_hw_agent_for_testing_0.service: Unit fboss_hw_agent_for_testing_0.service not loaded. Removed '/etc/systemd/system/multi-user.target.wants/fboss_hw_agent_oss@0.service'. Removed '/etc/systemd/system/fboss_hw_agent_oss@0.service'. Failed to stop fboss_hw_agent@1.service: Unit fboss_hw_agent@1.service not loaded. Failed to stop fboss_hw_agent_for_testing_1.service: Unit fboss_hw_agent_for_testing_1.service not loaded. Removed '/etc/systemd/system/multi-user.target.wants/fboss_hw_agent_oss@1.service'. Removed '/etc/systemd/system/fboss_hw_agent_oss@1.service'. Cleaning up FBOSS HW Agent Service for index=0... Cleaning up FBOSS HW Agent Service for index=1... Running all tests took 0:02:01.342550 between 2026-03-27 15:48:31.906896 and 2026-03-27 15:50:33.249446 [ OK ] warm_boot.AgentEmptyTest.CheckInit (13025 ms) [ OK ] warm_boot.AgentEmptyVoqTest.CheckInit (12780 ms) OK : 2 FAILED : 0 SKIPPED : 0 TIMEOUT : 0 ``` Reviewed By: joseph5wu Differential Revision: D98059537 fbshipit-source-id: 849a9699d0f73fde30ecceb07f60e0a210d51344
1 parent b121eea commit 7503e47

2 files changed

Lines changed: 20 additions & 14 deletions

File tree

build/fbcode_builder/CMake/FBThriftPythonLibrary.cmake

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,19 @@ function(add_fbthrift_python_library LIB_NAME THRIFT_FILE)
153153

154154
# Parse the namespace value
155155
if (NOT DEFINED ARG_NAMESPACE)
156-
set(ARG_NAMESPACE "${base}")
156+
set(ARG_NAMESPACE "")
157157
endif()
158158

159-
# mstch_python outputs to gen-python/<namespace>/
159+
# mstch_python outputs to gen-python/<namespace_py3>/<basename>/
160+
# NAMESPACE should match the "namespace py3" value in the thrift file
161+
# (consistent with BUCK's py3_namespace). The basename is appended
162+
# automatically by this function, just as the mstch_python generator does.
160163
string(REPLACE "." "/" namespace_dir "${ARG_NAMESPACE}")
161-
set(py_output_dir "${output_dir}/gen-python/${namespace_dir}")
164+
if(namespace_dir STREQUAL "")
165+
set(py_output_dir "${output_dir}/gen-python/${base}")
166+
else()
167+
set(py_output_dir "${output_dir}/gen-python/${namespace_dir}/${base}")
168+
endif()
162169
list(APPEND generated_sources
163170
"${py_output_dir}/thrift_types.py"
164171
"${py_output_dir}/thrift_enums.py"
@@ -205,10 +212,9 @@ function(add_fbthrift_python_library LIB_NAME THRIFT_FILE)
205212
string(REPLACE ";" "," GEN_ARG_STR "${ARG_OPTIONS}")
206213

207214
# mstch_python generates output at gen-python/<namespace_py3>/<basename>/
208-
# The CMake NAMESPACE parameter must match this full path (including the
209-
# basename appended by the generator). For example, phy.thrift with
210-
# "namespace py3 neteng.fboss.phy" produces gen-python/neteng/fboss/phy/phy/
211-
# so NAMESPACE must be "neteng.fboss.phy.phy".
215+
# The CMake NAMESPACE parameter should match the "namespace py3" directive
216+
# in the thrift file (consistent with BUCK's py3_namespace). The basename
217+
# is appended automatically by this function.
212218

213219
# Emit the rule to run the thrift compiler
214220
add_custom_command(

build/fbcode_builder/manifests/fboss

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@ job_weight_mib = 3072
1616
builder = nop
1717

1818
[dependencies]
19-
folly
19+
folly-python
2020
fb303
21-
wangle
22-
fizz
23-
mvfst
24-
fmt
21+
wangle-python
22+
fizz-python
23+
mvfst-python
24+
fmt-python
2525
libsodium
2626
googletest
27-
zstd
27+
zstd-python
2828
fatal
29-
fbthrift
29+
fbthrift-python
3030
iproute2
3131
libusb
3232
libcurl

0 commit comments

Comments
 (0)