From d9e5cf17e48a73185f17dd7f224af93bb3963ec0 Mon Sep 17 00:00:00 2001 From: messense Date: Fri, 24 Jun 2022 09:15:01 +0800 Subject: [PATCH] Warn about `Binding.Exec` with `script=True` deprecation --- CHANGELOG.md | 6 ++++++ setuptools_rust/extension.py | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ecf9ff4..2700e8eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ ### Packaging - Increase minimum `setuptools` version to 62.4. [#222](https://github.com/PyO3/setuptools-rust/pull/246) +### Changed +- `Exec` binding `RustExtension` with `script=True` is deprecated in favor of `RustBin`. [#248](https://github.com/PyO3/setuptools-rust/pull/248) + +### Added +- Add `RustBin` for packaging binaries in scripts data directory. [#248](https://github.com/PyO3/setuptools-rust/pull/248) + ### Fixed - If the sysconfig for `BLDSHARED` has no flags, `setuptools-rust` won't crash anymore. [#241](https://github.com/PyO3/setuptools-rust/pull/241) diff --git a/setuptools_rust/extension.py b/setuptools_rust/extension.py index 01a3e207..41cfd089 100644 --- a/setuptools_rust/extension.py +++ b/setuptools_rust/extension.py @@ -1,6 +1,7 @@ import json import os import re +import warnings import subprocess from distutils.errors import DistutilsSetupError from enum import IntEnum, auto @@ -152,6 +153,12 @@ def __init__( self._cargo_metadata: Optional[_CargoMetadata] = None + if binding == Binding.Exec and script: + warnings.warn( + "'Binding.Exec' with 'script=True' is deprecated, use 'RustBin' instead.", + DeprecationWarning, + ) + def get_lib_name(self) -> str: """Parse Cargo.toml to get the name of the shared library.""" metadata = self._metadata()