Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6b73d90

Browse filesBrowse files
authored
Merge pull request opencv#820 from asmorkalov/as/config_py_path
Handle setup with and without PYTHON3_LIMITED_API
2 parents f9de34e + e10f83d commit 6b73d90
Copy full SHA for 6b73d90

File tree

1 file changed

+8
-2
lines changed
Filter options

1 file changed

+8
-2
lines changed

‎setup.py

Copy file name to clipboardExpand all lines: setup.py
+8-2Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,8 +395,14 @@ def _classify_installed_files_override(
395395
# add lines from the old __init__.py file to the config file
396396
with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'scripts', '__init__.py'), 'r') as custom_init:
397397
custom_init_data = custom_init.read()
398-
with open('%spython/cv2/config-%s.py'
399-
% (cmake_install_dir, sys.version_info[0]), 'w') as opencv_init_config:
398+
399+
# OpenCV generates config with different name for case with PYTHON3_LIMITED_API=ON
400+
config_py = os.path.join(cmake_install_dir, 'python', 'cv2', 'config-%s.%s.py'
401+
% (sys.version_info[0], sys.version_info[1]))
402+
if not os.path.exists(config_py):
403+
config_py = os.path.join(cmake_install_dir, 'python', 'cv2', 'config-%s.py' % sys.version_info[0])
404+
405+
with open(config_py, 'w') as opencv_init_config:
400406
opencv_init_config.write(custom_init_data)
401407

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

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.