Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid outputting Python files for already generated types #8500

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions src/idl_gen_python.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 0 additions & 5 deletions tests/FromInclude.py

This file was deleted.

5 changes: 0 additions & 5 deletions tests/MyGame/OtherNameSpace/FromInclude.py

This file was deleted.

5 changes: 0 additions & 5 deletions tests/MyGame/OtherNameSpace/TableB.py

This file was deleted.

5 changes: 0 additions & 5 deletions tests/MyGame/OtherNameSpace/Unused.py

This file was deleted.

Empty file.
5 changes: 0 additions & 5 deletions tests/TableA.py

This file was deleted.

Empty file removed tests/__init__.py
Empty file.