mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-11 16:13:53 +00:00
6d1b197b46
* Splitting out pybind11/stl/filesystem.h.
To solve breakages like: https://github.com/deepmind/open_spiel/runs/2999582108
Mostly following the suggestion here: https://github.com/pybind/pybind11/pull/2730#issuecomment-750507575
Except using pybind11/stl/filesystem.h instead of pybind11/stlfs.h, as decided via chat.
stl.h restored to the exact state before merging PR #2730 via:
```
git checkout 733f8de24f
stl.h
```
* Properly including new stl subdirectory in pip wheel config.
This now passes interactively:
```
pytest tests/extra_python_package/
```
* iwyu cleanup.
iwyuh.py -c -std=c++17 -DPYBIND11_TEST_BOOST -Ipybind11/include -I/usr/include/python3.9 -I/usr/include/eigen3 include/pybind11/stl/filesystem.h
* Adding PYBIND11_HAS_FILESYSTEM_IS_OPTIONAL.
* Eliminating else after return.
66 lines
1.9 KiB
Python
66 lines
1.9 KiB
Python
#!/usr/bin/env python
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# Setup script for pybind11-global (in the sdist or in tools/setup_global.py in the repository)
|
|
# This package is targeted for easy use from CMake.
|
|
|
|
import contextlib
|
|
import glob
|
|
import os
|
|
import re
|
|
import shutil
|
|
import subprocess
|
|
import sys
|
|
import tempfile
|
|
|
|
# Setuptools has to be before distutils
|
|
from setuptools import setup
|
|
|
|
from distutils.command.install_headers import install_headers
|
|
|
|
class InstallHeadersNested(install_headers):
|
|
def run(self):
|
|
headers = self.distribution.headers or []
|
|
for header in headers:
|
|
# Remove pybind11/include/
|
|
short_header = header.split("/", 2)[-1]
|
|
|
|
dst = os.path.join(self.install_dir, os.path.dirname(short_header))
|
|
self.mkpath(dst)
|
|
(out, _) = self.copy_file(header, dst)
|
|
self.outfiles.append(out)
|
|
|
|
|
|
main_headers = glob.glob("pybind11/include/pybind11/*.h")
|
|
detail_headers = glob.glob("pybind11/include/pybind11/detail/*.h")
|
|
stl_headers = glob.glob("pybind11/include/pybind11/stl/*.h")
|
|
cmake_files = glob.glob("pybind11/share/cmake/pybind11/*.cmake")
|
|
headers = main_headers + detail_headers + stl_headers
|
|
|
|
cmdclass = {"install_headers": InstallHeadersNested}
|
|
$extra_cmd
|
|
|
|
# This will _not_ affect installing from wheels,
|
|
# only building wheels or installing from SDist.
|
|
# Primarily intended on Windows, where this is sometimes
|
|
# customized (for example, conda-forge uses Library/)
|
|
base = os.environ.get("PYBIND11_GLOBAL_PREFIX", "")
|
|
|
|
# Must have a separator
|
|
if base and not base.endswith("/"):
|
|
base += "/"
|
|
|
|
setup(
|
|
name="pybind11_global",
|
|
version="$version",
|
|
packages=[],
|
|
headers=headers,
|
|
data_files=[
|
|
(base + "share/cmake/pybind11", cmake_files),
|
|
(base + "include/pybind11", main_headers),
|
|
(base + "include/pybind11/detail", detail_headers),
|
|
(base + "include/pybind11/stl", stl_headers),
|
|
],
|
|
cmdclass=cmdclass,
|
|
)
|