Skip to content

Commit

Permalink
Changed a string substitution to os.path.join
Browse files Browse the repository at this point in the history
  • Loading branch information
asenyaev committed Nov 12, 2021
1 parent b6e1ec8 commit 8cb031a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions setup.py
Expand Up @@ -378,8 +378,7 @@ def _classify_installed_files_override(
print("Copying files from CMake output")

# lines for a proper work using pylint and an autocomplete in IDE
with open("%spython/cv2/__init__.py"
% cmake_install_dir, 'r') as opencv_init:
with open(os.path.join(cmake_install_dir, "python", "cv2", "__init__.py"), 'r') as opencv_init:
opencv_init_lines = opencv_init.readlines()
extra_imports = ('\nfrom .cv2 import *\nfrom .cv2 import _registerMatType\nfrom . import mat_wrapper\nfrom . import gapi'
'\nfrom . import misc\nfrom . import utils\nfrom . import data\n')
Expand All @@ -390,8 +389,7 @@ def _classify_installed_files_override(
opencv_init_replacement = line.replace('importlib.import_module("cv2")', 'importlib.import_module("cv2.cv2")')
opencv_init_data = opencv_init_data + opencv_init_replacement

with open("%spython/cv2/__init__.py"
% cmake_install_dir, 'w') as opencv_final_init:
with open(os.path.join(cmake_install_dir, "python", "cv2", "__init__.py"), 'w') as opencv_final_init:
opencv_final_init.write(opencv_init_data)

# add lines from the old __init__.py file to the config file
Expand Down

0 comments on commit 8cb031a

Please sign in to comment.