-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use --config-settings instead of deprecated --global-option #7171
Changes from all commits
4f734d2
18da2d0
8780772
2d0b13b
38d6386
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,56 @@ | ||||||||||||
import sys | ||||||||||||
|
||||||||||||
from setuptools.build_meta import * # noqa: F401, F403 | ||||||||||||
hugovk marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||
from setuptools.build_meta import build_wheel | ||||||||||||
|
||||||||||||
backend_class = build_wheel.__self__.__class__ | ||||||||||||
|
||||||||||||
|
||||||||||||
class _CustomBuildMetaBackend(backend_class): | ||||||||||||
def run_setup(self, setup_script="setup.py"): | ||||||||||||
if self.config_settings: | ||||||||||||
|
||||||||||||
def config_has(key, value): | ||||||||||||
settings = self.config_settings.get(key) | ||||||||||||
if settings: | ||||||||||||
if not isinstance(settings, list): | ||||||||||||
settings = [settings] | ||||||||||||
return value in settings | ||||||||||||
|
||||||||||||
flags = [] | ||||||||||||
for dependency in ( | ||||||||||||
"zlib", | ||||||||||||
"jpeg", | ||||||||||||
"tiff", | ||||||||||||
"freetype", | ||||||||||||
"raqm", | ||||||||||||
"lcms", | ||||||||||||
"webp", | ||||||||||||
"webpmux", | ||||||||||||
"jpeg2000", | ||||||||||||
"imagequant", | ||||||||||||
"xcb", | ||||||||||||
): | ||||||||||||
if config_has(dependency, "enable"): | ||||||||||||
flags.append("--enable-" + dependency) | ||||||||||||
elif config_has(dependency, "disable"): | ||||||||||||
flags.append("--disable-" + dependency) | ||||||||||||
for dependency in ("raqm", "fribidi"): | ||||||||||||
if config_has(dependency, "vendor"): | ||||||||||||
flags.append("--vendor-" + dependency) | ||||||||||||
if self.config_settings.get("platform-guessing") == "disable": | ||||||||||||
flags.append("--disable-platform-guessing") | ||||||||||||
if self.config_settings.get("debug") == "true": | ||||||||||||
flags.append("--debug") | ||||||||||||
if flags: | ||||||||||||
sys.argv = sys.argv[:1] + ["build_ext"] + flags + sys.argv[1:] | ||||||||||||
return super().run_setup(setup_script) | ||||||||||||
|
||||||||||||
def build_wheel( | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @hugovk @radarhere this omits There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've attempted to add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like the build script calls something different from what's called on the main branch: I see "Running command Getting requirements to build editable" vs. "Running command Getting requirements to build wheel". The former is from your log, the latter is from the main branch. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I added 2446fd8 to test editable installing on GHA. For some reason, it seems the include paths are not passed in properly when building editable on Windows (specifically the OpenJpeg path is found and added for part of the build, but not all of it). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, interesting, I didn't see where it's defined. It's often hard to distinguish outputs of different commands if they are squashed in the same CI step, so I tend to recommend putting each command in a separate step or using the corresponding shell's capabilities to improve such logging. I also recently saw a case where Powershell would proceed to execute commands after the previous ones fail. Anyway, this may indicate dependency on some weird pre-existing state. One way of exploring GHA jobs is https://github.com/marketplace/actions/debugging-with-tmate, by the way. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I should have mentioned that it also fails for me locally. It's the first command in that step that is failing, the second one just runs a simple test. Lines 687 to 691 in 41e45b5
From the GHA log, it looks almost as if it first does a regular build, then a second build again skipping that method, but I'm not sure why or where to look. Yes, I have used tmate before. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've created #7658 for this. |
||||||||||||
self, wheel_directory, config_settings=None, metadata_directory=None | ||||||||||||
): | ||||||||||||
self.config_settings = config_settings | ||||||||||||
return super().build_wheel(wheel_directory, config_settings, metadata_directory) | ||||||||||||
|
||||||||||||
|
||||||||||||
build_wheel = _CustomBuildMetaBackend().build_wheel |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[build-system] | ||
requires = ["setuptools >= 40.8.0", "wheel"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @radarhere @hugovk There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This has since been removed in #7248. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, I should've checked. Thanks! |
||
build-backend = "backend" | ||
backend-path = ["_custom_build"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got to the conclusion that it's also nice to configure coverage through the config setting. Here's an example of the interface I ended up with: https://yarl.aio-libs.org/en/latest/changes/#released-versions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're already providing
make install-coverage
. I don't see the need to provide yet another way of enabling coverage.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I see. Just thought it's less integrated into the Python interfaces, but into tooling of external ecosystems.