e955c94ed3
Listing the "Blender Foundation" as copyright holder implied the Blender Foundation holds copyright to files which may include work from many developers. While keeping copyright on headers makes sense for isolated libraries, Blender's own code may be refactored or moved between files in a way that makes the per file copyright holders less meaningful. Copyright references to the "Blender Foundation" have been replaced with "Blender Authors", with the exception of `./extern/` since these this contains libraries which are more isolated, any changed to license headers there can be handled on a case-by-case basis. Some directories in `./intern/` have also been excluded: - `./intern/cycles/` it's own `AUTHORS` file is planned. - `./intern/opensubdiv/`. An "AUTHORS" file has been added, using the chromium projects authors file as a template. Design task: #110784 Ref !110783.
74 lines
2.1 KiB
Python
74 lines
2.1 KiB
Python
#!/usr/bin/env python3
|
|
# SPDX-FileCopyrightText: 2023 Blender Authors
|
|
#
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
|
import unittest
|
|
|
|
|
|
def sliceCommandLineArguments():
|
|
"""
|
|
Slice command line arguments by -- argument.
|
|
"""
|
|
|
|
import sys
|
|
|
|
try:
|
|
double_shasl_index = sys.argv.index("--")
|
|
except ValueError:
|
|
unittest_args = sys.argv[:]
|
|
parser_args = []
|
|
else:
|
|
unittest_args = sys.argv[:double_shasl_index]
|
|
parser_args = sys.argv[double_shasl_index + 1:]
|
|
|
|
return unittest_args, parser_args
|
|
|
|
|
|
def parseArguments():
|
|
import argparse
|
|
|
|
# Construct argument parser.
|
|
parser = argparse.ArgumentParser(description="Static binary checker")
|
|
parser.add_argument('directory', help='Directories to check')
|
|
# Parse arguments which are not handled by unit testing framework.
|
|
unittest_args, parser_args = sliceCommandLineArguments()
|
|
args = parser.parse_args(args=parser_args)
|
|
# TODO(sergey): Run some checks here?
|
|
return args
|
|
|
|
|
|
def runScriptInBlender(blender_directory, script):
|
|
"""
|
|
Run given script inside Blender and check non-zero exit code
|
|
"""
|
|
|
|
import os
|
|
import subprocess
|
|
|
|
blender = os.path.join(blender_directory, "blender")
|
|
python = os.path.join(os.path.dirname(__file__), "scripts", script) + ".py"
|
|
|
|
command = (blender,
|
|
"-b",
|
|
"--factory-startup",
|
|
"--python-exit-code", "1",
|
|
"--python", python)
|
|
|
|
process = subprocess.Popen(command,
|
|
shell=False,
|
|
stdout=subprocess.PIPE,
|
|
stderr=subprocess.STDOUT)
|
|
output, error = process.communicate()
|
|
return process.returncode == 0
|
|
|
|
|
|
class SceiptUnitTesting(unittest.TestCase):
|
|
def checkScript(self, script):
|
|
# Parse arguments which are not handled by unit testing framework.
|
|
args = parseArguments()
|
|
# Perform actual test,
|
|
self.assertTrue(runScriptInBlender(args.directory, script),
|
|
"Failed to run script {}" . format(script))
|