mirror of
https://github.com/vee1e/flatbuffers.git
synced 2026-09-02 02:07:25 +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:
parent
a2916d37e7
commit
dfd92124aa
8 changed files with 4 additions and 32 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue