Skip to content

Commit de32dc9

Browse files
style: pre-commit fixes
1 parent 0ad2868 commit de32dc9

File tree

2 files changed

+34
-37
lines changed

2 files changed

+34
-37
lines changed

bindings/CMakeLists.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,4 @@ install(
7373
DESTINATION .)
7474

7575
# Generate Python stubs as a post-install step
76-
install(
77-
SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/generate_stubs.cmake
78-
COMPONENT pylib)
76+
install(SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/generate_stubs.cmake COMPONENT pylib)

bindings/generate_stubs.cmake

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,57 @@
1-
# CMake script to generate Python stubs during installation
2-
# This runs as a post-install step to generate .pyi files
1+
# CMake script to generate Python stubs during installation This runs as a
2+
# post-install step to generate .pyi files
33

44
message(STATUS "Generating Python stubs for pyslang...")
55

66
# Find Python executable
7-
find_package(Python COMPONENTS Interpreter REQUIRED)
7+
find_package(
8+
Python
9+
COMPONENTS Interpreter
10+
REQUIRED)
811

9-
# Check if we're in a wheel build (CMAKE_INSTALL_PREFIX will be set to wheel staging directory)
12+
# Check if we're in a wheel build (CMAKE_INSTALL_PREFIX will be set to wheel
13+
# staging directory)
1014
if(DEFINED ENV{DESTDIR})
11-
set(INSTALL_DIR "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}")
15+
set(INSTALL_DIR "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}")
1216
else()
13-
set(INSTALL_DIR "${CMAKE_INSTALL_PREFIX}")
17+
set(INSTALL_DIR "${CMAKE_INSTALL_PREFIX}")
1418
endif()
1519

1620
message(STATUS "Install directory: ${INSTALL_DIR}")
1721

1822
# Try to install pybind11-stubgen if not available
1923
execute_process(
20-
COMMAND ${Python_EXECUTABLE} -c "import pybind11_stubgen"
21-
RESULT_VARIABLE STUBGEN_CHECK
22-
OUTPUT_QUIET
23-
ERROR_QUIET
24-
)
24+
COMMAND ${Python_EXECUTABLE} -c "import pybind11_stubgen"
25+
RESULT_VARIABLE STUBGEN_CHECK
26+
OUTPUT_QUIET ERROR_QUIET)
2527

2628
if(NOT STUBGEN_CHECK EQUAL 0)
27-
message(STATUS "Installing pybind11-stubgen...")
28-
execute_process(
29-
COMMAND ${Python_EXECUTABLE} -m pip install pybind11-stubgen
30-
RESULT_VARIABLE PIP_RESULT
31-
OUTPUT_QUIET
32-
ERROR_QUIET
33-
)
29+
message(STATUS "Installing pybind11-stubgen...")
30+
execute_process(
31+
COMMAND ${Python_EXECUTABLE} -m pip install pybind11-stubgen
32+
RESULT_VARIABLE PIP_RESULT
33+
OUTPUT_QUIET ERROR_QUIET)
3434
endif()
3535

36-
# Generate stubs
37-
# Add install dir to Python path so it can import the module
36+
# Generate stubs Add install dir to Python path so it can import the module
3837
set(ENV{PYTHONPATH} "${INSTALL_DIR}:$ENV{PYTHONPATH}")
3938

4039
execute_process(
41-
COMMAND ${Python_EXECUTABLE} -m pybind11_stubgen pyslang -o "${INSTALL_DIR}" --root-suffix ""
42-
WORKING_DIRECTORY ${INSTALL_DIR}
43-
RESULT_VARIABLE STUBGEN_RESULT
44-
OUTPUT_VARIABLE STUBGEN_OUTPUT
45-
ERROR_VARIABLE STUBGEN_ERROR
46-
)
40+
COMMAND ${Python_EXECUTABLE} -m pybind11_stubgen pyslang -o "${INSTALL_DIR}"
41+
--root-suffix ""
42+
WORKING_DIRECTORY ${INSTALL_DIR}
43+
RESULT_VARIABLE STUBGEN_RESULT
44+
OUTPUT_VARIABLE STUBGEN_OUTPUT
45+
ERROR_VARIABLE STUBGEN_ERROR)
4746

4847
if(STUBGEN_RESULT EQUAL 0)
49-
message(STATUS "Successfully generated stubs")
50-
# Verify stub file exists
51-
if(EXISTS "${INSTALL_DIR}/pyslang/__init__.pyi")
52-
message(STATUS "Stub file created: ${INSTALL_DIR}/pyslang/__init__.pyi")
53-
else()
54-
message(WARNING "Stub file not found after generation")
55-
endif()
48+
message(STATUS "Successfully generated stubs")
49+
# Verify stub file exists
50+
if(EXISTS "${INSTALL_DIR}/pyslang/__init__.pyi")
51+
message(STATUS "Stub file created: ${INSTALL_DIR}/pyslang/__init__.pyi")
52+
else()
53+
message(WARNING "Stub file not found after generation")
54+
endif()
5655
else()
57-
message(WARNING "Failed to generate stubs: ${STUBGEN_ERROR}")
56+
message(WARNING "Failed to generate stubs: ${STUBGEN_ERROR}")
5857
endif()

0 commit comments

Comments
 (0)