Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'build_files/cmake/project_source_info.py')
-rw-r--r--build_files/cmake/project_source_info.py46
1 files changed, 40 insertions, 6 deletions
diff --git a/build_files/cmake/project_source_info.py b/build_files/cmake/project_source_info.py
index c4b83d20ea5..c636d778aaa 100644
--- a/build_files/cmake/project_source_info.py
+++ b/build_files/cmake/project_source_info.py
@@ -27,7 +27,6 @@ __all__ = (
)
import os
-import sys
from os.path import join, dirname, normpath, abspath
SOURCE_DIR = join(dirname(__file__), "..", "..")
@@ -40,11 +39,6 @@ def is_c_header(filename):
return (ext in (".h", ".hpp", ".hxx"))
-def is_c_header(filename):
- ext = os.path.splitext(filename)[1]
- return (ext in (".h", ".hpp", ".hxx"))
-
-
def is_c(filename):
ext = os.path.splitext(filename)[1]
return (ext in (".c", ".cpp", ".cxx", ".m", ".mm", ".rc"))
@@ -79,6 +73,7 @@ def do_ignore(filepath, ignore_prefix_list):
def makefile_log():
import subprocess
+ import time
# Check blender is not 2.5x until it supports playback again
print("running make with --dry-run ...")
process = subprocess.Popen(["make", "--always-make", "--dry-run", "--keep-going", "VERBOSE=1"],
@@ -153,6 +148,45 @@ def build_info(use_c=True, use_cxx=True, ignore_prefix_list=None):
return source
+# could be moved elsewhere!, this just happens to be used by scripts that also
+# use this module.
+def queue_processes(process_funcs, job_total=-1):
+ """ Takes a list of function arg pairs, each function must return a process
+ """
+ import sys
+
+ if job_total == -1:
+ import multiprocessing
+ job_total = multiprocessing.cpu_count()
+ del multiprocessing
+
+ if job_total == 1:
+ for func, args in process_funcs:
+ sys.stdout.flush()
+ sys.stderr.flush()
+
+ process = func(*args)
+ process.wait()
+ else:
+ import time
+
+ processes = []
+ for func, args in process_funcs:
+ # wait until a thread is free
+ while 1:
+ processes[:] = [p for p in processes if p.poll() is None]
+
+ if len(processes) <= job_total:
+ break
+ else:
+ time.sleep(0.1)
+
+ sys.stdout.flush()
+ sys.stderr.flush()
+
+ processes.append(func(*args))
+
+
def main():
if not os.path.exists(join(CMAKE_DIR, "CMakeCache.txt")):
print("This script must run from the cmake build dir")