Content-Length: 279522 | pFad | http://github.com/opencv/opencv-python/commit/053e8cc1c80b573ab2d55f0babf609f778902ead

5E Merge pull request #579 from asenyaev/asen/fix_pylin_and_pycharm · opencv/opencv-python@053e8cc · GitHub
Skip to content

Commit 053e8cc

Browse files
authored
Merge pull request #579 from asenyaev/asen/fix_pylin_and_pycharm
Added lines for a proper work using pylint and an autocomplete in IDE
2 parents 7319276 + 8cb031a commit 053e8cc

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

setup.py

+15
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,21 @@ def _classify_installed_files_override(
377377

378378
print("Copying files from CMake output")
379379

380+
# lines for a proper work using pylint and an autocomplete in IDE
381+
with open(os.path.join(cmake_install_dir, "python", "cv2", "__init__.py"), 'r') as opencv_init:
382+
opencv_init_lines = opencv_init.readlines()
383+
extra_imports = ('\nfrom .cv2 import *\nfrom .cv2 import _registerMatType\nfrom . import mat_wrapper\nfrom . import gapi'
384+
'\nfrom . import misc\nfrom . import utils\nfrom . import data\n')
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(os.path.join(cmake_install_dir, "python", "cv2", "__init__.py"), 'w') as opencv_final_init:
393+
opencv_final_init.write(opencv_init_data)
394+
380395
# add lines from the old __init__.py file to the config file
381396
with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'scripts', '__init__.py'), 'r') as custom_init:
382397
custom_init_data = custom_init.read()

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/opencv/opencv-python/commit/053e8cc1c80b573ab2d55f0babf609f778902ead

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy