Skip to content

Commit 0f133ba

Browse files
Fix missing init metadata (#1251)
* fix a regression where the dunder attributes weren't being preprended to __init__.py. * Don't install Python files from cmake if building with setuptools * Don't build C++ tests if building from setuptools * Add new OTIO_INSTALL_PYTHON_MODULES CMake variable to control when to install pure Python modules/files/packages Co-authored-by: Nick Porcino <[email protected]>
1 parent f74081b commit 0f133ba

File tree

3 files changed

+20
-13
lines changed

3 files changed

+20
-13
lines changed

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ project(OpenTimelineIO VERSION ${OTIO_VERSION} LANGUAGES C CXX)
2828
option(OTIO_CXX_INSTALL "Install the C++ bindings" ON)
2929
option(OTIO_PYTHON_INSTALL "Install the Python bindings" OFF)
3030
option(OTIO_DEPENDENCIES_INSTALL "Install OTIO's C++ header dependencies (any and nonstd)" ON)
31+
option(OTIO_INSTALL_PYTHON_MODULES "Install OTIO pure Python modules/files" ON)
3132
option(OTIO_INSTALL_COMMANDLINE_TOOLS "Install the OTIO command line tools" ON)
3233
option(OTIO_INSTALL_CONTRIB "Install the opentimelineio_contrib Python package" ON)
3334
set(OTIO_PYTHON_INSTALL_DIR "" CACHE STRING "Python installation dir (such as the site-packages dir)")
@@ -75,7 +76,7 @@ if(OTIO_PYTHON_INSTALL)
7576
message(STATUS "OTIO Defaulting Python install to ${OTIO_RESOLVED_PYTHON_INSTALL_DIR}")
7677
else()
7778
# either python_install or install_prefix have been set
78-
if(OTIO_PYTHON_INSTALL_DIR_INITIALIZED_TO_DEFAULT)
79+
if(NOT OTIO_PYTHON_INSTALL_DIR)
7980
# CMAKE_INSTALL_PREFIX was set, so install the python components there
8081
set(OTIO_RESOLVED_PYTHON_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/python")
8182

setup.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ def generate_cmake_arguments(self):
9191
'-DOTIO_SHARED_LIBS:BOOL=OFF',
9292
'-DCMAKE_BUILD_TYPE=' + self.build_config,
9393
'-DOTIO_PYTHON_INSTALL_DIR=' + install_dir,
94+
# turn off the C++ tests during a Python build
95+
'-DBUILD_TESTING:BOOL=OFF',
96+
# Python modules wil be installed by setuptools.
97+
'-DOTIO_INSTALL_PYTHON_MODULES:BOOL=OFF',
9498
]
9599

96100
if platform.system() == "Windows":

src/py-opentimelineio/CMakeLists.txt

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,20 @@
44
add_subdirectory(opentime-bindings)
55
add_subdirectory(opentimelineio-bindings)
66

7-
# Install pure-python OTIO packages to match PyPI wheel structure
8-
install(DIRECTORY "${PROJECT_SOURCE_DIR}/src/py-opentimelineio/opentimelineio/"
9-
DESTINATION "${OTIO_RESOLVED_PYTHON_INSTALL_DIR}/opentimelineio")
7+
if(OTIO_INSTALL_PYTHON_MODULES)
8+
# Install pure-python OTIO packages to match PyPI wheel structure
9+
install(DIRECTORY "${PROJECT_SOURCE_DIR}/src/py-opentimelineio/opentimelineio/"
10+
DESTINATION "${OTIO_RESOLVED_PYTHON_INSTALL_DIR}/opentimelineio")
1011

11-
if(OTIO_INSTALL_COMMANDLINE_TOOLS)
12-
install(DIRECTORY "${PROJECT_SOURCE_DIR}/src/opentimelineview"
13-
DESTINATION "${OTIO_RESOLVED_PYTHON_INSTALL_DIR}")
14-
endif()
12+
if(OTIO_INSTALL_COMMANDLINE_TOOLS)
13+
install(DIRECTORY "${PROJECT_SOURCE_DIR}/src/opentimelineview"
14+
DESTINATION "${OTIO_RESOLVED_PYTHON_INSTALL_DIR}")
15+
endif()
1516

16-
if(OTIO_INSTALL_CONTRIB)
17-
install(DIRECTORY "${PROJECT_SOURCE_DIR}/contrib/opentimelineio_contrib"
18-
DESTINATION "${OTIO_RESOLVED_PYTHON_INSTALL_DIR}"
19-
PATTERN "tests" EXCLUDE
20-
PATTERN "Makefile" EXCLUDE)
17+
if(OTIO_INSTALL_CONTRIB)
18+
install(DIRECTORY "${PROJECT_SOURCE_DIR}/contrib/opentimelineio_contrib"
19+
DESTINATION "${OTIO_RESOLVED_PYTHON_INSTALL_DIR}"
20+
PATTERN "tests" EXCLUDE
21+
PATTERN "Makefile" EXCLUDE)
22+
endif()
2123
endif()

0 commit comments

Comments
 (0)