File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -377,6 +377,22 @@ def _classify_installed_files_override(
377
377
378
378
print ("Copying files from CMake output" )
379
379
380
+ # lines for a proper work using pylint and an autocomplete in IDE
381
+ with open ("%spython/cv2/__init__.py"
382
+ % cmake_install_dir , 'r' ) as opencv_init :
383
+ opencv_init_lines = opencv_init .readlines ()
384
+ extra_imports = 'from .cv2 import *\n globals().update(importlib.import_module("cv2.cv2").__dict__)'
385
+ free_line_after_imports = 6
386
+ opencv_init_lines .insert (free_line_after_imports , extra_imports )
387
+ opencv_init_data = ""
388
+ for line in opencv_init_lines :
389
+ opencv_init_replacement = line .replace ('importlib.import_module("cv2")' , 'importlib.import_module("cv2.cv2")' )
390
+ opencv_init_data = opencv_init_data + opencv_init_replacement
391
+
392
+ with open ("%spython/cv2/__init__.py"
393
+ % cmake_install_dir , 'w' ) as opencv_final_init :
394
+ opencv_final_init .write (opencv_init_data )
395
+
380
396
# add lines from the old __init__.py file to the config file
381
397
with open ('scripts/__init__.py' , 'r' ) as custom_init :
382
398
custom_init_data = custom_init .read ()
You can’t perform that action at this time.
0 commit comments