From 8cb031a47fe8a9a9072723140f0c3ab2858ac751 Mon Sep 17 00:00:00 2001 From: Andrey Senyaev Date: Fri, 12 Nov 2021 17:37:03 +0300 Subject: [PATCH] Changed a string substitution to os.path.join --- setup.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index 27e61933..2fe7fc21 100644 --- a/setup.py +++ b/setup.py @@ -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') @@ -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