mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-02 04:04:19 +00:00
Avoid outputting Python files for already generated types (#8500)
This may overwrite types that have already been generated and can create unwanted empty files. Fixes #8490
This commit is contained in:
@@ -2686,14 +2686,11 @@ class PythonGenerator : public BaseGenerator {
|
||||
bool SaveType(const std::string &defname, const Namespace &ns,
|
||||
const std::string &classcode, const ImportMap &imports,
|
||||
const std::string &mod, bool needs_imports) const {
|
||||
if (classcode.empty()) return true;
|
||||
|
||||
std::string code = "";
|
||||
if (classcode.empty()) {
|
||||
BeginFile(LastNamespacePart(ns), false, &code, "", {});
|
||||
code += "# NOTE " + defname + " does not declare any structs or enums\n";
|
||||
} else {
|
||||
BeginFile(LastNamespacePart(ns), needs_imports, &code, mod, imports);
|
||||
code += classcode;
|
||||
}
|
||||
BeginFile(LastNamespacePart(ns), needs_imports, &code, mod, imports);
|
||||
code += classcode;
|
||||
|
||||
const std::string directories =
|
||||
parser_.opts.one_file ? path_ : namer_.Directories(ns.components);
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
# automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
# namespace: OtherNameSpace
|
||||
|
||||
# NOTE FromInclude.py does not declare any structs or enums
|
||||
@@ -1,5 +0,0 @@
|
||||
# automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
# namespace: OtherNameSpace
|
||||
|
||||
# NOTE FromInclude.py does not declare any structs or enums
|
||||
@@ -1,5 +0,0 @@
|
||||
# automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
# namespace: OtherNameSpace
|
||||
|
||||
# NOTE TableB.py does not declare any structs or enums
|
||||
@@ -1,5 +0,0 @@
|
||||
# automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
# namespace: OtherNameSpace
|
||||
|
||||
# NOTE Unused.py does not declare any structs or enums
|
||||
@@ -1,5 +0,0 @@
|
||||
# automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
# namespace:
|
||||
|
||||
# NOTE TableA.py does not declare any structs or enums
|
||||
Reference in New Issue
Block a user