Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[opencv4] Adjust/correct python path replacements #43817

Open
Neumann-A opened this issue Feb 13, 2025 · 0 comments
Open

[opencv4] Adjust/correct python path replacements #43817

Neumann-A opened this issue Feb 13, 2025 · 0 comments
Labels
category:port-feature The issue is with a library, which is requesting new capabilities that didn’t exist

Comments

@Neumann-A
Copy link
Contributor

Is your feature request related to a problem? Please describe.

Currently the opencv4 port does the following:

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/${PYTHON3_SITE}/cv2/typing")
file(GLOB PYTHON3_SITE_FILES "${CURRENT_PACKAGES_DIR}/${PYTHON3_SITE}/cv2/*.py")
foreach(PYTHON3_SITE_FILE ${PYTHON3_SITE_FILES})
  vcpkg_replace_string("${PYTHON3_SITE_FILE}"
    "os.path.join('${CURRENT_PACKAGES_DIR}'"
    "os.path.join('.'"
    IGNORE_UNCHANGED
  )
  vcpkg_replace_string("${PYTHON3_SITE_FILE}"
    "os.path.join('${CURRENT_PACKAGES_DIR}/${PYTHON3_SITE}/cv2'"
    "os.path.join('.'"
    IGNORE_UNCHANGED
  )
endforeach()

Whoever replacing any path here with . seems incorrect to me. What should be done is change the path so that they are relative to the current script file instead.

The replacement also does not take care about external absolute paths like:

BINARIES_PATHS = [
    os.path.join('.', 'bin'),
    os.path.join(os.getenv('CUDA_PATH', 'D:/vcpkg_folders/no_msvc/installed/x64-windows/share/CUDAToolkit/../../compiler/cuda'), 'bin')
] + BINARIES_PATHS

observed in <packages>\tools\python3\Lib\site-packages\cv2\config.py

Proposed solution

Adjust the paths relativ to the file they are in.

Describe alternatives you've considered

No response

Additional context

No response

@Neumann-A Neumann-A added the category:port-feature The issue is with a library, which is requesting new capabilities that didn’t exist label Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:port-feature The issue is with a library, which is requesting new capabilities that didn’t exist
Projects
None yet
Development

No branches or pull requests

1 participant