Skip to content

How can I pass arguments into setup.py? #1789

@mcleantom

Description

@mcleantom

Description

A library I am trying to build wheels for, you need to pass in the boost root directory like so:

python3 setup.py build_ext --boost-root=/path/to/boost

I am adding boost by doing:

name: Upload test python package

on:
  push:
    branches:
      - master

env:
  CIBW_PROJECT_REQUIRES_PYTHON: ">=3.8"

jobs:
  build_wheels:
    name: Build wheels on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
       os: [ubuntu-20.04]
    steps:
      - name: Install boost
        if: ${{ runner.os == 'Windows' || runner.os == 'macOS' }}
        uses: MarkusJx/[email protected]
        id: install-boost
        with:
          boost_version: 1.79.0
          boost_install_dir: ${{ matrix.boost_install_dir }}
      - uses: actions/checkout@v3
      - uses: actions/setup-python@v3
      - name: Install cibuildwheel
        run: python -m pip install cibuildwheel==2.14.1
      - name: Build wheels
        run: python -m cibuildwheel --output-dir wheelhouse
        env:
          CIBW_BEFORE_BUILD: python -m pip install cmake
          CIBW_BEFORE_BUILD_LINUX: echo $BOOST_ROOT
          COBW_BEFORE_ALL_LINUX: >
            yum install -y wget &&
            cd / && mkdir boost && cd boost &&
            wget --no-check-certificate 'https://sourceforge.net/projects/boost/files/boost/1.79.0/boost_1_79_0.tar.bz2' && 
            tar xf boost_1_79_0.tar.bz2 &&
            cd {package}
          CIBW_ENVIRONMENT_WINDOWS: BOOST_ROOT='${{ steps.install-boost.outputs.BOOST_ROOT }}'
          CIBW_ENVIRONMENT_MACOS: BOOST_ROOT='${{ steps.install-boost.outputs.BOOST_ROOT }}'
          CIBW_ENVRIONMENT_LINUX: PIP_GLOBAL_OPTION="--boost-root=/boost"
          CIBW_ENVIRONMENT_PASS_LINUX: BOOST_ROOT
      - uses: actions/upload-artifact@v3
        with:
          path: ./wheelhouse/*.whl

I think from the docs, this should pass in arguments:

CIBW_ENVRIONMENT_LINUX: PIP_GLOBAL_OPTION="--boost-root=/boost"

Is this correct? My version of cibuildwheel is not finding boost (or python, but that can be a separate issue)

        -- Could NOT find Python3 (missing: Python3_LIBRARIES Development Development.Embed) (found version "3.8.17")
        CMake Error at /opt/_internal/pipx/venvs/cmake/lib/python3.10/site-packages/cmake/data/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
          Could NOT find Boost (missing: Boost_INCLUDE_DIR) (Required is at least
          version "1.79")

Any help would be appreciated, thanks.

For reference, my repo is https://github.com/mcleantom/pangeo-pyinterp

Build log

https://github.com/mcleantom/pangeo-pyinterp/actions/runs/8254883117/job/22580063074

CI config

https://github.com/mcleantom/pangeo-pyinterp/blob/master/.github/workflows/pypipublishtest.yaml

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions