-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Labels
kind/bugSomething isn't working as expectedSomething isn't working as expectedstatus/triageThis issue needs to be triagedThis issue needs to be triaged
Description
- I am on the latest stable Poetry version, installed using a recommended method.
- I have searched the issues of this repo and believe that this is not a duplicate.
- I have consulted the FAQ and blog for any relevant entries or release notes.
- If an exception occurs when executing a command, I executed it again in debug mode (
-vvv
option) and have included the output below.
Issue
Trying to switch to the lighter poetry-core
for building wheels, but the build
function is not executed inside the build.py
file.
Using poetry.core
as the build backend, I will only see Build File Imported
(custom print statements in build.py
) and neither build
function is called.
However if I switch the build system back to the old method of just poetry
:
[build-system]
requires = ["poetry", "Cython", "setuptools", "wheel"]
build-backend = "poetry.masonry.api"
Everything will work fine when I run pip wheel . -v
and show both:
Build File Imported
Build with Cython
build.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from setuptools.command.build_ext import build_ext
from pathlib import Path
import shutil
root = Path(__file__).parent
print("Build File Imported")
def copy_files():
# Why does poetry put include files at the root of site-packages? So bad! Copy them inside the package
shutil.copy(root / "AUTHORS.rst", root / "box" / "AUTHORS.rst")
shutil.copy(root / "CHANGES.rst", root / "box" / "CHANGES.rst")
shutil.copy(root / "LICENSE", root / "box" / "LICENSE")
shutil.copy(root / "box_logo.png", root / "box" / "box_logo.png")
try:
from Cython.Build import cythonize
except ImportError:
# Got to provide this function. Otherwise, poetry will fail
def build(setup_kwargs):
print("Build without Cython")
copy_files()
# Cython is installed. Compile
else:
# This function will be executed in setup.py:
def build(setup_kwargs):
print("Build with Cython")
copy_files()
# Build
setup_kwargs.update(
{
"ext_modules": cythonize(
[
str(file.relative_to(root))
for file in Path(root, "box").glob("*.py")
if file.name != "__init__.py"
],
compiler_directives={"language_level": 3},
),
}
)
Package itself is https://github.com/cdgriffith/Box/blob/master/pyproject.toml and issue brought up by cdgriffith/Box#244
TrakJohnson
Metadata
Metadata
Assignees
Labels
kind/bugSomething isn't working as expectedSomething isn't working as expectedstatus/triageThis issue needs to be triagedThis issue needs to be triaged