Skip to content

Commit

Permalink
Removed useless lines and added replacing lines into init file
Browse files Browse the repository at this point in the history
  • Loading branch information
asenyaev committed Oct 18, 2021
1 parent 545fe24 commit 851182f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
5 changes: 3 additions & 2 deletions scripts/__init__.py
@@ -1,5 +1,6 @@
from .cv2 import *
from .data import *
PYTHON_EXTENSIONS_PATHS = [
LOADER_DIR
] + PYTHON_EXTENSIONS_PATHS

ci_and_not_headless = False

Expand Down
13 changes: 1 addition & 12 deletions setup.py
Expand Up @@ -376,22 +376,11 @@ def _classify_installed_files_override(

print("Copying files from CMake output")

# need for the proper import of a package
with open('%spython/cv2/__init__.py'
% cmake_install_dir, 'r') as opencv_init:
opencv_init_data = ""
for line in opencv_init:
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_python_init:
opencv_python_init.write(opencv_init_data)

# add lines from the old __init__.py file to the config file
with open('scripts/__init__.py', 'r') as custom_init:
custom_init_data = custom_init.read()
with open('%spython/cv2/config-%s.%s.py'
% (cmake_install_dir, sys.version_info[0], sys.version_info[1]), 'a') as opencv_init_config:
% (cmake_install_dir, sys.version_info[0], sys.version_info[1]), 'w') as opencv_init_config:
opencv_init_config.write(custom_init_data)

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

0 comments on commit 851182f

Please sign in to comment.