From 3086eea9c6b73cbd1e8daaf310f11c10770d7c0d Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Thu, 12 Sep 2024 23:17:17 -0500 Subject: [PATCH 1/7] build: Remove manual CGAL install * Remove the manual download of CGAL from setup.py. * Remove '--with-cgaldir' autogen.sh flag as CGAL should be installed in a location by the package managers or user that it is findable. --- .gitignore | 3 --- setup.py | 15 --------------- 2 files changed, 18 deletions(-) diff --git a/.gitignore b/.gitignore index fa91a4c6..0adb767f 100644 --- a/.gitignore +++ b/.gitignore @@ -172,6 +172,3 @@ cython_debug/ *.exe *.out *.app - -# Build dependencies -CGAL* diff --git a/setup.py b/setup.py index 56971382..674dd72e 100644 --- a/setup.py +++ b/setup.py @@ -15,14 +15,10 @@ import subprocess import sys import sysconfig -import urllib.request -import zipfile import setuptools.command.build_ext import setuptools.command.install -CGAL_ZIP = "https://github.com/CGAL/cgal/releases/download/v5.6/CGAL-5.6-library.zip" - DIR = pathlib.Path(__file__).parent.resolve() FASTJET = DIR / "extern" / "fastjet-core" FASTJET_CONTRIB = DIR / "extern" / "fastjet-contrib" @@ -56,16 +52,6 @@ def get_version() -> str: class FastJetBuild(setuptools.command.build_ext.build_ext): def build_extensions(self): if not OUTPUT.exists(): - zip_filename = DIR / pathlib.Path(CGAL_ZIP).parts[-1] - - with urllib.request.urlopen(CGAL_ZIP) as http_obj: - with open(zip_filename, "wb") as file_obj: - shutil.copyfileobj(http_obj, file_obj) - - with zipfile.ZipFile(zip_filename) as zip_obj: - cgal_dir = DIR / zip_obj.namelist()[0] - zip_obj.extractall(DIR) - # Patch for segfault of LimitedWarning # For more info see https://github.com/scikit-hep/fastjet/pull/131 subprocess.run( @@ -92,7 +78,6 @@ def build_extensions(self): "--enable-allcxxplugins", "--enable-cgal-header-only", "--enable-cgal", - f"--with-cgaldir={cgal_dir}", "--enable-swig", "--enable-pyext", f'LDFLAGS={env["LDFLAGS"]}', From 309e6984546ef6b3252e5c6715968aead6fa4aeb Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Thu, 12 Sep 2024 23:48:01 -0500 Subject: [PATCH 2/7] build: Add manual CGAL install for Linux cibuildwheel * The cibuildwheel Linux container is CentOS 7 based, but CGAL is not packaged for CentOS with yum --- only for apt-get, Homebrew, and conda-forge. For Linux cibuildwheel builds this then requires that the CGAL headers (CGLA is header only) need to be manually downloaded from GitHub and then copied into /usr/include/. --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index fad0ad45..4288a697 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,6 +20,9 @@ before-all = [ "curl -L https://boostorg.jfrog.io/artifactory/main/release/1.84.0/source/boost_1_84_0.tar.bz2 -o boost_1_84_0.tar.bz2", "tar --bzip2 -xf boost_1_84_0.tar.bz2", "mv boost_1_84_0/boost /usr/include/boost", + "curl -LO https://github.com/CGAL/cgal/releases/download/v5.6.1/CGAL-5.6.1-library.zip", + "unzip -q CGAL-5.6.1-library.zip", + "mv CGAL-5.6.1/include/CGAL /usr/include/", ] # Skip musllinux builds for the moment skip = "*-musllinux_*" From bcf5d479473b9b5f63853954722797e89f84a68b Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Fri, 13 Sep 2024 00:27:58 -0500 Subject: [PATCH 3/7] chore: Simplify boost source download for Linux cibuildwheel --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 4288a697..4d1cfdf8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,7 +17,7 @@ manylinux-i686-image = "manylinux2014" before-all = [ "yum update -y", "yum install -y mpfr-devel", - "curl -L https://boostorg.jfrog.io/artifactory/main/release/1.84.0/source/boost_1_84_0.tar.bz2 -o boost_1_84_0.tar.bz2", + "curl -LO https://boostorg.jfrog.io/artifactory/main/release/1.84.0/source/boost_1_84_0.tar.bz2", "tar --bzip2 -xf boost_1_84_0.tar.bz2", "mv boost_1_84_0/boost /usr/include/boost", "curl -LO https://github.com/CGAL/cgal/releases/download/v5.6.1/CGAL-5.6.1-library.zip", From 7d4791cc6d433d02d2117fa8534d06cb9cda3d6b Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Thu, 12 Sep 2024 23:22:55 -0500 Subject: [PATCH 4/7] docs: Add libcgal-dev install to README * Add libcgal-dev to the required packages to install for Linux based development. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 78f5e8e0..2fa5e6cc 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ To install the build-time dependencies run the following installation commands f ### Debian/Ubuntu ``` bash -sudo apt-get update && sudo apt-get install -y libboost-dev libmpfr-dev libgmp-dev swig autoconf libtool +sudo apt-get update && sudo apt-get install -y libboost-dev libcgal-dev libmpfr-dev libgmp-dev swig autoconf libtool ``` ## Build and install From e0c06d1668c4b9fa34731dbeb9f25a3c676d7ed8 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Thu, 12 Sep 2024 23:23:09 -0500 Subject: [PATCH 5/7] ci: Add cgal install to CI * Use package managers to install libcgal-dev (Linux) and cgal (macOS) in CI jobs. --- .cirrus.yml | 1 + .github/workflows/ci.yml | 8 +++++--- .github/workflows/wheels.yml | 6 ++++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 1b680ba4..56ec5ced 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -20,6 +20,7 @@ task: gcc \ g++ \ libboost-dev \ + libcgal-dev \ libmpfr-dev \ libgmp-dev \ swig \ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e36aef5e..31986aea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,12 +48,14 @@ jobs: - name: Install compiler tools on macOS if: runner.os == 'macOS' run: | - brew install make automake swig gmp mpfr boost + brew install make automake swig gmp mpfr boost cgal export PATH="/usr/local/opt/make/libexec/gnubin:$PATH" - name: Install extra deps on Linux if: runner.os == 'Linux' - run: sudo apt-get update && sudo apt-get install -y libboost-dev libmpfr-dev swig autoconf libtool + run: | + sudo apt-get update + sudo apt-get install -y libboost-dev libcgal-dev libmpfr-dev swig autoconf libtool - name: Install package run: | @@ -89,7 +91,7 @@ jobs: - name: Install compiler tools on macOS if: runner.os == 'macOS' run: | - brew install make automake swig mpfr boost + brew install make automake swig mpfr boost cgal export PATH="/usr/local/opt/make/libexec/gnubin:$PATH" - name: Clone gmp diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 703eb050..8d80a2b6 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -62,7 +62,7 @@ jobs: - name: Install compiler tools on macOS if: runner.os == 'macOS' run: | - brew install make automake swig mpfr boost + brew install make automake swig mpfr boost cgal export PATH="/usr/local/opt/make/libexec/gnubin:$PATH" - name: Clone gmp @@ -112,7 +112,9 @@ jobs: - name: Install extra deps on Linux if: runner.os == 'Linux' - run: sudo apt-get update && sudo apt-get install -y libboost-dev swig autoconf libtool + run: | + sudo apt-get update + sudo apt-get install -y libboost-dev libcgal-dev swig autoconf libtool - name: test sdist run: python -m pip install dist/*.tar.gz From 363f100450ec9e0c8c9edc9e6880c72924f74464 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Mon, 16 Sep 2024 18:53:54 -0500 Subject: [PATCH 6/7] build: Remove '--enable-cgal' option as not compatible with '--enable-cgal-header-only' From `./configure --help`: ``` --enable-cgal enables link with the CGAL library default=no --enable-cgal-header-only enable build with header-only install of CGAL, e.g. as for CGALv5; in that case do not use --enable-cgal default=no ``` --- setup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.py b/setup.py index 674dd72e..f8b1f5d4 100644 --- a/setup.py +++ b/setup.py @@ -77,7 +77,6 @@ def build_extensions(self): "--disable-auto-ptr", "--enable-allcxxplugins", "--enable-cgal-header-only", - "--enable-cgal", "--enable-swig", "--enable-pyext", f'LDFLAGS={env["LDFLAGS"]}', From 90d61377aa971441d784e9d9760b458b760b1f0b Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Tue, 17 Sep 2024 15:02:19 -0500 Subject: [PATCH 7/7] Revert "build: Remove '--enable-cgal' option as not compatible with '--enable-cgal-header-only'" This reverts commit 363f100450ec9e0c8c9edc9e6880c72924f74464. --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index f8b1f5d4..674dd72e 100644 --- a/setup.py +++ b/setup.py @@ -77,6 +77,7 @@ def build_extensions(self): "--disable-auto-ptr", "--enable-allcxxplugins", "--enable-cgal-header-only", + "--enable-cgal", "--enable-swig", "--enable-pyext", f'LDFLAGS={env["LDFLAGS"]}',