MCPcopy Index your code
hub / github.com/opencv/opencv-python / main

Function main

setup.py:13–316  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

11
12
13def main():
14 os.chdir(os.path.dirname(os.path.abspath(__file__)))
15
16 CI_BUILD = os.environ.get("CI_BUILD", "False")
17 is_CI_build = True if CI_BUILD == "1" else False
18 cmake_source_dir = "opencv"
19 minimum_supported_numpy = "1.13.3"
20 build_contrib = get_build_env_var_by_name("contrib")
21 build_headless = get_build_env_var_by_name("headless")
22 build_java = "ON" if get_build_env_var_by_name("java") else "OFF"
23 build_rolling = get_build_env_var_by_name("rolling")
24
25 install_requires = [
26 'numpy<2.0; python_version<"3.9"',
27 'numpy>=2; python_version>="3.9"',
28 ]
29
30 python_version = cmaker.CMaker.get_python_version()
31 python_lib_path = cmaker.CMaker.get_python_library(python_version) or ""
32 # HACK: For Scikit-build 0.17.3 and newer that returns None or empty sptring for PYTHON_LIBRARY in manylinux2014
33 # A small release related to PYTHON_LIBRARY handling changes in 0.17.2; scikit-build 0.17.3 returns an empty string from get_python_library if no Python library is present (like on manylinux), where 0.17.2 returned None, and previous versions returned a non-existent path. Note that adding REQUIRED to find_package(PythonLibs will fail, but it is incorrect (you must not link to libPython.so) and was really just injecting a non-existent path before.
34 # TODO: Remove the hack when the issue is handled correctly in main OpenCV CMake.
35 if python_lib_path == "":
36 python_lib_path = "libpython%sm.a" % python_version
37 python_lib_path = python_lib_path.replace("\\", "/")
38
39 python_include_dir = cmaker.CMaker.get_python_include_dir(python_version).replace(
40 "\\", "/"
41 )
42
43 if not bool(os.environ.get('OPENCV_PYTHON_SKIP_GIT_COMMANDS', False)) and os.path.exists(".git"):
44 import pip._internal.vcs.git as git
45
46 g = git.Git() # NOTE: pip API's are internal, this has to be refactored
47
48 g.run_command(["submodule", "sync"])
49
50 if build_rolling:
51 g.run_command(
52 ["submodule", "update", "--init", "--recursive", "--remote", cmake_source_dir]
53 )
54
55 if build_contrib:
56 g.run_command(
57 ["submodule", "update", "--init", "--recursive", "--remote", "opencv_contrib"]
58 )
59 else:
60 g.run_command(
61 ["submodule", "update", "--init", "--recursive", cmake_source_dir]
62 )
63
64 if build_contrib:
65 g.run_command(
66 ["submodule", "update", "--init", "--recursive", "opencv_contrib"]
67 )
68
69 package_version, build_contrib, build_headless, build_rolling = get_and_set_info(
70 build_contrib, build_headless, build_rolling, is_CI_build

Callers 1

setup.pyFile · 0.85

Calls 4

get_and_set_infoFunction · 0.85
EmptyListWithLengthClass · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…