Skip to content

Commit 3498254

Browse files
committed
Support pyston based libpython
1 parent 492b41c commit 3498254

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 0.3.14
2+
current_version = 0.3.14.1
33
commit = True
44
tag = True
55
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)((?P<release>(a|b|rc|\.dev)\d+))?

src/python_process_info.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -659,15 +659,16 @@ pub fn get_windows_python_symbols(
659659
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
660660
pub fn is_python_lib(pathname: &str) -> bool {
661661
lazy_static! {
662-
static ref RE: Regex = Regex::new(r"/libpython\d.\d\d?(m|d|u)?.so").unwrap();
662+
static ref RE: Regex = Regex::new(r"/libpython\d.\d\d?(m|d|u)?(-pyston\d.\d)?.so").unwrap();
663663
}
664664
RE.is_match(pathname)
665665
}
666666

667667
#[cfg(target_os = "macos")]
668668
pub fn is_python_lib(pathname: &str) -> bool {
669669
lazy_static! {
670-
static ref RE: Regex = Regex::new(r"/libpython\d.\d\d?(m|d|u)?.(dylib|so)$").unwrap();
670+
static ref RE: Regex =
671+
Regex::new(r"/libpython\d.\d\d?(m|d|u)?(-pyston\d.\d)?.(dylib|so)$").unwrap();
671672
}
672673
RE.is_match(pathname) || is_python_framework(pathname)
673674
}
@@ -714,7 +715,10 @@ mod tests {
714715
#[test]
715716
fn test_is_python_lib() {
716717
// libpython bundled by pyinstaller https://github.com/benfred/py-spy/issues/42
717-
assert!(is_python_lib("/tmp/_MEIOqzg01/libpython2.7.so.1.0"));
718+
assert!(is_python_lib("/usr/lib/libpython3.8-pyston2.3.so.1.0"));
719+
720+
// test pyston based libpython
721+
assert!(is_python_lib("/usr/lib/libpython2.7u.so"));
718722

719723
// test debug/malloc/unicode flags
720724
assert!(is_python_lib("./libpython2.7.so"));

0 commit comments

Comments
 (0)