-
Notifications
You must be signed in to change notification settings - Fork 613
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a py3-cbindings target which will eventually hold the imported c …
…types used in thrift py3 Summary: This diff adds a `cbindings.pxd` and a `py3-cbindings` target to hold it, which for now just re-exports everything defined in types.pxd, but will later hold just the [c bindings](https://www.internalfb.com/code/fbsource/[320dcea0bcbd8d29b2e978c21018d5ded6c7848d]/fbcode/thrift/compiler/generate/templates/py3/types.pxd.mustache?lines=19-35) thrift py3 uses. This is part of a migration to split out the c bindings out of `types.pxd` for the thrift python auto migrate project. 1: all cython_library targets will be codemodded to add a `py3-cbindings` dependency for each `py3-types` dependency they have 2: All cython `from .*types cimport` lines will be changed to `from .*cbindings cimport` 3: The c bindings will be split out of `types.pxd`, and `types.pxd` will be changed to depend on `cbindings.pxd`, removing the c++ dependency on python libraries import py3, when running in auto migrate mode. Reviewed By: ahilger Differential Revision: D64352295 fbshipit-source-id: 7aa76ee132066374c830a87d30204f568fd965da
- Loading branch information
1 parent
0b657c9
commit 5a9787d
Showing
69 changed files
with
970 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
thrift/compiler/generate/templates/py3/cbindings.pxd.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{{! | ||
Copyright (c) Meta Platforms, Inc. and affiliates. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
}} | ||
{{> common/auto_generated_py}} | ||
from {{#program:py3Namespaces}}{{value}}.{{/program:py3Namespaces}}{{program:name}}.types cimport ( | ||
{{#program:enums}}c{{enum:name}}, | ||
{{/program:enums}}{{! | ||
}}{{#program:filtered_structs}}c{{struct:name}}, | ||
{{/program:filtered_structs}}{{! | ||
}}{{#program:constants}}c{{constant:name}}, | ||
{{/program:constants}} | ||
) |
12 changes: 12 additions & 0 deletions
12
thrift/compiler/test/fixtures/basic-annotations/out/py3/gen-py3/module/cbindings.pxd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# | ||
# Autogenerated by Thrift for thrift/compiler/test/fixtures/basic-annotations/src/module.thrift | ||
# | ||
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING | ||
# @generated | ||
# | ||
from module.types cimport ( | ||
cMyEnum, | ||
cMyStructNestedAnnotation, | ||
cSecretStruct, | ||
cmyStruct, | ||
) |
15 changes: 15 additions & 0 deletions
15
...er/test/fixtures/basic-enum/out/py3/gen-py3/test/fixtures/enumstrict/module/cbindings.pxd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# | ||
# Autogenerated by Thrift for thrift/compiler/test/fixtures/basic-enum/src/module.thrift | ||
# | ||
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING | ||
# @generated | ||
# | ||
from test.fixtures.enumstrict.module.types cimport ( | ||
cEmptyEnum, | ||
cMyEnum, | ||
cMyUseIntrinsicDefaultEnum, | ||
cMyBigEnum, | ||
cMyStruct, | ||
ckOne, | ||
cenumNames, | ||
) |
10 changes: 10 additions & 0 deletions
10
thrift/compiler/test/fixtures/basic-stack-arguments/out/py3/gen-py3/module/cbindings.pxd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# | ||
# Autogenerated by Thrift for thrift/compiler/test/fixtures/basic-stack-arguments/src/module.thrift | ||
# | ||
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING | ||
# @generated | ||
# | ||
from module.types cimport ( | ||
cMyEnum, | ||
cMyStruct, | ||
) |
27 changes: 27 additions & 0 deletions
27
thrift/compiler/test/fixtures/basic/out/py3/gen-py3/test/fixtures/basic/module/cbindings.pxd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# | ||
# Autogenerated by Thrift for thrift/compiler/test/fixtures/basic/src/module.thrift | ||
# | ||
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING | ||
# @generated | ||
# | ||
from test.fixtures.basic.module.types cimport ( | ||
cMyEnum, | ||
cHackEnum, | ||
cMyStruct, | ||
cContainers, | ||
cMyDataItem, | ||
cMyUnion, | ||
cMyException, | ||
cMyExceptionWithMessage, | ||
cReservedKeyword, | ||
cUnionToBeRenamed, | ||
cFLAG, | ||
cOFFSET, | ||
cCOUNT, | ||
cMASK, | ||
cE, | ||
cDATE, | ||
cAList, | ||
cASet, | ||
cAMap, | ||
) |
16 changes: 16 additions & 0 deletions
16
thrift/compiler/test/fixtures/complex-union/out/py3/gen-py3/module/cbindings.pxd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# | ||
# Autogenerated by Thrift for thrift/compiler/test/fixtures/complex-union/src/module.thrift | ||
# | ||
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING | ||
# @generated | ||
# | ||
from module.types cimport ( | ||
cComplexUnion, | ||
cListUnion, | ||
cDataUnion, | ||
cVal, | ||
cValUnion, | ||
cVirtualComplexUnion, | ||
cNonCopyableStruct, | ||
cNonCopyableUnion, | ||
) |
102 changes: 102 additions & 0 deletions
102
thrift/compiler/test/fixtures/constants/out/py3/gen-py3/module/cbindings.pxd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
# | ||
# Autogenerated by Thrift for thrift/compiler/test/fixtures/constants/src/module.thrift | ||
# | ||
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING | ||
# @generated | ||
# | ||
from module.types cimport ( | ||
cEmptyEnum, | ||
cCity, | ||
cCompany, | ||
cInternship, | ||
cRange, | ||
cstruct1, | ||
cstruct2, | ||
cstruct3, | ||
cstruct4, | ||
cunion1, | ||
cunion2, | ||
cmyInt, | ||
cname, | ||
cmulti_line_string, | ||
cstates, | ||
cx, | ||
cy, | ||
cz, | ||
czeroDoubleValue, | ||
clongDoubleValue, | ||
cbin, | ||
cmy_company, | ||
cfoo, | ||
cbar, | ||
cmymap, | ||
cinstagram, | ||
cpartial_const, | ||
ckRanges, | ||
cinternList, | ||
cpod_0, | ||
cpod_s_0, | ||
cpod_1, | ||
cpod_s_1, | ||
cpod_2, | ||
cpod_trailing_commas, | ||
cpod_s_2, | ||
cpod_3, | ||
cpod_s_3, | ||
cpod_4, | ||
cu_1_1, | ||
cu_1_2, | ||
cu_1_3, | ||
cu_2_1, | ||
cu_2_2, | ||
cu_2_3, | ||
cu_2_4, | ||
cu_2_5, | ||
cu_2_6, | ||
capostrophe, | ||
ctripleApostrophe, | ||
cquotationMark, | ||
cbackslash, | ||
cescaped_a, | ||
cchar2ascii, | ||
cescaped_strings, | ||
cfalse_c, | ||
ctrue_c, | ||
czero_byte, | ||
czero16, | ||
czero32, | ||
czero64, | ||
czero_dot_zero, | ||
cempty_string, | ||
cempty_int_list, | ||
cempty_string_list, | ||
cempty_int_set, | ||
cempty_string_set, | ||
cempty_int_int_map, | ||
cempty_int_string_map, | ||
cempty_string_int_map, | ||
cempty_string_string_map, | ||
cmaxIntDec, | ||
cmaxIntOct, | ||
cmaxIntHex, | ||
cmaxIntBin, | ||
cmaxDub, | ||
cminDub, | ||
cminSDub, | ||
cmaxPIntDec, | ||
cmaxPIntOct, | ||
cmaxPIntHex, | ||
cmaxPIntBin, | ||
cmaxPDub, | ||
cminPDub, | ||
cminPSDub, | ||
cminIntDec, | ||
cminIntOct, | ||
cminIntHex, | ||
cminIntBin, | ||
cmaxNDub, | ||
cminNDub, | ||
cminNSDub, | ||
cI2B, | ||
cI2B_REF, | ||
) |
10 changes: 10 additions & 0 deletions
10
thrift/compiler/test/fixtures/empty-struct/out/py3/gen-py3/module/cbindings.pxd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# | ||
# Autogenerated by Thrift for thrift/compiler/test/fixtures/empty-struct/src/module.thrift | ||
# | ||
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING | ||
# @generated | ||
# | ||
from module.types cimport ( | ||
cEmpty, | ||
cNada, | ||
) |
17 changes: 17 additions & 0 deletions
17
thrift/compiler/test/fixtures/enums/out/py3/gen-py3/test/fixtures/enums/module/cbindings.pxd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# | ||
# Autogenerated by Thrift for thrift/compiler/test/fixtures/enums/src/module.thrift | ||
# | ||
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING | ||
# @generated | ||
# | ||
from test.fixtures.enums.module.types cimport ( | ||
cMetasyntactic, | ||
cMyEnum1, | ||
cMyEnum2, | ||
cMyEnum3, | ||
cMyEnum4, | ||
cMyBitmaskEnum1, | ||
cMyBitmaskEnum2, | ||
cSomeStruct, | ||
cMyStruct, | ||
) |
15 changes: 15 additions & 0 deletions
15
thrift/compiler/test/fixtures/exceptions/out/py3/gen-py3/module/cbindings.pxd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# | ||
# Autogenerated by Thrift for thrift/compiler/test/fixtures/exceptions/src/module.thrift | ||
# | ||
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING | ||
# @generated | ||
# | ||
from module.types cimport ( | ||
cFiery, | ||
cSerious, | ||
cComplexFieldNames, | ||
cCustomFieldNames, | ||
cExceptionWithPrimitiveField, | ||
cExceptionWithStructuredAnnotation, | ||
cBanal, | ||
) |
11 changes: 11 additions & 0 deletions
11
thrift/compiler/test/fixtures/includes/out/py3_auto_migrate/gen-py3/includes/cbindings.pxd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# | ||
# Autogenerated by Thrift for includes.thrift | ||
# | ||
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING | ||
# @generated | ||
# | ||
from includes.types cimport ( | ||
cIncluded, | ||
cExampleIncluded, | ||
cIncludedConstant, | ||
) |
9 changes: 9 additions & 0 deletions
9
thrift/compiler/test/fixtures/includes/out/py3_auto_migrate/gen-py3/module/cbindings.pxd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# | ||
# Autogenerated by Thrift for thrift/compiler/test/fixtures/includes/src/module.thrift | ||
# | ||
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING | ||
# @generated | ||
# | ||
from module.types cimport ( | ||
cMyStruct, | ||
) |
10 changes: 10 additions & 0 deletions
10
thrift/compiler/test/fixtures/includes/out/py3_auto_migrate/gen-py3/transitive/cbindings.pxd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# | ||
# Autogenerated by Thrift for transitive.thrift | ||
# | ||
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING | ||
# @generated | ||
# | ||
from transitive.types cimport ( | ||
cFoo, | ||
cExampleFoo, | ||
) |
11 changes: 11 additions & 0 deletions
11
...piler/test/fixtures/includes/out/py3_auto_migrate_includes/gen-py3/includes/cbindings.pxd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# | ||
# Autogenerated by Thrift for thrift/compiler/test/fixtures/includes/src/includes.thrift | ||
# | ||
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING | ||
# @generated | ||
# | ||
from includes.types cimport ( | ||
cIncluded, | ||
cExampleIncluded, | ||
cIncludedConstant, | ||
) |
10 changes: 10 additions & 0 deletions
10
...ler/test/fixtures/includes/out/py3_auto_migrate_includes/gen-py3/transitive/cbindings.pxd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# | ||
# Autogenerated by Thrift for transitive.thrift | ||
# | ||
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING | ||
# @generated | ||
# | ||
from transitive.types cimport ( | ||
cFoo, | ||
cExampleFoo, | ||
) |
11 changes: 11 additions & 0 deletions
11
...mpiler/test/fixtures/includes/out/py3_auto_migrate_service/gen-py3/includes/cbindings.pxd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# | ||
# Autogenerated by Thrift for includes.thrift | ||
# | ||
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING | ||
# @generated | ||
# | ||
from includes.types cimport ( | ||
cIncluded, | ||
cExampleIncluded, | ||
cIncludedConstant, | ||
) |
9 changes: 9 additions & 0 deletions
9
...compiler/test/fixtures/includes/out/py3_auto_migrate_service/gen-py3/module/cbindings.pxd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# | ||
# Autogenerated by Thrift for module.thrift | ||
# | ||
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING | ||
# @generated | ||
# | ||
from module.types cimport ( | ||
cMyStruct, | ||
) |
8 changes: 8 additions & 0 deletions
8
...ompiler/test/fixtures/includes/out/py3_auto_migrate_service/gen-py3/service/cbindings.pxd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# | ||
# Autogenerated by Thrift for thrift/compiler/test/fixtures/includes/src/service.thrift | ||
# | ||
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING | ||
# @generated | ||
# | ||
from service.types cimport ( | ||
) |
10 changes: 10 additions & 0 deletions
10
...iler/test/fixtures/includes/out/py3_auto_migrate_service/gen-py3/transitive/cbindings.pxd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# | ||
# Autogenerated by Thrift for transitive.thrift | ||
# | ||
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING | ||
# @generated | ||
# | ||
from transitive.types cimport ( | ||
cFoo, | ||
cExampleFoo, | ||
) |
10 changes: 10 additions & 0 deletions
10
...r/test/fixtures/includes/out/py3_auto_migrate_transitive/gen-py3/transitive/cbindings.pxd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# | ||
# Autogenerated by Thrift for thrift/compiler/test/fixtures/includes/src/transitive.thrift | ||
# | ||
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING | ||
# @generated | ||
# | ||
from transitive.types cimport ( | ||
cFoo, | ||
cExampleFoo, | ||
) |
11 changes: 11 additions & 0 deletions
11
...piler/test/fixtures/includes/out/py3_matching_struct_names/gen-py3/includes/cbindings.pxd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# | ||
# Autogenerated by Thrift for includes.thrift | ||
# | ||
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING | ||
# @generated | ||
# | ||
from includes.types cimport ( | ||
cIncluded, | ||
cExampleIncluded, | ||
cIncludedConstant, | ||
) |
10 changes: 10 additions & 0 deletions
10
...xtures/includes/out/py3_matching_struct_names/gen-py3/matching_struct_names/cbindings.pxd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# | ||
# Autogenerated by Thrift for thrift/compiler/test/fixtures/includes/src/matching_struct_names.thrift | ||
# | ||
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING | ||
# @generated | ||
# | ||
from matching_struct_names.types cimport ( | ||
cMyStruct, | ||
cCombo, | ||
) |
Oops, something went wrong.