-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(python,rust): build_info() provides detailed information how pol…
…ars was built (#5423)
- Loading branch information
Showing
7 changed files
with
247 additions
and
2 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/// Build script using 'built' crate to generate build info. | ||
fn main() { | ||
#[cfg(feature = "build_info")] | ||
{ | ||
extern crate built; | ||
use std::env; | ||
use std::path::Path; | ||
|
||
let src = env::var("CARGO_MANIFEST_DIR").unwrap(); | ||
let dst = Path::new(&env::var("OUT_DIR").unwrap()).join("built.rs"); | ||
let mut opts = built::Options::default(); | ||
|
||
opts.set_dependencies(true).set_compiler(true).set_env(true); | ||
|
||
built::write_built_file_with_opts(&opts, Path::new(&src), &dst) | ||
.expect("Failed to acquire build-time information"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from __future__ import annotations | ||
|
||
from typing import Any | ||
|
||
try: | ||
from polars.polars import version | ||
|
||
_version_ = version() | ||
except ImportError: | ||
_version_ = "<missing>" | ||
|
||
try: | ||
from polars.polars import _build_info_ | ||
except ImportError: | ||
_build_info_ = {} | ||
|
||
_build_info_["version"] = _version_ | ||
|
||
|
||
def build_info() -> dict[str, Any]: | ||
""" | ||
Return a dict with polars build information. | ||
If polars was compiled with "build_info" feature gate return the full build info, | ||
otherwise only version is included. The full build information dict contains | ||
the following keys ['build', 'info-time', 'dependencies', 'features', 'host', | ||
'target', 'git', 'version']. | ||
""" | ||
return _build_info_ |
Oops, something went wrong.