Skip to content

Commit

Permalink
oups
Browse files Browse the repository at this point in the history
  • Loading branch information
xgarnaud committed Mar 19, 2024
1 parent 13bb93d commit cdbffb2
Showing 1 changed file with 14 additions and 19 deletions.
33 changes: 14 additions & 19 deletions _custom_build/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,24 @@
import sys
from setuptools.build_meta import build_wheel, build_editable

FEATURES = ["meshb", "metis", "scotch", "nlopt"]
FEATURES = ["meshb", "nlopt"]

def uptate_argv(config_settings):
if config_settings:
flags = []
if config_settings.get("debug", "false").lower() == "true":
flags += ["--debug"]
for feature in FEATURES:
if config_settings.get(feature, "false").lower() == "true":
flags += ["--features=%s"%feature]
if flags:
sys.argv = sys.argv[:1] + ["build_rust"] + flags + sys.argv[1:]

backend_class = build_wheel.__self__.__class__

class _CustomBuildMetaBackend(backend_class):
def run_setup(self, setup_script="setup.py"):
if self.config_settings:
flags = []
if self.config_settings.get("debug", "false").lower() == "true":
flags += ["--debug"]
for feature in FEATURES:
if self.config_settings.get(feature, "false").lower() == "true":
flags += ["--features=%s"%feature]
if flags:
sys.argv = sys.argv[:1] + ["build_rust"] + flags + sys.argv[1:]
uptate_argv(self.config_settings)
return super().run_setup(setup_script)

def build_wheel(
Expand All @@ -32,15 +35,7 @@ def build_wheel(

class _CustomBuildMetaBackend(backend_class):
def run_setup(self, setup_script="setup.py"):
if self.config_settings:
flags = []
if self.config_settings.get("debug", "false").lower() == "true":
flags += ["--debug"]
for feature in FEATURES:
if self.config_settings.get(feature, "false").lower() == "true":
flags += ["--features=%s"%feature]
if flags:
sys.argv = sys.argv[:1] + ["build_rust"] + flags + sys.argv[1:]
uptate_argv(self.config_settings)
return super().run_setup(setup_script)

def build_editable(
Expand Down

0 comments on commit cdbffb2

Please sign in to comment.