Skip to content

Commit 574b3bf

Browse files
author
Martin Larralde
committed
Make sure tomlgen_rust works for manually defined extensions
1 parent cd0dbc3 commit 574b3bf

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

setuptools_rust/tomlgen.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,11 @@ def build_cargo_toml(self, ext):
128128
# The directory where the extension's manifest is located
129129
tomldir = os.path.dirname(ext.path)
130130

131+
# If the RustExtension was not created by `find_rust_extensions`
132+
# the `lib.rs` file is expected to be located near `Cargo.toml`
133+
if not hasattr(ext, 'libfile'):
134+
ext.libfile = ext.path.replace('Cargo.toml', 'lib.rs')
135+
131136
# Create a small package section
132137
toml.add_section("package")
133138
toml.set("package", "name", quote(ext.name))

0 commit comments

Comments
 (0)