コード例 #1
0
ファイル: csharp_testdata.py プロジェクト: amremam2004/astyle
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))
コード例 #2
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))
コード例 #3
0
def process_diffs():
    """Main processing function.
	"""
    libastyle.set_text_color()
    os.chdir(libastyle.get_file_py_directory())
    testfile = "test-diff.txt"
    filepaths = get_diff_files(testfile)
    libtest.diff_formatted_files(filepaths, True)
コード例 #4
0
ファイル: diff2_print.py プロジェクト: amremam2004/astyle
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)
コード例 #5
0
ファイル: diff2_print.py プロジェクト: JeremyActronika/astyle
def main():
    """Main processing function.
    """
    libastyle.set_text_color("yellow")
    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)
コード例 #6
0
ファイル: diff1-print.py プロジェクト: JeremyActronika/astyle
def process_diffs():
    """Main processing function.
	"""
    libastyle.set_text_color()
    os.chdir(libastyle.get_file_py_directory())
    testfile = "test.txt"
    formatted, unchanged, min, sec = libtest.get_astyle_totals(testfile)
    files = libtest.get_formatted_files(testfile)
    verify_formatted_files(len(files), formatted)
    libtest.diff_formatted_files(files)
コード例 #7
0
ファイル: diff1_print.py プロジェクト: JeremyActronika/astyle
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)
コード例 #8
0
def create_distributions():
    """Main processing function.
	"""
    libastyle.set_text_color()
    os.chdir(libastyle.get_file_py_directory())
    remove_dist_directories()
    if os.name == "nt":
        build_windows_distribution()
    else:
        build_linux_distribution()
        build_mac_distribution()
コード例 #9
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!")
コード例 #10
0
ファイル: dist-copy.py プロジェクト: azat-archive/astyle
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()
コード例 #11
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!")
コード例 #12
0
ファイル: dist_copy.py プロジェクト: shennushi/astyle
def main():
    """Main processing function.
    """
    libastyle.set_text_color()
    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:
        build_linux_distribution()
        build_mac_distribution()
コード例 #13
0
ファイル: i18n-japanese.py プロジェクト: fengfeng0328/AStyle
def process_files():
    """Main processing function.
	"""
    # initialization
    libastyle.set_text_color()
    verify_locale()
    os.chdir(libastyle.get_file_py_directory())
    libastyle.build_astyle_executable(get_astyle_config())
    print "Cleaning test directory"
    clean_test_directory(testdir)
    # run tests
    test_recursive_1()
    test_recursive_2()
    test_recursive_3()
    test_recursive_exclude()
    test_recursive_suffix()
コード例 #14
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)
コード例 #15
0
ファイル: dist_copy.py プロジェクト: svn2github/astyle-code
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()
コード例 #16
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
コード例 #17
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)
コード例 #18
0
ファイル: system_test.py プロジェクト: svn2github/astyle-code
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
コード例 #19
0
ファイル: libtest.py プロジェクト: JeremyActronika/astyle
def test_all_functions():
    """Test all functions for syntax.
	   This must be run from a console to test the 'diff' functions.
	"""
    # write test file
    os.chdir(libastyle.get_file_py_directory())
    testfile = libastyle.get_temp_directory() + "libtest.txt"
    test_file_write(testfile)
    # begin tests -----------------------------------------
    files = get_formatted_files(testfile)
    # calls extract_directory_from_line()
    print("No files will be displayed in the comparison program.")
    diff_formatted_files(files)
    # calls call_diff_program()
    # calls strip_test_directory_prefix()
    get_astyle_totals(testfile)
    # end tests -------------------------------------------
    os.remove(testfile)
コード例 #20
0
ファイル: libtest.py プロジェクト: a-w/astyle
def test_all_functions():
    """Test all functions for syntax.
       This must be run from a console to test the 'diff' functions.
    """
    # write test file
    os.chdir(libastyle.get_file_py_directory())
    testfile = libastyle.get_temp_directory() + "libtest.txt"
    test_file_write(testfile)
    # begin tests -----------------------------------------
    files = get_formatted_files(testfile)
        # calls extract_directory_from_line()
    print("No files will be displayed in the comparison program.")
    diff_formatted_files(files)
        # calls call_diff_program()
        # calls strip_test_directory_prefix()
    get_astyle_totals(testfile)
    # end tests -------------------------------------------
    os.remove(testfile)
コード例 #21
0
ファイル: dist-copy.py プロジェクト: azat-archive/astyle
def call_7zip(distBase, compressedFile):
	"""Call 7zip to create an archive.
	   arg 1- the directory to compress.
	   arg 2- name of the compressed file.
	"""
	exepath = libastyle.get_7zip_path()
	compress = [exepath, "a", compressedFile]
	# check file ending to see if it is a tarball
	if compressedFile.endswith((".gz", ".bz2")):
		compress.append("*.tar")
	# stdout file must have full path since 'cwd' is used in call
	filename = libastyle.get_file_py_directory(True) + "compress.txt"
	outfile = open(filename, 'w')
	retval = subprocess.call(compress, cwd=distBase, stdout=outfile)
	if retval:
		libastyle.system_exit("Bad 7zip return: "  + str(retval))
	outfile.close()
	os.remove(filename)
	print (compressedFile + " created")
