custom build of extension module
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
PBR |
Confirmed
|
Wishlist
|
Unassigned |
Bug Description
I am trying to use pbr for a python package that has an extension module that use pybind11 and its cmake-based build. The example repo setup.py, https:/
Thanks!
For completeleness, the contents of setup.py from the link above is here:
import os
import re
import sys
import platform
import subprocess
from setuptools import setup, Extension
from setuptools.
from distutils.version import LooseVersion
class CMakeExtension(
def __init__(self, name, sourcedir=''):
class CMakeBuild(
def run(self):
try:
out = subprocess.
except OSError:
raise RuntimeError("CMake must be installed to build the following extensions: " +
if platform.system() == "Windows":
if cmake_version < '3.1.0':
for ext in self.extensions:
def build_extension
extdir = os.path.
cmake_args = ['-DCMAKE_
cfg = 'Debug' if self.debug else 'Release'
build_args = ['--config', cfg]
if platform.system() == "Windows":
if sys.maxsize > 2**32:
else:
env = os.environ.copy()
if not os.path.
setup(
name=
version=
author='Dean Moldovan',
<email address hidden>',
description='A test project using pybind11 and CMake',
long_
ext_
cmdclass=
zip_safe=False,
)
A few thoughts on this:
pbr supports all of the parameters except ext_modules: https:/ /github. com/openstack- dev/pbr/ blob/master/ pbr/util. py#L96
However, even if that were implemented I'm not sure the CMake classes could live in setup.py. setup() in pbr would be called from a different module that wouldn't have local access to those classes. I'm not sure if there's a way to reference custom classes from pbr. I would think there's some way to do it, but it would require some experimentation.