@@ -195,10 +195,9 @@ def entry_points(self) -> List[str]:
195195 entry_points = []
196196 if self .script and self .binding == Binding .Exec :
197197 for executable , mod in self .target .items ():
198- if "." in mod :
199- base_mod , name = mod .rsplit ("." )
200- script = "%s=%s.%s:run" % (name , base_mod , _script_name (executable ))
201- entry_points .append (script )
198+ base_mod , name = mod .rsplit ("." )
199+ script = "%s=%s.%s:run" % (name , base_mod , _script_name (executable ))
200+ entry_points .append (script )
202201
203202 return entry_points
204203
@@ -231,6 +230,59 @@ def _uses_exec_binding(self) -> bool:
231230 return self .binding == Binding .Exec
232231
233232
233+ class RustBin (RustExtension ):
234+ """Used to define a Rust binary and its build configuration.
235+
236+ Args:
237+ target: Rust binary target name.
238+ path: Path to the ``Cargo.toml`` manifest file.
239+ args: A list of extra arguments to be passed to Cargo. For example,
240+ ``args=["--no-default-features"]`` will disable the default
241+ features listed in ``Cargo.toml``.
242+ features: A list of Cargo features to also build.
243+ rustc_flags: A list of additional flags passed to rustc.
244+ rust_version: Minimum Rust compiler version required for this
245+ extension.
246+ quiet: Suppress Cargo's output.
247+ debug: Controls whether ``--debug`` or ``--release`` is passed to
248+ Cargo. If set to `None` (the default) then build type is
249+ automatic: ``inplace`` build will be a debug build, ``install``
250+ and ``wheel`` builds will be release.
251+ strip: Strip symbols from final file. Does nothing for debug build.
252+ native: Build extension or executable with ``--target-cpu=native``.
253+ """
254+
255+ def __init__ (
256+ self ,
257+ target : str ,
258+ path : str = "Cargo.toml" ,
259+ args : Optional [List [str ]] = None ,
260+ features : Optional [List [str ]] = None ,
261+ rustc_flags : Optional [List [str ]] = None ,
262+ rust_version : Optional [str ] = None ,
263+ quiet : bool = False ,
264+ debug : Optional [bool ] = None ,
265+ strip : Strip = Strip .No ,
266+ native : bool = False ,
267+ ):
268+ super ().__init__ (
269+ target ,
270+ path ,
271+ args ,
272+ features ,
273+ rustc_flags ,
274+ rust_version ,
275+ quiet ,
276+ debug ,
277+ binding = Binding .Exec ,
278+ strip = strip ,
279+ native = native ,
280+ )
281+
282+ def entry_points (self ) -> List [str ]:
283+ return []
284+
285+
234286_CargoMetadata = NewType ("_CargoMetadata" , Dict [str , Any ])
235287
236288
0 commit comments