コード例 #22
0
def process_files():
    """Main processing function.
	"""
    # initialization
    starttime = time.time()
    libastyle.set_text_color()
    locale.setlocale(locale.LC_ALL, "")
    print_run_header()
    os.chdir(libastyle.get_file_py_directory())
    libastyle.build_astyle_executable(get_astyle_config())
    verify_astyle_executables(astyleexe1, astyleexe2)
    filepaths = get_file_paths()
    excludes = []
    testfile = "test.txt"
    # run test 1
    if formatOLD:
        print "\nExtracting Test 1"
        extract_project()
        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)
    else:
        verify_test_directory(project + "OLD")
        print "\nNo Test 1"

    # run test 2
    print "\nExtracting Test 2"
    if formatOLD:
        libextract.remove_test_directory(project + "OLD")
        libextract.rename_test_directory(project, project + "OLD")
    extract_project()
    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)
コード例 #23
0
ファイル: dist-copy.py プロジェクト: JeremyActronika/astyle
def call_7zip(dist_base, compressed_file):
    """Call 7zip to create an archive.
	   arg 1- the directory to compress.
	   arg 2- name of the compressed file.
	"""
    exepath = libastyle.get_7zip_path()
    compress = [exepath, "a", compressed_file]
    # check file ending to see if it is a tarball
    if compressed_file.endswith((".gz", ".bz2")):
        compress.append("*.tar")
    # stdout file must have full path since 'cwd' is used in call
    filename = libastyle.get_file_py_directory(True) + "compress.txt"
    outfile = open(filename, 'w')
    retval = subprocess.call(compress, cwd=dist_base, stdout=outfile)
    if retval:
        libastyle.system_exit("Bad 7zip return: " + str(retval))
    outfile.close()
    os.remove(filename)
    print(compressed_file + " created")
コード例 #24
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)
コード例 #25
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)
コード例 #26
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()
    locale.setlocale(locale.LC_ALL, "")
    print_run_header()
    os.chdir(libastyle.get_file_py_directory())
    filepaths = libastyle.get_project_filepaths(project)
    excludes = libastyle.get_project_excludes(project)
    index = set_test_start(brackets)
    libastyle.build_astyle_executable(get_astyle_config())
    print "\nExtracting files"
    libextract.extract_project(project, all_files_option)

    # 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)
コード例 #27
0
def call_7zip(dist_base, compressed_file):
    """Call 7zip to create an archive.
       arg 1- the directory to compress.
       arg 2- name of the compressed file.
    """
    exepath = libastyle.get_7zip_path()
    compress = [exepath, "a", compressed_file]
    # check file ending to see if it is a tarball
    if compressed_file.endswith((".gz", ".bz2")):
        compress.append("*.tar")
    # stdout file must have full path since 'cwd' is used in call
    filename = libastyle.get_file_py_directory(True) + "compress.txt"
    outfile = open(filename, 'w')
    try:
        subprocess.check_call(compress, cwd=dist_base, stdout=outfile)
    except subprocess.CalledProcessError as err:
        libastyle.system_exit("Bad 7zip return: " + str(err.returncode))
    except OSError:
        libastyle.system_exit("Cannot find executable: " + compress[0])
    outfile.close()
    os.remove(filename)
    print(compressed_file + " created")
コード例 #28
0
ファイル: regression1_test.py プロジェクト: shennushi/astyle
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)
コード例 #29
0
ファイル: dist_copy.py プロジェクト: shennushi/astyle
def call_7zip(dist_base, compressed_file):
    """Call 7zip to create an archive.
       arg 1- the directory to compress.
       arg 2- name of the compressed file.
    """
    exepath = libastyle.get_7zip_path()
    compress = [exepath, "a", compressed_file]
    # check file ending to see if it is a tarball
    if compressed_file.endswith((".gz", ".bz2")):
        compress.append("*.tar")
    # stdout file must have full path since 'cwd' is used in call
    filename = libastyle.get_file_py_directory(True) + "compress.txt"
    outfile = open(filename, 'w')
    try:
        subprocess.check_call(compress, cwd=dist_base, stdout=outfile)
    except subprocess.CalledProcessError as err:
        libastyle.system_exit("Bad 7zip return: " + str(err.returncode))
    except OSError:
        libastyle.system_exit("Cannot find executable: " + compress[0])
    outfile.close()
    os.remove(filename)
    print(compressed_file + " created")
コード例 #30
0
def process_files():
    """Main processing function.
	"""
    # initialization
    starttime = time.time()
    libastyle.set_text_color()
    locale.setlocale(locale.LC_ALL, "")
    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 extractfiles:
        print "\nExtracting files"
        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, totfiles = 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)