Skip to content

Commit

Permalink
#12 Stabilise class sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
kwabenantim committed Nov 13, 2024
1 parent 804751e commit 68a4db0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 1 addition & 3 deletions cppwg/info/module_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,7 @@ def compare(a: CppClassInfo, b: CppClassInfo) -> int:
cache[(b, a)] = 0
return 0

self.class_collection.sort(
key=lambda x: (os.path.dirname(x.source_file_path), x.name)
)
self.class_collection.sort(key=lambda x: x.name)

i = 0
n = len(self.class_collection)
Expand Down
8 changes: 6 additions & 2 deletions cppwg/writers/module_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,14 @@ def write_module_wrapper(self) -> None:
Example output:
```
#include <pybind11/pybind11.h> #include "Foo.cppwg.hpp"
#include <pybind11/pybind11.h>
#include "Foo.cppwg.hpp"
#include "Bar.cppwg.hpp"
PYBIND11_MODULE(_packagename_modulename, m) {
PYBIND11_MODULE(_packagename_modulename, m)
{
register_Foo_class(m);
register_Bar_class(m);
}
```
"""
Expand Down

0 comments on commit 68a4db0

Please sign in to comment.