MCPcopy Create free account
hub / github.com/opencv/opencv-python / main

Function main

setup.py:13–237  ·  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 = sysconfig.get_config_var("py_version_short")
31 python_lib_path = get_python_library(python_version).replace("\\", "/")
32 python_include_dir = sysconfig.get_paths()["include"].replace("\\", "/")
33
34 if not bool(os.environ.get('OPENCV_PYTHON_SKIP_GIT_COMMANDS', False)) and os.path.exists(".git"):
35 import pip._internal.vcs.git as git
36
37 g = git.Git() # NOTE: pip API's are internal, this has to be refactored
38
39 g.run_command(["submodule", "sync"])
40
41 if build_rolling:
42 g.run_command(
43 ["submodule", "update", "--init", "--recursive", "--remote", cmake_source_dir]
44 )
45
46 if build_contrib:
47 g.run_command(
48 ["submodule", "update", "--init", "--recursive", "--remote", "opencv_contrib"]
49 )
50 else:
51 g.run_command(
52 ["submodule", "update", "--init", "--recursive", cmake_source_dir]
53 )
54
55 if build_contrib:
56 g.run_command(
57 ["submodule", "update", "--init", "--recursive", "opencv_contrib"]
58 )
59
60 package_version, build_contrib, build_headless, build_rolling = get_and_set_info(
61 build_contrib, build_headless, build_rolling, is_CI_build
62 )
63
64 # https://stackoverflow.com/questions/1405913/python-32bit-or-64bit-mode
65 is64 = sys.maxsize > 2 ** 32
66
67 package_name = "opencv_python"
68
69 if build_contrib and not build_headless:
70 package_name = "opencv_contrib_python"

Callers 1

setup.pyFile · 0.85

Calls 4

get_python_libraryFunction · 0.85
get_and_set_infoFunction · 0.85
EmptyListWithLengthClass · 0.85

Tested by

no test coverage detected