def main(): """Main processing function.""" header_variables = [] # variables in astyle.h class_variables = [] # variables in the class constructor copy_variables = [] # variables in the copy constructor header_path = libastyle.get_astyle_directory() + "/src/astyle.h" beautifier_path = libastyle.get_astyle_directory() + "/src/ASBeautifier.cpp" libastyle.set_text_color() print(libastyle.get_python_version()) get_header_variables(header_variables, header_path) get_constructor_variables(class_variables, beautifier_path) get_initializer_variables(class_variables, beautifier_path) get_copy_variables(copy_variables, beautifier_path) header_variables.sort() print("Checking ASBeautifier header to class constructor and copy constructor.") total_variables = len(header_variables) print("There are {0} variables in the header list.".format(total_variables)) print() find_class_diffs(header_variables, class_variables) find_copy_diffs(header_variables, copy_variables) if __print_variables: print(header_variables) print(class_variables) print(copy_variables)
def main(): """Read astyle.h and ASBeautifier.cpp files and check protected variables.""" header_variables = [] # protected variables in astyle.h beautifier_variables = [] # activeBeautifierStack variables in ASBeautifier.cpp header_path = libastyle.get_astyle_directory() + "/src/astyle.h" beautifier_path = libastyle.get_astyle_directory() + "/src/ASBeautifier.cpp" libastyle.set_text_color() print(libastyle.get_python_version()) get_header_variables(header_variables, header_path) get_beautifier_variables(beautifier_variables, beautifier_path) header_variables.sort() beautifier_variables.sort() print("Checking ASBeautifier protected variables to activeBeautifierStack.") total_variables = len(header_variables) print("There are {0} protected variables in the header list.".format(total_variables)) print() find_class_diffs(header_variables, beautifier_variables) if __print_variables: print(header_variables) print(beautifier_variables)
def main(): """Main processing function.""" astyle_strings = [] # _() translation strings in astyle_main.cpp test_strings = [] # test strings in TranslationF astyle_path = libastyle.get_astyle_directory() + "/src/astyle_main.cpp" if not os.path.exists(astyle_path): libastyle.system_exit("\nCannot locate file " + astyle_path) test_path = libastyle.get_astyletest_directory() + "/srcloc/AStyleTestLoc.cpp" if not os.path.exists(test_path): libastyle.system_exit("\nCannot locate file " + test_path) libastyle.set_text_color() print(libastyle.get_python_version()) get_astyle_strings(astyle_strings, astyle_path) get_test_strings(test_strings, test_path) print("Checking astyle_main strings to TranslationF.") total_astyle_strings = len(astyle_strings) print("There are {0} translated strings in astyle_main.".format(total_astyle_strings)) print() find_string_diffs(astyle_strings, test_strings) if __print_variables: astyle_strings.sort() test_strings.sort() print(astyle_strings) print(test_strings)
def main(): """Main processing function.""" header_variables = [] # header vector variables np_header_variables = [] # non-paren header variables pre_block_variables = [] # pre-block statement variables pre_command_variables = [] # pre-command header variables resource_path = libastyle.get_astyle_directory() + "/src/ASResource.cpp" libastyle.set_text_color() print(libastyle.get_python_version()) get_header_variables(header_variables, resource_path) get_np_header_variables(np_header_variables, resource_path) get_pre_block_variables(pre_block_variables, resource_path) get_pre_command_variables(pre_command_variables, resource_path) print("Checking header variables to non-paren, pre-block, and pre-command.") total_variables = len(header_variables) print("There are {0} variables in the header list.".format(total_variables)) print() find_header_diffs(header_variables, np_header_variables) find_pre_block_diffs(header_variables, pre_block_variables) find_pre_command_diffs(header_variables, pre_command_variables) if __print_variables: print(header_variables) print(np_header_variables) print(pre_block_variables) print(pre_command_variables)
def verify_astyle_executables(exe1, exe2): """Verify that the astyle test executables are available. """ # get paths exe1path = get_astyle_path(exe1) exe2path = get_astyle_path(exe2) regress1path = libastyle.get_astyle_directory() + "/regress/" + exe1 # add "exe" extension if os.name == "nt": if not exe1path.endswith(".exe"): exe1path += ".exe" if not exe2path.endswith(".exe"): exe2path += ".exe" if not regress1path.endswith(".exe"): regress1path += ".exe" # verify exe1 if not os.path.exists(exe1path): # try to copy exe1 from the "regress" directory if os.path.exists(regress1path): print("Copying " + exe1) shutil.copy(regress1path, exe1path) if not os.access(exe1path, os.X_OK): os.chmod(exe1path, stat.S_IREAD | stat.S_IWRITE | stat.S_IEXEC) else: libastyle.system_exit("Cannot find executable 1: " + exe1path) # check exe1 for most current by bumping the ending letter by 1 if not verify_current_exe1(regress1path): libastyle.system_exit("Executable 1 is not current: " + regress1path) # verify exe2 if not os.path.exists(exe2path): libastyle.system_exit("Cannot find executable 2: " + exe2path)
def verify_astyle_executables(exe1, exe2): """Verify that the astyle test executables are available. """ # get paths exe1path = get_astyle_path(exe1) exe2path = get_astyle_path(exe2) regress1path = libastyle.get_astyle_directory() + "/regress/" + exe1 # add "exe" extension if os.name == "nt": if not exe1path.endswith(".exe"): exe1path += ".exe" if not exe2path.endswith(".exe"): exe2path += ".exe" if not regress1path.endswith(".exe"): regress1path += ".exe" # verify exe1 if not os.path.exists(exe1path): # try to copy exe1 from the "regress" directory if os.path.exists(regress1path): print ("Copying " + exe1) shutil.copy(regress1path, exe1path) else: libastyle.system_exit("Cannot find executable 1: " + exe1path) # verify exe2 if not os.path.exists(exe2path): libastyle.system_exit("Cannot find executable 2: " + exe2path)
def verify_localizer_signature(): """Verify that ASLocalizer.cpp does NOT have a signature (BOM). """ localizerpath = libastyle.get_astyle_directory() + "/src/ASLocalizer.cpp" file_fd = os.open(localizerpath, os.O_RDONLY) file_bytes = os.read(file_fd, 8) if file_bytes[:3] == b"\xEF\xBB\xBF": libastyle.system_exit("\nASLocalizer.cpp must NOT have a signature") os.close(file_fd)
def main(): """Main processing function.""" header_variables = [] # variables in astyle.h class_variables = [] # variables in the class constructor header_path = libastyle.get_astyle_directory() + "/src/astyle_main.h" iterator_path = libastyle.get_astyle_directory() + "/src/astyle_main.cpp" libastyle.set_text_color("yellow") print(libastyle.get_python_version()) get_header_variables(header_variables, header_path) get_constructor_variables(class_variables, iterator_path) print("Checking ASStreamIterator header to class constructor.") total_variables = len(header_variables) print("There are {0} variables in the header list.".format(total_variables)) print() find_class_diffs(header_variables, class_variables) if __print_variables: print(header_variables) print(class_variables)
def main(): """Main processing function.""" header_variables = [] # variables in astyle.h class_variables = [] # variables in the class constructor header_path = libastyle.get_astyle_directory() + "/src/astyle_main.h" console_path = libastyle.get_astyle_directory() + "/src/astyle_main.h" libastyle.set_text_color() print(libastyle.get_python_version()) get_header_variables(header_variables, header_path) get_constructor_variables(class_variables, console_path) print("Checking ASConsole header to class constructor.") total_variables = len(header_variables) print("There are {0} variables in the header list.".format(total_variables)) print() find_class_diffs(header_variables, class_variables) if __print_variables: print(header_variables) print(class_variables)
def process_files(): """Main processing function.""" header_variables = [] # variables in astyle.h class_variables = [] # variables in the class constructor header_path = libastyle.get_astyle_directory() + "/src/astyle.h" formatter_path = libastyle.get_astyle_directory() + "/src/ASFormatter.cpp" libastyle.set_text_color() print(libastyle.get_python_version()) get_header_variables(header_variables, header_path) get_constructor_variables(class_variables, formatter_path) get_initializer_variables(class_variables, formatter_path) print("Checking ASFormatter header to class constructor.") total_variables = len(header_variables) print("There are {0} variables in the header list.".format(total_variables)) print() find_class_diffs(header_variables, class_variables) if __print_variables: print(header_variables) print(class_variables)
def main(): """ Main processing function. """ language_strings = [] # translation classes in ASLocalizer.h name_functions = [] # name test functions in AStyleTestLoc.cpp lcid_functions = [] # lcid test functions in AStyleTestLoc.cpp translate_functions = [] # lcid test functions in AStyleTestLoc.cpp localizer_path = libastyle.get_astyle_directory() + "/src/ASLocalizer.h" if not os.path.exists(localizer_path): libastyle.system_exit("\nCannot locate file " + localizer_path) test_path = libastyle.get_astyletest_directory( ) + "/srcloc/AStyleTestLoc.cpp" if not os.path.exists(test_path): libastyle.system_exit("\nCannot locate file " + test_path) libastyle.set_text_color("yellow") print(libastyle.get_python_version()) get_language_strings(language_strings, localizer_path) get_name_functions(name_functions, test_path) get_lcid_functions(lcid_functions, test_path) get_translate_functions(translate_functions, test_path) print( "Checking ASLocalizer.h classes to AStyleTestLoc.cpp test functions.") total_language_strings = len(language_strings) print("There are {0} language strings in ASLocalizer.h.".format( total_language_strings)) print() find_string_diffs(language_strings, name_functions, "name functions") find_string_diffs(language_strings, lcid_functions, "lcid functions") find_string_diffs(language_strings, translate_functions, "translate functions") if __print_variables: language_strings.sort() name_functions.sort() lcid_functions.sort() translate_functions.sort() print() print(language_strings) print() print(name_functions) print() print(lcid_functions) print() print(translate_functions)
def main(): """ Main processing function. """ language_strings = [] # translation classes in ASLocalizer.h name_functions = [] # name test functions in AStyleTestLoc.cpp lcid_functions = [] # lcid test functions in AStyleTestLoc.cpp translate_functions = [] # lcid test functions in AStyleTestLoc.cpp localizer_path = libastyle.get_astyle_directory() + "/src/ASLocalizer.h" if not os.path.exists(localizer_path): libastyle.system_exit("\nCannot locate file " + localizer_path) test_path = libastyle.get_astyletest_directory() + "/srcloc/AStyleTestLoc.cpp" if not os.path.exists(test_path): libastyle.system_exit("\nCannot locate file " + test_path) libastyle.set_text_color("yellow") print(libastyle.get_python_version()) get_language_strings(language_strings, localizer_path) get_name_functions(name_functions, test_path) get_lcid_functions(lcid_functions, test_path) get_translate_functions(translate_functions, test_path) print("Checking ASLocalizer.h classes to AStyleTestLoc.cpp test functions.") total_language_strings = len(language_strings) print("There are {0} language strings in ASLocalizer.h.".format(total_language_strings)) print() find_string_diffs(language_strings, name_functions, "name functions") find_string_diffs(language_strings, lcid_functions, "lcid functions") find_string_diffs(language_strings, translate_functions, "translate functions") if __print_variables: language_strings.sort() name_functions.sort() lcid_functions.sort() translate_functions.sort() print() print(language_strings) print() print(name_functions) print() print(lcid_functions) print() print(translate_functions)
def main(): """Main processing function.""" astyle_strings = [] # _() translation strings in astyle_main.cpp test_strings = [] # test strings in TranslationF astyle_path = libastyle.get_astyle_directory() + "/src/astyle_main.cpp" test_path = libastyle.get_astyletest_directory() + "/srci18n/AStyleTestI18n_Localizer.cpp" libastyle.set_text_color() print(libastyle.get_python_version()) get_astyle_strings(astyle_strings, astyle_path) get_test_strings(test_strings, test_path) print("Checking astyle_main strings to TranslationF.") total_astyle_strings = len(astyle_strings) print("There are {0} translated strings in astyle_main.".format(total_astyle_strings)) print() find_string_diffs(astyle_strings, test_strings) if __print_variables: astyle_strings.sort() test_strings.sort() print(astyle_strings) print(test_strings)
import glob import os import shutil import subprocess import time # local libraries import libastyle # global variables ------------------------------------------------------------ # release number for distribution file AS_RELEASE = "3.1" # inut from AStyle directory __astyle_dir = libastyle.get_astyle_directory() # output to Project directory __base_dir = libastyle.get_project_directory() # ----------------------------------------------------------------------------- def main(): """Main processing function. """ libastyle.set_text_color("yellow") print(libastyle.get_python_version()) os.chdir(libastyle.get_file_py_directory()) remove_dist_directories() verify_localizer_signature() if os.name == "nt": build_windows_distribution()
with the current line numbers. """ # to disable the print statement and use the print() function (version 3 format) from __future__ import print_function import codecs import libastyle # local directory import os import platform import subprocess # global variables ------------------------------------------------------------ __expected_version = "1.60" __src_dir = libastyle.get_astyle_directory() + "/src/" __py_dir = libastyle.get_astyletest_directory() + "/file-py/" __suppression_path = __py_dir + "cppcheck-suppress" # ----------------------------------------------------------------------------- def main(): """Main processing function. """ generate_suppression_file() run_cppcheck() # ----------------------------------------------------------------------------- def generate_suppression_file(): """ Generate the suppression file.
""" # to disable the print statement and use the print() function (version 3 format) from __future__ import print_function import codecs import os import platform import subprocess # local libraries import libastyle # global variables ------------------------------------------------------------ __expected_version = "1.74" __src_dir = libastyle.get_astyle_directory() + "/src/" __py_dir = libastyle.get_astyletest_directory() + "/file-py/" __suppression_path = __py_dir + "cppcheck-suppress" # ----------------------------------------------------------------------------- def main(): """Main processing function. """ generate_suppression_file() run_cppcheck() # ----------------------------------------------------------------------------- def generate_suppression_file(): """ Generate the suppression file.
from __future__ import print_function import glob import libastyle #local directory import os import shutil import stat import subprocess import time # global variables ------------------------------------------------------------ # release number for distribution file __release = "2.03" # inut from AStyle directory __astyle_dir = libastyle.get_astyle_directory() # output to Project directory __base_dir = libastyle.get_project_directory() # ----------------------------------------------------------------------------- def create_distributions(): """Main processing function. """ libastyle.set_text_color() print(libastyle.get_python_version()) os.chdir(libastyle.get_file_py_directory()) remove_dist_directories() if os.name == "nt": build_windows_distribution()