Skip to content
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

Handle setup with and without PYTHON3_LIMITED_API #820

Merged
merged 1 commit into from
Mar 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,14 @@ def _classify_installed_files_override(
# add lines from the old __init__.py file to the config file
with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'scripts', '__init__.py'), 'r') as custom_init:
custom_init_data = custom_init.read()
with open('%spython/cv2/config-%s.py'
% (cmake_install_dir, sys.version_info[0]), 'w') as opencv_init_config:

# OpenCV generates config with different name for case with PYTHON3_LIMITED_API=ON
config_py = os.path.join(cmake_install_dir, 'python', 'cv2', 'config-%s.%s.py'
% (sys.version_info[0], sys.version_info[1]))
if not os.path.exists(config_py):
config_py = os.path.join(cmake_install_dir, 'python', 'cv2', 'config-%s.py' % sys.version_info[0])

with open(config_py, 'w') as opencv_init_config:
opencv_init_config.write(custom_init_data)

for package_name, relpaths_re in cls.package_paths_re.items():
Expand Down