Skip to content

Commit

Permalink
Merge pull request #1668 from messense/drop-pypy3.8
Browse files Browse the repository at this point in the history
Drop PyPy 3.8 from test jobs
  • Loading branch information
messense authored Jun 18, 2023
2 parents a4322ad + 421f7a6 commit 492372d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ jobs:
- '3.9'
- '3.10'
- '3.11'
- 'pypy3.8'
- 'pypy3.9'
- 'pypy3.10'
Expand Down Expand Up @@ -361,12 +360,12 @@ jobs:
container: ghcr.io/messense/manylinux2014-cross:s390x
# PyPy
- target: aarch64-unknown-linux-gnu
abi: pp37-pypy37_pp73
python: pypy3.7
abi: pp39-pypy39_pp73
python: pypy3.9
container: ghcr.io/messense/manylinux2014-cross:aarch64
- target: aarch64-unknown-linux-gnu
abi: pp38-pypy38_pp73
python: pypy3.8
abi: pp310-pypy310_pp73
python: pypy3.10
container: ghcr.io/messense/manylinux2014-cross:aarch64
steps:
- uses: actions/checkout@v3
Expand Down
22 changes: 12 additions & 10 deletions src/cross_compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ fn ends_with(entry: &DirEntry, pat: &str) -> bool {
///
/// [1]: https://github.com/python/cpython/blob/3.5/Lib/sysconfig.py#L389
pub fn find_sysconfigdata(lib_dir: &Path, target: &Target) -> Result<PathBuf> {
let sysconfig_paths = search_lib_dir(lib_dir, target);
let sysconfig_paths = search_lib_dir(lib_dir, target)?;
let sysconfig_name = env::var_os("_PYTHON_SYSCONFIGDATA_NAME");
let mut sysconfig_paths = sysconfig_paths
.iter()
Expand Down Expand Up @@ -147,7 +147,7 @@ pub fn find_sysconfigdata(lib_dir: &Path, target: &Target) -> Result<PathBuf> {
}

/// recursive search for _sysconfigdata, returns all possibilities of sysconfigdata paths
fn search_lib_dir(path: impl AsRef<Path>, target: &Target) -> Vec<PathBuf> {
fn search_lib_dir(path: impl AsRef<Path>, target: &Target) -> Result<Vec<PathBuf>> {
let mut sysconfig_paths = vec![];
let (cpython_version_pat, pypy_version_pat) = if let Some(v) =
env::var_os("PYO3_CROSS_PYTHON_VERSION").map(|s| s.into_string().unwrap())
Expand All @@ -156,10 +156,10 @@ fn search_lib_dir(path: impl AsRef<Path>, target: &Target) -> Vec<PathBuf> {
} else {
("python3.".into(), "pypy3.".into())
};
for f in fs::read_dir(path.as_ref()).expect("Path does not exist") {
for f in fs::read_dir(path.as_ref())? {
let sysc = match &f {
Ok(f) if starts_with(f, "_sysconfigdata") && ends_with(f, "py") => vec![f.path()],
Ok(f) if starts_with(f, "build") => search_lib_dir(f.path(), target),
Ok(f) if starts_with(f, "build") => search_lib_dir(f.path(), target)?,
Ok(f) if starts_with(f, "lib.") => {
let name = f.file_name();
// check if right target os
Expand All @@ -173,14 +173,16 @@ fn search_lib_dir(path: impl AsRef<Path>, target: &Target) -> Vec<PathBuf> {
{
continue;
}
search_lib_dir(f.path(), target)
search_lib_dir(f.path(), target)?
}
Ok(f) if starts_with(f, &cpython_version_pat) => search_lib_dir(f.path(), target),
Ok(f) if starts_with(f, &cpython_version_pat) => search_lib_dir(f.path(), target)?,
// PyPy 3.7: /opt/python/pp37-pypy37_pp73/lib_pypy/_sysconfigdata__linux_x86_64-linux-gnu.py
Ok(f) if starts_with(f, "lib_pypy") => search_lib_dir(f.path(), target),
Ok(f) if starts_with(f, "lib_pypy") => search_lib_dir(f.path(), target)?,
// PyPy 3.8: /opt/python/pp38-pypy38_pp73/lib/pypy3.8/_sysconfigdata__linux_x86_64-linux-gnu.py
Ok(f) if starts_with(f, &pypy_version_pat) => search_lib_dir(f.path(), target),
Ok(f) if starts_with(f, "lib") && f.path().is_dir() => search_lib_dir(f.path(), target),
Ok(f) if starts_with(f, &pypy_version_pat) => search_lib_dir(f.path(), target)?,
Ok(f) if starts_with(f, "lib") && f.path().is_dir() => {
search_lib_dir(f.path(), target)?
}
_ => continue,
};
sysconfig_paths.extend(sysc);
Expand All @@ -205,5 +207,5 @@ fn search_lib_dir(path: impl AsRef<Path>, target: &Target) -> Vec<PathBuf> {
sysconfig_paths = temp;
}
}
sysconfig_paths
Ok(sysconfig_paths)
}

0 comments on commit 492372d

Please sign in to comment.