-
Notifications
You must be signed in to change notification settings - Fork 960
Add abi3-py* features #1263
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
Add abi3-py* features #1263
Changes from 3 commits
597119d
93282e9
eae0d86
1b83850
6da6bc9
4914372
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,10 @@ use std::{ | |
| str::FromStr, | ||
| }; | ||
|
|
||
| const PY3_MIN_MINOR: u8 = 5; | ||
| /// Minimum required Python version. | ||
| const PY3_MIN_MINOR: u8 = 6; | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not related to this PR, but we dropped 3.5 support in #1250. |
||
| /// Maximum Python version that can be used as minimum required Python version with abi3. | ||
| const ABI3_MAX_MINOR: u8 = 9; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Binaries trying to link against a higher python version than the actual installed (And even worse, only extension modules on linux - because on windows they always link!) This would mean that an extension module which uses the |
||
| const CFG_KEY: &str = "py_sys_config"; | ||
|
|
||
| type Result<T> = std::result::Result<T, Box<dyn std::error::Error>>; | ||
|
|
@@ -770,12 +773,25 @@ fn configure(interpreter_config: &InterpreterConfig) -> Result<String> { | |
| bail!("Python 2 is not supported"); | ||
| } | ||
|
|
||
| if env::var_os("CARGO_FEATURE_ABI3").is_some() { | ||
| let minor = if env::var_os("CARGO_FEATURE_ABI3").is_some() { | ||
| println!("cargo:rustc-cfg=Py_LIMITED_API"); | ||
| } | ||
| // Check any `abi3-py3*` feature is set. If not, use the interpreter version. | ||
| let abi3_minor = (PY3_MIN_MINOR..=ABI3_MAX_MINOR) | ||
| .find(|i| env::var_os(format!("CARGO_FEATURE_ABI3_PY3{}", i)).is_some()); | ||
| match (abi3_minor, interpreter_config.version.minor) { | ||
| (Some(abi3_minor), Some(interpreter_minor)) if abi3_minor > interpreter_minor => bail!( | ||
| "You cannot set a mininimum Python version {} higher than the interpreter version {}", | ||
| abi3_minor, | ||
| interpreter_minor | ||
| ), | ||
| _ => abi3_minor.or(interpreter_config.version.minor), | ||
| } | ||
| } else { | ||
| interpreter_config.version.minor | ||
| }; | ||
|
|
||
| if let Some(minor) = interpreter_config.version.minor { | ||
| for i in 6..=minor { | ||
| if let Some(minor) = minor { | ||
| for i in PY3_MIN_MINOR..=minor { | ||
| println!("cargo:rustc-cfg=Py_3_{}", i); | ||
| flags += format!("CFG_Py_3_{},", i).as_ref(); | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.