From 999355e3c8c7183c55ca13323540ffb15402d779 Mon Sep 17 00:00:00 2001 From: Matthew William Edwards Date: Mon, 24 May 2021 13:11:52 -0700 Subject: [PATCH] Fix openr.thrift Python Module Build Summary: Add Dockerfile build for openr.thrift python module. The python module is built by: 1. Building and installing Facebook libraries with fbcode_builder 2. Building Open/R 3. Generating Cython files from thrift files with the FB thrift compiler 4. Generating C++ files from the Cython modules with the Cython compiler 5. Compiling the C++ modules into shared objects Future work for building and distributing Breeze: - Fix the hacks in build_breeze.sh, see comments therein - Use a staged Dockerfile build for the Open/R and Breeze build - Install openr.thrift. The openr.thrift shared objects are build and stored in the Docker image generated by Dockerfile, but are unused. - Install all the openr python submodules in a single openr site-package - Add cross-compilation to the openr.thrift build. This is needed for Terragraph - Upload the openr python package to PyPi Reviewed By: saifhhasan Differential Revision: D28614443 fbshipit-source-id: 38b7e7c5594fd4bb5a338f19c69e5fc3b3b95863 --- build/fbcode_builder/fbcode_builder.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/build/fbcode_builder/fbcode_builder.py b/build/fbcode_builder/fbcode_builder.py index 921517c48..5727d71be 100644 --- a/build/fbcode_builder/fbcode_builder.py +++ b/build/fbcode_builder/fbcode_builder.py @@ -414,6 +414,14 @@ class FBCodeBuilder(object): 'BUILD_SHARED_LIBS': 'ON', 'CMAKE_INSTALL_PREFIX': self.option('prefix'), } + + # Hacks to add thriftpy3 support + if 'BUILD_THRIFT_PY3' in os.environ and 'folly' in name: + cmake_defines['PYTHON_EXTENSIONS'] = 'True' + + if 'BUILD_THRIFT_PY3' in os.environ and 'fbthrift' in name: + cmake_defines['thriftpy3'] = 'ON' + cmake_defines.update( self.option('{0}:cmake_defines'.format(name), {}) )