Esempio n. 1
0
def main():
    """Main processing function.
	"""
    # initialization
    libastyle.set_text_color()
    print(libastyle.get_python_version())
    verify_os()
    exepath = "C:/Windows/AppPatch/AppLoc.exe"
    i18npath = __builddir + "/bin/AStyleTestI18nd.exe"
    # verify files
    if not os.path.exists(exepath):
        libastyle.system_exit("AppLoc not installed: " + exepath)
    build_testi18n_executable()

    # for some reason the subprocess call must be one long statement and quoted as follows???
    # the country LCID is added by the subprocess call
    command = exepath + ' ' + i18npath + ' ' + "\"--terse_printer --no_close\"" + ' '
    # run tests
    print("\nWAIT for a test to finish before running the next")
    print("Reply OK to continue ...")
    print("Running Greek Test")
    subprocess.call(command + "/L0408")
    time.sleep(2)  # must finish before running the next test
    print("Running Japanese Test")
    subprocess.call(command + "/L0411")
    time.sleep(2)  # must finish before running the next test
    print("Running Russian Test")
    subprocess.call(command + "/L0419")
    time.sleep(2)  # must finish before running the next test
Esempio n. 2
0
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)
Esempio n. 3
0
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)
Esempio n. 4
0
def process_files():
    """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)
Esempio n. 5
0
def main():
    """Main processing function.
    """
    files = []
    totfiles = 0
    testfile = "test.txt"
    sharpfile = "test-csharp.txt"

    # initialization
    libastyle.set_text_color()
    os.chdir(libastyle.get_file_py_directory())
    if not os.path.exists(testfile):
        libastyle.system_exit(
            "Run regression2-test.py to create " + testfile)
    print(libastyle.get_python_version())
    print("extracting C# test data")

    # process formatted files
    files = libtest.get_formatted_files(testfile)
    outfile = open(sharpfile, 'w')
    for filepath in files:
        filepath = filepath.replace('\\', '/')  # replace file separators
        filepath = '\"' + filepath + '\",'      # add quotes to filepath
        outfile.write(filepath + '\n')
        totfiles += 1
    outfile.close()
    print ("saved " + sharpfile)
    print("files extracted " + str(totfiles))
    formatted, unused, unused, unused = libtest.get_astyle_totals(testfile)
    if totfiles != formatted:
        libastyle.system_exit(
            "totals not equal {0} {1}".format(totfiles, formatted))
Esempio n. 6
0
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)
Esempio n. 7
0
def main():
    """Main processing function."""

    astyle_strings = []         # _() translation strings in astyle_main.cpp
    test_strings = []           # test strings in AStyleTestLoc.cpp
    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("yellow")
    print(libastyle.get_python_version())
    get_astyle_strings(astyle_strings, astyle_path)
    get_test_strings(test_strings, test_path)

    # remove duplicate entries in astyle_strings from Linux and Windows functions
    astyle_strings = set(astyle_strings)
    astyle_strings = list(astyle_strings)
    print("Checking astyle_main strings to TranslationF.")
    total_astyle_strings = len(astyle_strings)
    print("There are {0} unique 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()
        print(astyle_strings)
        print()
        print(test_strings)
Esempio n. 8
0
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)
Esempio n. 9
0
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)
Esempio n. 10
0
def process_files():
	"""Main processing function.
	"""
	# initialization
	libastyle.set_text_color()
	print (libastyle.get_python_version())
	verify_os()
	build_testi18n_executable()

	# for some reason the subprocess call must be one long statement and quoted as follows???
	# the country LCID is added by the subprocess call
	exepath = "C:/Windows/AppPatch/AppLoc.exe"
	i18npath = builddir + "/debug/AStyleTestI18nd.exe"
	command = exepath + ' ' + i18npath + ' ' + "\"--terse_printer --no_close\"" + ' '

	# run tests
	print ("\nWAIT for a test to finish before running the next")
	print ("Reply OK to continue ...")
	print ("Running Greek Test")
	subprocess.call(command + "/L0408")
	time.sleep(2)		# must finish before running the next test
	print ("Running Japanese Test")
	subprocess.call(command + "/L0411")
	time.sleep(2)		# must finish before running the next test
	print ("Running Russian Test")
	subprocess.call(command + "/L0419")
	time.sleep(2)		# must finish before running the next test
Esempio n. 11
0
def main():
    """Main processing function.
    """
    files = []
    totfiles = 0
    testfile = "test.txt"
    sharpfile = "test-csharp.txt"

    # initialization
    libastyle.set_text_color("yellow")
    os.chdir(libastyle.get_file_py_directory())
    if not os.path.exists(testfile):
        libastyle.system_exit("Run regression2-test.py to create " + testfile)
    print(libastyle.get_python_version())
    print("extracting C# test data")

    # process formatted files
    files = libtest.get_formatted_files(testfile)
    outfile = open(sharpfile, 'w')
    for filepath in files:
        filepath = filepath.replace('\\', '/')  # replace file separators
        filepath = '\"' + filepath + '\",'  # add quotes to filepath
        outfile.write(filepath + '\n')
        totfiles += 1
    outfile.close()
    print("saved " + sharpfile)
    print("files extracted " + str(totfiles))
    formatted, unused, unused, unused = libtest.get_astyle_totals(testfile)
    if totfiles != formatted:
        libastyle.system_exit("totals not equal {0} {1}".format(
            totfiles, formatted))
Esempio n. 12
0
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)
Esempio n. 13
0
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)
Esempio n. 14
0
def main():
    """Main processing function.
    """
    libastyle.set_text_color()
    print(libastyle.get_python_version())
    os.chdir(libastyle.get_file_py_directory())
    testfile = "test-diff.txt"
    filepaths = get_diff_files(testfile)
    libtest.diff_formatted_files(filepaths, True)
Esempio n. 15
0
def main():
    """Call the library procedure to extract the requested project.
	"""
    libastyle.set_text_color()
    print(libastyle.get_python_version())
    starttime = time.time()
    libextract.extract_project(__project, __all_files_option)
    stoptime = time.time()
    print_run_time(starttime, stoptime)
Esempio n. 16
0
def main():
    """Main processing function.
    """
    libastyle.set_text_color()
    print(libastyle.get_python_version())
    os.chdir(libastyle.get_file_py_directory())
    testfile = "test-diff.txt"
    filepaths = get_diff_files(testfile)
    libtest.diff_formatted_files(filepaths, True)
Esempio n. 17
0
def main():
	"""Call the library procedure to extract the requested project.
	"""
	libastyle.set_text_color()
	print(libastyle.get_python_version())
	starttime = time.time()
	libextract.extract_project(__project, __all_files_option)
	stoptime = time.time()
	print_run_time(starttime, stoptime)
Esempio n. 18
0
def main():
    """Main processing function."""
    libastyle.set_text_color("yellow")
    print(libastyle.get_python_version())
    print("Modify AStyle Version from", __old_release, "to", __new_release)
    print("Modify Solib  Version from", __old_solibver, "to", __new_solibver)
    if not __file_update:
        print("\nFILES NOT UPDATED")
    # must use this version for newline option on the file open
    if platform.python_implementation() == "CPython" and sys.version_info[0] >= 3:
        pass
    else:
        libastyle.system_exit("Must use CPython version 3 or greater")
    print()

    # project file directories
    project_extension_list = ["Makefile", ".cbp", ".vcproj", ".vcxproj", ".pbxproj"]
    project_directory_list = [libastyle.get_project_directory(True) + "AStyle/build",
                              libastyle.get_project_directory(True) + "AStyleDev/build",
                              libastyle.get_project_directory(True) + "AStyleTest/build",
                              libastyle.get_project_directory(True) + "AStyleWin/build",
                              libastyle.get_project_directory(True) + "AStyleWx/build",
                              libastyle.get_project_directory(True) + "AStyleWxTest/build"]
    update_project_files(project_directory_list, project_extension_list)

    # source file directories
    source_extension_list = [".properties", ".cpp", ".m", ".java", ".cs"]
    source_directory_list = [libastyle.get_project_directory(True) + "AStyle/src",
                             libastyle.get_project_directory(True) + "AStyleDev/src-c",
                             libastyle.get_project_directory(True) + "AStyleDev/src-j",
                             libastyle.get_project_directory(True) + "AStyleDev/src-o",
                             libastyle.get_project_directory(True) + "AStyleDev/src-p",
                             libastyle.get_project_directory(True) + "AStyleDev/src-s",
                             libastyle.get_project_directory(True) + "AStyleTest/src",
                             libastyle.get_project_directory(True) + "AStyleTest/srccon",
                             libastyle.get_project_directory(True) + "AStyleTest/srci18n",
                             libastyle.get_project_directory(True) + "AStyleTest/srclib",
                             libastyle.get_project_directory(True) + "AStyleTest/srcloc",
                             libastyle.get_project_directory(True) + "AStyleTest/srcx",
                             libastyle.get_project_directory(True) + "AStyleWin/src",
                             libastyle.get_project_directory(True) + "AStyleWx/src",
                             libastyle.get_project_directory(True) + "AStyleWxTest/src",
                             libastyle.get_project_directory(True) + "AStyleWxTest/srcx"]
    update_source_files(source_directory_list, source_extension_list)

    # change the internal version number in cmake
    cmakelists_file_path = libastyle.get_project_directory(True) + "AStyle/CMakeLists.txt"
    update_cmakelists(cmakelists_file_path)

    # change the internal version number in astyle_main source
    astyle_main_file_path = libastyle.get_project_directory(True) + "AStyle/src/astyle_main.cpp"
    update_astyle_main(astyle_main_file_path)

    if not __file_update:
        print("\nFILES NOT UPDATED")
Esempio n. 19
0
def main():
	"""Main processing function.
	"""
	libastyle.set_text_color()
	print(libastyle.get_python_version())
	os.chdir(libastyle.get_file_py_directory())
	testfile = "test.txt"
	formatted, unused, unused, unused = libtest.get_astyle_totals(testfile)
	files = libtest.get_formatted_files(testfile)
	verify_formatted_files(len(files), formatted)
	libtest.diff_formatted_files(files)
Esempio n. 20
0
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()
    else:
        libastyle.system_exit("This is for Windows distribution only!")
Esempio n. 21
0
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()
	else:
		build_linux_distribution()
		build_mac_distribution()
Esempio n. 22
0
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()
    else:
        libastyle.system_exit("This is for Windows distribution only!")
Esempio n. 23
0
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()
    else:
        build_linux_distribution()
        build_mac_distribution()
Esempio n. 24
0
def main():
    """Main processing function.
    """
    if os.name != "nt":
        libastyle.system_exit("This script is for Windows only!")

    if platform.python_implementation() == "IronPython":
        libastyle.system_exit("IronPython is not currently supported")

    libastyle.set_text_color("yellow")
    print(libastyle.get_python_version())

    # "chinese" returns chinese-simplified
    languages = ("chinese-simplified", "chinese-traditional", "czech",
                 "danish", "dutch", "belgian", "english", "finnish", "french",
                 "german", "greek", "hungarian", "icelandic", "italian",
                 "japanese", "korean", "norwegian", "polish", "portuguese",
                 "russian", "slovak", "spanish", "swedish", "turkish")

    # build list of locale names
    locale_names = []
    for language in languages:
        # print language
        try:
            locale.setlocale(locale.LC_ALL, language)
        except locale.Error:
            print("unsupported locale: " + language)
        # print(locale.getlocale(locale.LC_CTYPE))
        locale_name = locale.setlocale(locale.LC_ALL, None)

        locale_names.append(locale_name)
    # sort the list of locale names
    # the call changed with version 3
    if sys.version_info[0] < 3:
        locale_names.sort(sort_compare)
    else:
        locale_names.sort(key=get_codepage)
    # print the list of locale names
    prevoius_codepage = 0
    total1252 = 0
    for locale_name in locale_names:
        codepage = get_codepage(locale_name)
        if codepage == "1252":
            total1252 += 1
        if codepage != prevoius_codepage:
            if prevoius_codepage == "1252":
                print("1252 TOTAL " + str(total1252))
            print()
            prevoius_codepage = codepage
        print(codepage + ' ' + locale_name)
Esempio n. 25
0
def main():
	"""Main processing function."""
	libastyle.set_text_color()
	print (libastyle.get_python_version())
	print("Modify Java JDK Version from", __old_release, "to", __new_release)
	if not __file_update:
		print("Files NOT Updated")
	print()

	# project file directories
	project_extension_list = [".cbp", ".vcproj", ".vcxproj"]
	project_directory_list = [libastyle.get_project_directory(True) + "AStyle/build",
					          libastyle.get_project_directory(True) + "AStyleDev/build"]
	update_project_files(project_directory_list, project_extension_list)
Esempio n. 26
0
def main():
    """Main processing function."""
    libastyle.set_text_color()
    print(libastyle.get_python_version())
    print("Modify Java JDK Version from", __old_release, "to", __new_release)
    if not __file_update:
        print("Files NOT Updated")
    print()

    # project file directories
    project_extension_list = [".cbp", ".vcproj", ".vcxproj"]
    project_directory_list = [
        libastyle.get_project_directory(True) + "AStyle/build",
        libastyle.get_project_directory(True) + "AStyleDev/build"
    ]
    update_project_files(project_directory_list, project_extension_list)
Esempio n. 27
0
def main():
    """Main processing function.
    """
    # initialization
    starttime = time.time()
    libastyle.set_text_color("yellow")
    print(libastyle.get_python_version())
    locale.setlocale(locale.LC_ALL, "")
    if os.name == "nt":
        process_windows_ramdrive()
    verify_options_x_variable()
    print_run_header()
    os.chdir(libastyle.get_file_py_directory())
    libastyle.build_astyle_executable(get_astyle_config())
    verify_astyle_executables(__astyleexe1, __astyleexe2)
    filepaths = libastyle.get_project_filepaths(__project)
    excludes = libastyle.get_project_excludes(__project)
    testfile = "test.txt"
    # run test 1
    if __formatOLD:
        print("\nTest 1 Extract")
        libextract.extract_project(__project, __all_files_option)
        print_test_header(1, __astyleexe1)
        astyle = set_astyle_args(filepaths, excludes, __astyleexe1)
        print_formatting_message(astyle, __project)
        call_artistic_style(astyle, testfile)
        print_astyle_totals(testfile)
        print("\nTest 1 Rename")
        libextract.remove_test_directory(__project + "OLD")
        libextract.rename_test_directory(__project, __project + "OLD")
    else:
        verify_test_directory(__project + "OLD")
        print("\nNo Test 1")

    # run test 2
    print("\nTest 2 Extract")
    libextract.extract_project(__project, __all_files_option)
    print_test_header(2, __astyleexe2)
    astyle = set_astyle_args(filepaths, excludes, __astyleexe2)
    print_formatting_message(astyle, __project)
    call_artistic_style(astyle, testfile)
    print_astyle_totals(testfile)

    # process formatted files
    diffs = compare_formatted_files(filepaths, len(excludes))
    print_run_total(starttime)
    libtest.diff_formatted_files(diffs, True)
Esempio n. 28
0
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)
Esempio n. 29
0
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 EXTRACT_ALL and os.name == "nt":
        build_windows_distribution()
        build_linux_distribution()
        build_mac_distribution()
    elif os.name == "nt":
        build_windows_distribution()
    else:
        build_linux_distribution()
        build_mac_distribution()
Esempio n. 30
0
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 EXTRACT_ALL and os.name == "nt":
        build_windows_distribution()
        build_linux_distribution()
        build_mac_distribution()
    elif os.name == "nt":
        build_windows_distribution()
    else:
        build_linux_distribution()
        build_mac_distribution()
Esempio n. 31
0
def main():
    """Main processing function.
    """
    global __total_errors
    # total files formatted in error
    errors = 0
    errtests = []

    # initialization
    starttime = time.time()
    libastyle.set_text_color("yellow")
    print(libastyle.get_python_version())
    locale.setlocale(locale.LC_ALL, "")
    print_run_header()
    os.chdir(libastyle.get_file_py_directory())
    libastyle.set_test_directory("TestDataSys")
    libastyle.build_astyle_executable(get_astyle_config())
    filepaths = libastyle.get_project_filepaths(__project)
    excludes = libastyle.get_project_excludes(__project)
    index = set_test_start()
    remove_test_files(index)
    remove_test_directories(index)
    print("\nExtracting files")
    libextract.extract_project(__project, __all_files_option)

    # process the brace options
    while index < len(__braces):
        print_test_header(index)
        testfile = get_test_file_name(index)
        astyle = set_astyle_args(filepaths, excludes, index)
        print_formatting_message(astyle, __project)
        call_artistic_style(astyle, testfile)
        totformat, unused = print_astyle_totals(testfile)
        files = check_formatted_files(testfile, index)
        if len(files) > 0:
            errors += totformat
            errtests.append(get_test_directory_name(index))
            copy_formatted_files(files, testfile, index)
            verify_formatted_files(len(files), totformat)
        os.remove(testfile)
        index += 1

    rename_output_file(filepaths)
    print_run_total(errors, errtests, starttime)
    __total_errors += errors
Esempio n. 32
0
def main():
    """Main processing function.
    """
    global __total_errors
    # total files formatted in error
    errors = 0
    errtests = []

    # initialization
    starttime = time.time()
    libastyle.set_text_color("yellow")
    print(libastyle.get_python_version())
    locale.setlocale(locale.LC_ALL, "")
    print_run_header()
    os.chdir(libastyle.get_file_py_directory())
    libastyle.set_test_directory("TestDataSys")
    libastyle.build_astyle_executable(get_astyle_config())
    filepaths = libastyle.get_project_filepaths(__project)
    excludes = libastyle.get_project_excludes(__project)
    index = set_test_start()
    remove_test_files(index)
    remove_test_directories(index)
    print("\nExtracting files")
    libextract.extract_project(__project, __all_files_option)

    # process the brace options
    while index < len(__braces):
        print_test_header(index)
        testfile = get_test_file_name(index)
        astyle = set_astyle_args(filepaths, excludes, index)
        print_formatting_message(astyle, __project)
        call_artistic_style(astyle, testfile)
        totformat, unused = print_astyle_totals(testfile)
        files = check_formatted_files(testfile, index)
        if len(files) > 0:
            errors += totformat
            errtests.append(get_test_directory_name(index))
            copy_formatted_files(files, testfile, index)
            verify_formatted_files(len(files), totformat)
        os.remove(testfile)
        index += 1

    rename_output_file(filepaths)
    print_run_total(errors, errtests, starttime)
    __total_errors += errors
Esempio n. 33
0
def main():
    """Main processing function.
    """
    # initialization
    starttime = time.time()
    libastyle.set_text_color("yellow")
    print(libastyle.get_python_version())
    locale.setlocale(locale.LC_ALL, "")
    verify_options_x_variable()
    print_run_header()
    os.chdir(libastyle.get_file_py_directory())
    libastyle.build_astyle_executable(get_astyle_config())
    verify_astyle_executables(__astyleexe1, __astyleexe2)
    filepaths = libastyle.get_project_filepaths(__project)
    excludes = libastyle.get_project_excludes(__project)
    testfile = "test.txt"
    # run test 1
    if __formatOLD:
        print("\nTest 1 Extract")
        libextract.extract_project(__project, __all_files_option)
        print_test_header(1, __astyleexe1)
        astyle = set_astyle_args(filepaths, excludes, __astyleexe1)
        print_formatting_message(astyle, __project)
        call_artistic_style(astyle, testfile)
        print_astyle_totals(testfile)
        print("\nTest 1 Rename")
        libextract.remove_test_directory(__project + "OLD")
        libextract.rename_test_directory(__project, __project + "OLD")
    else:
        verify_test_directory(__project + "OLD")
        print("\nNo Test 1")

    # run test 2
    print("\nTest 2 Extract")
    libextract.extract_project(__project, __all_files_option)
    print_test_header(2, __astyleexe2)
    astyle = set_astyle_args(filepaths, excludes, __astyleexe2)
    print_formatting_message(astyle, __project)
    call_artistic_style(astyle, testfile)
    print_astyle_totals(testfile)

    # process formatted files
    diffs = compare_formatted_files(filepaths, len(excludes))
    print_run_total(starttime)
    libtest.diff_formatted_files(diffs, True)
def main():
    """Main processing function."""
    libastyle.set_text_color()
    print(libastyle.get_python_version())
    print("Modify Shared Version from", __old_release, "to", __new_release)
    if not __file_update:
        print("\nFILES NOT UPDATED")
    # must use this version for newline option on the file open
    if platform.python_implementation(
    ) == "CPython" and sys.version_info[0] >= 3:
        pass
    else:
        libastyle.system_exit("Must use CPython version 3 or greater")
    print()

    # project file directories
    project_extension_list = [
        "Makefile", ".cbp", ".vcproj", ".vcxproj", ".pbxproj"
    ]
    project_directory_list = [
        libastyle.get_project_directory(True) + "AStyle/build",
        libastyle.get_project_directory(True) + "AStyleDev/build",
        libastyle.get_project_directory(True) + "AStyleTest/build",
        libastyle.get_project_directory(True) + "AStyleWin/build",
        libastyle.get_project_directory(True) + "AStyleWx/build"
    ]
    update_project_files(project_directory_list, project_extension_list)

    # source file directories
    source_extension_list = [
        ".properties", ".cpp", ".m", ".java", ".py", ".cs"
    ]
    source_directory_list = [
        libastyle.get_project_directory(True) + "AStyleDev/src-c",
        libastyle.get_project_directory(True) + "AStyleDev/src-o",
        libastyle.get_project_directory(True) + "AStyleDev/src-j",
        libastyle.get_project_directory(True) + "AStyleDev/src-p",
        libastyle.get_project_directory(True) + "AStyleDev/src-s",
        libastyle.get_project_directory(True) + "AStyleTest/src",
        libastyle.get_project_directory(True) + "AStyleWin/src",
        libastyle.get_project_directory(True) + "AStyleWx/src"
    ]
    update_source_files(source_directory_list, source_extension_list)
    if not __file_update:
        print("FILES NOT UPDATED")
def main():
    """Main processing function."""
    libastyle.set_text_color("yellow")
    print(libastyle.get_python_version())
    print("Modify Copyright Date from", __old_date, "to", __new_date)
    if not __file_update:
        print("\nFILES NOT UPDATED")
    # must use this version for newline option on the file open
    if platform.python_implementation(
    ) == "CPython" and sys.version_info[0] >= 3:
        pass
    else:
        libastyle.system_exit("Must use CPython version 3 or greater")
    print()

    # source file directories
    source_extension_list = [".h", ".cpp", ".m", ".md", ".java", ".py", ".cs"]
    source_directory_list = [
        libastyle.get_project_directory(True) + "AStyle",
        libastyle.get_project_directory(True) + "AStyle/src",
        libastyle.get_project_directory(True) + "AStyleDev",
        libastyle.get_project_directory(True) + "AStyleDev/src-c",
        libastyle.get_project_directory(True) + "AStyleDev/src-j",
        libastyle.get_project_directory(True) + "AStyleDev/src-o",
        libastyle.get_project_directory(True) + "AStyleDev/src-p",
        libastyle.get_project_directory(True) + "AStyleDev/src-s",
        libastyle.get_project_directory(True) + "AStyleTest",
        libastyle.get_project_directory(True) + "AStyleTest/src",
        libastyle.get_project_directory(True) + "AStyleTest/srccon",
        libastyle.get_project_directory(True) + "AStyleTest/srci18n",
        libastyle.get_project_directory(True) + "AStyleTest/srclib",
        libastyle.get_project_directory(True) + "AStyleTest/srcloc",
        libastyle.get_project_directory(True) + "AStyleTest/srcx",
        libastyle.get_project_directory(True) + "AStyleWin/src",
        libastyle.get_project_directory(True) + "AStyleWx",
        libastyle.get_project_directory(True) + "AStyleWx/src",
        libastyle.get_project_directory(True) + "AStyleWxTest",
        libastyle.get_project_directory(True) + "AStyleWxTest/src",
        libastyle.get_project_directory(True) + "AStyleWxTest/srcx"
    ]
    update_source_files(source_directory_list, source_extension_list)
    if not __file_update:
        print("FILES NOT UPDATED")
Esempio n. 36
0
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)
Esempio n. 37
0
def main():
    """Main processing function."""
    libastyle.set_text_color("yellow")
    print(libastyle.get_python_version())
    print("Modify Html files from", correct_path_separators(__html_folder))
    if not __file_update:
        print("Files NOT Updated")
    # must use this version for newline option on the file open
    if platform.python_implementation() == "CPython" and sys.version_info[0] >= 3:
        pass
    else:
        libastyle.system_exit("Must use CPython version 3 or greater")
    print()

    # update html files
    file_list = sorted(glob.glob(__html_folder + "/*.html"))
    for file_path in file_list:
        print(correct_path_separators(file_path))
        update_html_files(file_path)
def main():
    """Main processing function."""
    libastyle.set_text_color("yellow")
    print(libastyle.get_python_version())
    print("Modify Java JDK Version from", __old_release, "to", __new_release)
    if not __file_update:
        print("\nFiles NOT Updated")
    # must use this version for newline option on the file open
    if platform.python_implementation() == "CPython" and sys.version_info[0] >= 3:
        pass
    else:
        libastyle.system_exit("Must use CPython version 3 or greater")
    print()

    # project file directories
    project_extension_list = [".cbp", ".vcproj", ".vcxproj"]
    project_directory_list = [libastyle.get_project_directory(True) + "AStyle/build",
                              libastyle.get_project_directory(True) + "AStyleDev/build"]
    update_project_files(project_directory_list, project_extension_list)
Esempio n. 39
0
def process_files():
	"""Main processing function."""

	# bracket options and the order they are tested
	brackets = "__aa_bb_ll_gg_aa_ll_bb_gg_bb_aa_gg_ll_aa_"
	# total files formatted in error
	errors = 0
	errtests = []

	#initialization
	starttime = time.time()
	libastyle.set_text_color()
	print (libastyle.get_python_version())
	locale.setlocale(locale.LC_ALL, "")
	print_run_header()
	os.chdir(libastyle.get_file_py_directory())
	filepaths = get_file_paths()
	excludes = []
	index = set_test_start(brackets)
	libastyle.build_astyle_executable(get_astyle_config())
	print ("\nExtracting files")
	extract_project()

	# process the bracket options
	while index < len(brackets):
		print_test_header(brackets, index)
		testfile = get_test_file_name(index)
		astyle = set_astyle_args(filepaths, excludes, brackets, index)
		print_formatting_message(astyle, project)
		call_artistic_style(astyle, testfile)
		totformat, totfiles = print_astyle_totals(testfile)
		files = check_formatted_files(testfile, brackets, index)
		if len(files) > 0:
			errors += totformat
			errtests.append( get_test_directory_name(index))
			copy_formatted_files(files, testfile, index)
			verify_formatted_files(len(files), totformat)
		os.remove(testfile)
		index += 1

	print_run_total(errors, errtests, starttime)
Esempio n. 40
0
def main():
    """Main processing function.
    """
    # initialization
    starttime = time.time()
    libastyle.set_text_color("yellow")
    print(libastyle.get_python_version())
    locale.setlocale(locale.LC_ALL, "")
    if os.name == "nt":
        process_windows_ramdrive()
    verify_options_x_variable()
    print_run_header()
    os.chdir(libastyle.get_file_py_directory())
    libastyle.build_astyle_executable(get_astyle_config())
    verify_astyle_executables(__astyleexe1, __astyleexe2)
    filepaths = libastyle.get_project_filepaths(__project)
    excludes = libastyle.get_project_excludes(__project)
    testfile = "test.txt"
    if __extract_files:
        print("\nExtracting")
        libextract.extract_project(__project, __all_files_option)

    # run test 1
    print_test_header(1, __astyleexe1)
    astyle = set_astyle_args(filepaths, excludes, __astyleexe1)
    print_formatting_message(astyle, __project)
    call_artistic_style(astyle, testfile)
    print_astyle_totals(testfile)

    # run test 2
    print_test_header(2, __astyleexe2)
    astyle = set_astyle_args(filepaths, excludes, __astyleexe2)
    print_formatting_message(astyle, __project)
    call_artistic_style(astyle, testfile)
    totformat, unused = print_astyle_totals(testfile)
    files = libtest.get_formatted_files(testfile)
    verify_formatted_files(len(files), totformat)

    # process formatted files
    print_run_total(starttime)
    libtest.diff_formatted_files(files)
def main():
    """Main processing function."""
    libastyle.set_text_color("yellow")
    print(libastyle.get_python_version())
    print("Modify Copyright Date from", __old_date, "to", __new_date)
    if not __file_update:
        print("\nFILES NOT UPDATED")
    # must use this version for newline option on the file open
    if platform.python_implementation() == "CPython" and sys.version_info[0] >= 3:
        pass
    else:
        libastyle.system_exit("Must use CPython version 3 or greater")
    print()

    # source file directories
    source_extension_list = [".h", ".cpp", ".m", ".md", ".java", ".py", ".cs"]
    source_directory_list = [libastyle.get_project_directory(True) + "AStyle",
                             libastyle.get_project_directory(True) + "AStyle/src",
                             libastyle.get_project_directory(True) + "AStyleDev",
                             libastyle.get_project_directory(True) + "AStyleDev/src-c",
                             libastyle.get_project_directory(True) + "AStyleDev/src-j",
                             libastyle.get_project_directory(True) + "AStyleDev/src-o",
                             libastyle.get_project_directory(True) + "AStyleDev/src-p",
                             libastyle.get_project_directory(True) + "AStyleDev/src-s",
                             libastyle.get_project_directory(True) + "AStyleTest",
                             libastyle.get_project_directory(True) + "AStyleTest/src",
                             libastyle.get_project_directory(True) + "AStyleTest/srccon",
                             libastyle.get_project_directory(True) + "AStyleTest/srci18n",
                             libastyle.get_project_directory(True) + "AStyleTest/srclib",
                             libastyle.get_project_directory(True) + "AStyleTest/srcloc",
                             libastyle.get_project_directory(True) + "AStyleTest/srcx",
                             libastyle.get_project_directory(True) + "AStyleWin/src",
                             libastyle.get_project_directory(True) + "AStyleWx",
                             libastyle.get_project_directory(True) + "AStyleWx/src",
                             libastyle.get_project_directory(True) + "AStyleWxTest",
                             libastyle.get_project_directory(True) + "AStyleWxTest/src",
                             libastyle.get_project_directory(True) + "AStyleWxTest/srcx"]
    update_source_files(source_directory_list, source_extension_list)
    if not __file_update:
        print("FILES NOT UPDATED")
Esempio n. 42
0
def main():
    """Main processing function."""
    libastyle.set_text_color("yellow")
    print (libastyle.get_python_version())
    print("Modify Shared Version from", __old_release, "to", __new_release)
    if not __file_update:
        print("\nFILES NOT UPDATED")
    # must use this version for newline option on the file open
    if platform.python_implementation() == "CPython" and sys.version_info[0] >= 3:
        pass
    else:
        libastyle.system_exit("Must use CPython version 3 or greater")
    print()

    # project file directories
    project_extension_list = ["Makefile", ".cbp", ".vcproj", ".vcxproj", ".pbxproj"]
    project_directory_list = [libastyle.get_project_directory(True) + "AStyle/build",
                              libastyle.get_project_directory(True) + "AStyleDev/build",
                              libastyle.get_project_directory(True) + "AStyleTest/build",
                              libastyle.get_project_directory(True) + "AStyleWin/build",
                              libastyle.get_project_directory(True) + "AStyleWx/build"]
    update_project_files(project_directory_list, project_extension_list)

    # source file directories
    source_extension_list = [".properties", ".cpp", ".m", ".java", ".py", ".cs"]
    source_directory_list = [libastyle.get_project_directory(True) + "AStyle/src",
                             libastyle.get_project_directory(True) + "AStyleDev/src-c",
                             libastyle.get_project_directory(True) + "AStyleDev/src-o",
                             libastyle.get_project_directory(True) + "AStyleDev/src-j",
                             libastyle.get_project_directory(True) + "AStyleDev/src-p",
                             libastyle.get_project_directory(True) + "AStyleDev/src-s",
                             libastyle.get_project_directory(True) + "AStyleTest/src",
                             libastyle.get_project_directory(True) + "AStyleWin/src",
                             libastyle.get_project_directory(True) + "AStyleWx/src"]
    # exclude files with utf-8 encoding (...Other.cpp seems to be an error in linux)
    source_excludes = [libastyle.get_project_directory(True) + "AStyle/src/ASLocalizer.cpp",
                       libastyle.get_project_directory(True) + "AStyleTest/src/AStyleTest_Other.cpp"]
    update_source_files(source_directory_list, source_extension_list, source_excludes)
    if not __file_update:
        print("FILES NOT UPDATED")
def main():
    """Main processing function."""
    libastyle.set_text_color("yellow")
    print(libastyle.get_python_version())
    print("Modify Java JDK Version from", __old_release, "to", __new_release)
    if not __file_update:
        print("\nFiles NOT Updated")
    # must use this version for newline option on the file open
    if platform.python_implementation(
    ) == "CPython" and sys.version_info[0] >= 3:
        pass
    else:
        libastyle.system_exit("Must use CPython version 3 or greater")
    print()

    # project file directories
    project_extension_list = [".cbp", ".vcproj", ".vcxproj"]
    project_directory_list = [
        libastyle.get_project_directory(True) + "AStyle/build",
        libastyle.get_project_directory(True) + "AStyleDev/build"
    ]
    update_project_files(project_directory_list, project_extension_list)
Esempio n. 44
0
def main():
    """Main processing function.
    """
    # initialization
    starttime = time.time()
    libastyle.set_text_color()
    print(libastyle.get_python_version())
    locale.setlocale(locale.LC_ALL, "")
    verify_options_x_variable()
    print_run_header()
    os.chdir(libastyle.get_file_py_directory())
    libastyle.build_astyle_executable(get_astyle_config())
    verify_astyle_executables(__astyleexe1, __astyleexe2)
    filepaths = libastyle.get_project_filepaths(__project)
    excludes = libastyle.get_project_excludes(__project)
    testfile = "test.txt"
    if __extract_files:
        print("\nExtracting")
        libextract.extract_project(__project, __all_files_option)

    # run test 1
    print_test_header(1, __astyleexe1)
    astyle = set_astyle_args(filepaths, excludes, __astyleexe1)
    print_formatting_message(astyle, __project)
    call_artistic_style(astyle, testfile)
    print_astyle_totals(testfile)

    # run test 2
    print_test_header(2, __astyleexe2)
    astyle = set_astyle_args(filepaths, excludes, __astyleexe2)
    print_formatting_message(astyle, __project)
    call_artistic_style(astyle, testfile)
    totformat, unused = print_astyle_totals(testfile)
    files = libtest.get_formatted_files(testfile)
    verify_formatted_files(len(files), totformat)

    # process formatted files
    print_run_total(starttime)
    libtest.diff_formatted_files(files)
Esempio n. 45
0
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.cpp"

    libastyle.set_text_color("yellow")
    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)
Esempio n. 46
0
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)
Esempio n. 47
0
def main():
    """Main processing function.
    """
    # initialization
    libastyle.set_text_color()
    print(libastyle.get_python_version())
    verify_os()
    exepath = "C:/Windows/AppPatch/AppLoc.exe"
    i18npath = __builddir + "/bin/AStyleTestI18nd.exe"
    command = exepath + ' ' + i18npath + ' ' + "\"--terse_printer --no_close\"" + ' '
    # verify files
    if not os.path.exists(exepath):
        libastyle.system_exit("AppLoc not installed: " + exepath)
    build_testi18n_executable()

    # for some reason the subprocess call must be one long statement and quoted as follows???
    # the country LCID is added by the subprocess call
    command = exepath + ' ' + i18npath + ' ' + "\"--terse_output --no_close\"" + ' '
    # run tests
    print("\nWAIT for a test to finish before running the next")
    print("Select OK to continue ...")
    print("\nNOTE: A bad return may work anyway. Check the individual displays.")
    print("Running Greek Test")
    retval = subprocess.call(command + "/L0408")
    if retval:
        print("    Bad AppLoc return: " + str(retval))
    time.sleep(2)       # must finish before running the next test
    print("Running Japanese Test")
    retval = subprocess.call(command + "/L0411")
    if retval:
        print("    Bad AppLoc return: " + str(retval))
    time.sleep(2)       # must finish before running the next test
    print("Running Russian Test")
    retval = subprocess.call(command + "/L0419")
    if retval:
        print("    Bad AppLoc return: " + str(retval))
    time.sleep(2)       # must finish before running the next test
Esempio n. 48
0
def main():
    """Main processing function.
    """
    # initialization
    libastyle.set_text_color()
    print(libastyle.get_python_version())
    verify_os()
    exepath = "C:/Windows/AppPatch/AppLoc.exe"
    i18npath = __builddir + "/debug/AStyleTestI18nd.exe"
    # verify files
    if not os.path.exists(exepath):
        libastyle.system_exit("AppLoc not installed: " + exepath)
    build_testi18n_executable()

    # for some reason the subprocess call must be one long statement and quoted as follows???
    # the country LCID is added by the subprocess call
    command = exepath + ' ' + i18npath + ' ' + "\"--terse_output --no_close\"" + ' '
    # run tests
    print("\nWAIT for a test to finish before running the next")
    print("Select OK to continue ...")
    print(
        "\nNOTE: A bad return may work anyway. Check the individual displays.")
    print("Running Greek Test")
    retval = subprocess.call(command + "/L0408")
    if retval:
        print("    Bad AppLoc return: " + str(retval))
    time.sleep(2)  # must finish before running the next test
    print("Running Japanese Test")
    retval = subprocess.call(command + "/L0411")
    if retval:
        print("    Bad AppLoc return: " + str(retval))
    time.sleep(2)  # must finish before running the next test
    print("Running Russian Test")
    retval = subprocess.call(command + "/L0419")
    if retval:
        print("    Bad AppLoc return: " + str(retval))
    time.sleep(2)  # must finish before running the next test
Esempio n. 49
0
def process_files():
	"""Read libPROJ and libSVN files and check the directories."""

	libproj_path = get_batch_directory() + "/libPROJ.bat"
	libsvn_path = get_batch_directory() + "/libSVN.bat"
	libproj_directories = []	# directories in libPROJ.bat
	libsvn_directories = []		# directories in  libSVN.bat

	libastyle.set_text_color()
	print (libastyle.get_python_version())
	get_directories(libproj_directories, libproj_path)
	get_directories(libsvn_directories, libsvn_path)
	correct_libproj_directories(libproj_directories)

	print ("Checking libPROJ.bat directories to libSVN.bat.")
	total_variables = len(libproj_directories)
	print ("There are {0} directories in libPROJ.bat.".format(total_variables))
	print ()

	find_diffs(libproj_directories, libsvn_directories)

	if print_variables:
		print (libproj_directories)
		print (libsvn_directories)
Esempio n. 50
0
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)
Esempio n. 51
0
# -----------------------------------------------------------------------------


def test_file_write(filename):
    """Write a file for testing this module.
	"""
    outfile = open(filename, 'w')
    text = ("Artistic Style 1.xx\n"
            "--------------------------------------------------\n"
            "directory $HOME/Projects/TestData/Project/*.cpp\n"
            "--------------------------------------------------\n"
            "formatted  plugins/astyle/astyle/ASFormatter.cpp\n"
            "unchanged* plugins/astyle/astyle/Unchanged.cpp\n"
            "formatted  plugins/codecompletion/parser.cpp\n"
            "unchanged* plugins/codecompletion/unchanged.cpp\n"
            "--------------------------------------------------\n"
            "2 formatted, 2 unchanged, 10 seconds, 1000 lines\n")
    text = text.replace("$HOME", libastyle.get_home_directory())
    outfile.write(text)
    outfile.close()


# -----------------------------------------------------------------------------

# make the module executable
if __name__ == "__main__":
    libastyle.set_text_color()
    print(libastyle.get_python_version())
    test_all_functions()
    libastyle.system_exit()
Esempio n. 52
0
	extract_project(libastyle.TESTPROJECT, False)
	print()
	stoptime = time.time()
	test_print_time(starttime, stoptime)

# -----------------------------------------------------------------------------

def test_print_time(starttime, stoptime):
	"""Print run time for the test.
	"""
	runtime = int(stoptime - starttime + 0.5)
	minute = int(runtime / 60)
	sec = int(runtime % 60)
	if min == 0:
		print("{0} seconds".format(sec))
	else:
		print("{0} min {1} seconds".format(minute, sec))

# -----------------------------------------------------------------------------

# make the module executable
# run tests if executed as stand-alone
if __name__ == "__main__":
	libastyle.set_text_color()
	print(libastyle.get_python_version())
	test_all_compressed()
	test_all_tarballs()
	libastyle.system_exit()

# -----------------------------------------------------------------------------
Esempio n. 53
0
def main():
    """Main processing function.
    """
    if os.name != "nt":
        libastyle.system_exit("This script is for Windows only!")

    if platform.python_implementation() == "IronPython":
        libastyle.system_exit("IronPython is not currently supported")

    libastyle.set_text_color()
    print(libastyle.get_python_version())

    languages = (
            # "chinese",                    # returns chinese-simplified
            "chinese-simplified",
            "chinese-traditional",
            "czech",
            "danish",
            "dutch",
            "belgian",
            "english",
            "finnish",
            "french",
            "german",
            "greek",
            "hungarian",
            "icelandic",
            "italian",
            "japanese",
            "korean",
            "norwegian",
            "polish",
            "portuguese",
            "russian",
            "slovak",
            "spanish",
            "swedish",
            "turkish",
            )

    # build list of locale names
    locale_names = []
    for language in languages:
        # print language
        try:
            locale.setlocale(locale.LC_ALL, language)
        except locale.Error:
            print("unsupported locale: " + language)
        # print(locale.getlocale(locale.LC_CTYPE))
        locale_name = locale.setlocale(locale.LC_ALL, None)

        locale_names.append(locale_name)
    # sort the list of locale names
    # the call changed with version 3
    if sys.version_info[0] < 3:
        locale_names.sort(sort_compare)
    else:
        locale_names.sort(key=get_codepage)
    # print the list of locale names
    prevoius_codepage = 0
    total1252 = 0
    for locale_name in locale_names:
        codepage = get_codepage(locale_name)
        if codepage == "1252":
            total1252 += 1
        if codepage != prevoius_codepage:
            if prevoius_codepage == "1252":
                print("1252 TOTAL " + str(total1252))
            print()
            prevoius_codepage = codepage
        print(codepage + ' ' + locale_name)