Skip to content

Commit 3495f54

Browse files
committed
Make: add hook feature to wheel-test build
1 parent 1bca411 commit 3495f54

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

build-system/luxmake/constants.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
"LUX_BUILD_TYPE",
2525
"Release",
2626
)
27+
WHEEL_HOOK = os.getenv( # Hook to execute after wheel-test build
28+
"LUX_WHEEL_HOOK",
29+
"",
30+
)
2731

2832
# Computed variables
2933
BUILD_DIR = BINARY_DIR / "build"

build-system/luxmake/wheel.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@
1111
import shutil
1212
import platform
1313
import os
14+
import shlex
1415
from pathlib import Path
1516

16-
from .constants import SOURCE_DIR, INSTALL_DIR, BINARY_DIR, WHEELHOUSE_DIR
17-
from .utils import logger, pack, fail
17+
from .constants import SOURCE_DIR, INSTALL_DIR, BINARY_DIR, WHEELHOUSE_DIR, WHEEL_HOOK
18+
from .utils import logger, pack, fail, Colors
1819
from .build import build_and_install
1920
from .windows import win_recompose
2021

@@ -69,10 +70,12 @@ def _get_lib_paths():
6970
def make_wheel(args):
7071
"""Build a wheel."""
7172
logger.warning(
73+
f"{Colors.WARNING}"
7274
"This command builds a TEST wheel, "
7375
"not fully compliant to standard "
7476
"and only intended for test. "
7577
"DO NOT USE IN PRODUCTION."
78+
f"{Colors.ENDC}"
7679
)
7780
# Build and install pyluxcore
7881
args.target = "pyluxcore"
@@ -171,3 +174,14 @@ def make_wheel(args):
171174
if platform.system() == "Windows":
172175
args.wheel = WHEELHOUSE_DIR / wheelname
173176
win_recompose(args)
177+
178+
# Finally, execute hook if exists
179+
if WHEEL_HOOK:
180+
logger.info("Executing hook: " + WHEEL_HOOK)
181+
try:
182+
result = subprocess.check_output(
183+
shlex.split(WHEEL_HOOK), text=True
184+
)
185+
except subprocess.CalledProcessError as err:
186+
fail(err)
187+
logger.info(result)

0 commit comments

Comments
 (0)