From 93f133101e628a740a4c877549714b7fb49e824f Mon Sep 17 00:00:00 2001
From: Brent Huisman <brenthuisman@users.noreply.github.com>
Date: Tue, 6 Sep 2022 13:09:23 +0200
Subject: [PATCH] Move pybind11 to `/ext` (#1968)

---
 .flake8                      | 1 -
 .github/workflows/lint.yml   | 2 +-
 .gitmodules                  | 7 +++----
 doc/contrib/coding-style.rst | 2 +-
 doc/dependencies.csv         | 2 +-
 {python => ext}/pybind11     | 0
 python/CMakeLists.txt        | 4 ++--
 7 files changed, 8 insertions(+), 10 deletions(-)
 rename {python => ext}/pybind11 (100%)

diff --git a/.flake8 b/.flake8
index 253235aa..c38577d8 100644
--- a/.flake8
+++ b/.flake8
@@ -14,7 +14,6 @@ max_complexity = 15
 extend-exclude =
                # 3rd party
                ext,
-               python/pybind11,
                # auto-generated
                doc/scripts/inputs.py
                doc/scripts/make_images.py
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index d10fe4b7..fa6dbd62 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -26,7 +26,7 @@ jobs:
       - name: Python Formatting
         uses: psf/black@stable
         with:
-          options: --check --extend-exclude '/(ext|python/pybind11|doc/scripts/.*_theme|doc/scripts/inputs.py)'
+          options: --check --extend-exclude '/(ext|doc/scripts/.*_theme|doc/scripts/inputs.py)'
           src: scripts/build-catalogue.in .
       - name: Python analysis
         run: |
diff --git a/.gitmodules b/.gitmodules
index d5734673..258f3b57 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -2,10 +2,6 @@
 	path = ext/google-benchmark
 	url = https://github.com/google/benchmark
 	branch = main
-[submodule "python/pybind11"]
-	path = python/pybind11
-	url = https://github.com/pybind/pybind11.git
-	branch = master
 [submodule "ext/fmt"]
 	path = ext/fmt
 	url = https://github.com/fmtlib/fmt.git
@@ -18,3 +14,6 @@
 	path = ext/json
 	url = https://github.com/nlohmann/json.git
 	branch = master
+[submodule "ext/pybind11"]
+	path = ext/pybind11
+	url = https://github.com/pybind/pybind11.git
diff --git a/doc/contrib/coding-style.rst b/doc/contrib/coding-style.rst
index db83fce3..4283138b 100644
--- a/doc/contrib/coding-style.rst
+++ b/doc/contrib/coding-style.rst
@@ -15,7 +15,7 @@ run the following commands to apply it:
    # Install the formatter if not present
    pip install black
    # Automatically apply style. If unsure what this does read on.
-   black --extend-exclude '/(ext|python/pybind11|doc/scripts/.*_theme)' . scripts/build-catalogue.in
+   black --extend-exclude '/(ext|doc/scripts/.*_theme)' . scripts/build-catalogue.in
 
 The formatter can also be run with ``--check`` to list offending files and
 ``--diff`` to preview changes. Most editors can `integrate with black
diff --git a/doc/dependencies.csv b/doc/dependencies.csv
index f11919b4..d325bd6e 100644
--- a/doc/dependencies.csv
+++ b/doc/dependencies.csv
@@ -18,7 +18,7 @@ bench,Google-benchmark,,submodule ``ext/google-benchmark``,
 --,random123,,source copy ``ext/random123``,
 --,fmt,,submodule ``ext/fmt``,
 --,tinyopt,,source copy ``ext/tinyopt``,
-ARB_WITH_PYTHON,pybind11,,submodule ``python/pybind11``,
+ARB_WITH_PYTHON,pybind11,,submodule ``ext/pybind11``,
 ARB_WITH_PYTHON,Python,3.7,Python compatiblity is the range between the latest officially released point version and the minimum here specified.,"* it is not more advanced than the version specified by NEP 29.
 * it is available as a cray-python version on Piz Daint
 * it is available on labs.ebrains.eu
diff --git a/python/pybind11 b/ext/pybind11
similarity index 100%
rename from python/pybind11
rename to ext/pybind11
diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt
index e2d6bdb5..fd4b68e5 100644
--- a/python/CMakeLists.txt
+++ b/python/CMakeLists.txt
@@ -4,7 +4,7 @@ if(ARB_USE_BUNDLED_PYBIND11)
   include(FindPythonModule) # required for find_python_module
 
   # Set up pybind11 as an external project.
-  set(pb11_src_dir "${PROJECT_SOURCE_DIR}/python/pybind11")
+  set(pb11_src_dir "${PROJECT_SOURCE_DIR}/ext/pybind11")
   check_git_submodule(pybind11 "${pb11_src_dir}")
 
   if(NOT pybind11_avail)
@@ -14,7 +14,7 @@ if(ARB_USE_BUNDLED_PYBIND11)
   # Set up pybind11, which is used to generate Python bindings.
   # Pybind11 has good cmake support, so just add the pybind11 directory,
   # instead of using find_package.
-  add_subdirectory(pybind11)
+  add_subdirectory(${pb11_src_dir} pybind11)
 else()
   find_package(pybind11 REQUIRED)
 endif()
-- 
GitLab