Skip to content

Commit

Permalink
fix: make sure include dir is found (#974)
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
  • Loading branch information
henryiii committed May 11, 2023
1 parent 8e9eab0 commit 9c6fcaa
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 8 deletions.
8 changes: 3 additions & 5 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,13 @@ and backport changes here.
Scikit-build 0.17.4
===================

Minor release reverting a warning hide change in 0.17.3 (:pr:`960`), since it
could cause issues when using FindPythonExtensions outside of scikit-build and
could cause the include directories variable to be unset. The warning is just
going to be present in cases like manylinux builds.
A followup fix to the issue 0.17.3 tried to fix. We now have a method to
manually test downstream packages, too.

Bug fixes
---------

* Revert warning suppression :pr:`960` in :pr:`964`.
* Make sure include dir is found even if the lib is not present in :pr:`974`.

Scikit-build 0.17.3
===================
Expand Down
42 changes: 42 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import os
import sys
from pathlib import Path

import nox

Expand Down Expand Up @@ -105,3 +106,44 @@ def build_api_docs(session: nox.Session) -> None:
"--module-first",
"../skbuild",
)


@nox.session(reuse_venv=True)
def downstream(session: nox.Session) -> None:
"""
Build a downstream project.
"""

# If running in manylinux:
# docker run --rm -v $PWD:/sk -w /sk -t quay.io/pypa/manylinux2014_x86_64:latest \
# pipx run --system-site-packages nox -s downstream -- https://github.com/...
# (requires tomli, so allowing access to system-site-packages)

if sys.version_info < (3, 11):
import tomli as tomllib
else:
import tomllib

assert session.posargs, "Must pass the downstream project to build"

tmp_dir = Path(session.create_tmp())
proj_dir = tmp_dir / "git"

session.install("build", "hatch-fancy-pypi-readme", "hatch-vcs", "hatchling")
session.install(".", "--no-build-isolation")

if proj_dir.is_dir():
session.chdir(proj_dir)
session.run("git", "pull", external=True)
else:
session.run("git", "clone", *session.posargs, proj_dir, "--recurse-submodules", external=True)
session.chdir(proj_dir)

# Read and strip requirements
pyproject_toml = Path("pyproject.toml")
with pyproject_toml.open("rb") as f:
pyproject = tomllib.load(f)
requires = (x for x in pyproject["build-system"]["requires"] if "scikit-build" not in x.replace("_", "-"))
session.install(*requires)

session.run("python", "-m", "build", "--no-isolation", "--skip-dependency-check", "--wheel", ".")
11 changes: 8 additions & 3 deletions skbuild/resources/cmake/FindPythonExtensions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,6 @@
#
# .. code-block:: cmake
#
# find_package(PythonInterp)
# find_package(PythonLibs)
# find_package(PythonExtensions)
# find_package(Cython)
# find_package(Boost COMPONENTS python)
Expand Down Expand Up @@ -245,7 +243,14 @@
#=============================================================================

find_package(PythonInterp REQUIRED)
find_package(PythonLibs)
if(SKBUILD AND NOT PYTHON_LIBRARY)
set(PYTHON_LIBRARY "no-library-required")
find_package(PythonLibs)
unset(PYTHON_LIBRARY)
unset(PYTHON_LIBRARIES)
else()
find_package(PythonLibs)
endif()
include(targetLinkLibrariesWithDynamicLookup)

set(_command "
Expand Down

0 comments on commit 9c6fcaa

Please sign in to comment.