Esempio n. 1
0
def build_windows_distribution():
    """Copy astyle files to the windows directory.
    """
    print()
    print("* * * * * * * * * * * * * * * * * * * * * * * * * * * * *")
    print("*        Copying AStyle Windows XP Distribution         *")
    print("* * * * * * * * * * * * * * * * * * * * * * * * * * * * *")
    # the following variables may be modified except vscfg=libastyle.STATIC_XP
    vsdir = libastyle.VS_RELEASE
    vscfg = libastyle.STATIC_XP

    print("Compiling with", vsdir)
    print("Building AStyle release", AS_RELEASE)
    if not vsdir >= "vs2013":
        libastyle.system_exit("Must compile with vs2013 or greater in libastyle: " + vsdir)
    dist_base = __base_dir + "/DistWindowsXP"
    dist_astyle = dist_base + "/AStyleXP"
    os.makedirs(dist_astyle)
    libastyle.build_astyle_executable(vscfg)

    # Windows includes an executable in the bin directory
    print("copying exe")
    dist_astyle_bin = dist_astyle + "/bin/"
    os.mkdir(dist_astyle_bin)
    astyle_build_directory = libastyle.get_astyle_build_directory(vscfg)
    if vscfg == libastyle.DEBUG:
        shutil.copy(astyle_build_directory + "/debug/AStyle.exe", dist_astyle_bin)
    elif vscfg == libastyle.RELEASE:
        shutil.copy(astyle_build_directory + "/bin/AStyle.exe", dist_astyle_bin)
    elif vscfg == libastyle.STATIC or vscfg == libastyle.STATIC_XP:
        shutil.copy(astyle_build_directory + "/binstatic/AStyle.exe", dist_astyle_bin)
    else:
        libastyle.system_exit("Invalid compile configuration: " + vscfg)

    # top directory
    dist_top = dist_astyle + "/"
    copy_astyle_top(dist_top, True)

    # build directory
    dist_build = dist_astyle + "/build"
    os.mkdir(dist_build)
    copy_windows_build_directories(dist_build)

    # doc directory
    dist_doc = dist_astyle + "/doc/"
    os.mkdir(dist_doc)
    copy_astyle_doc(dist_doc, True)

    # src directory
    dist_src = dist_astyle + "/src/"
    os.mkdir(dist_src)
    copy_astyle_src(dist_src, True)

    # create zip
    zipfile = "AStyle_{0}_windows_xp.zip".format(AS_RELEASE)
    call_7zip(dist_base, zipfile)
Esempio n. 2
0
def build_windows_distribution():
    """Copy astyle files to the windows directory.
    """
    print()
    print("* * * * * * * * * * * * * * * * * * * * * * * * * * * * *")
    print("*          Copying AStyle Windows Distribution          *")
    print("* * * * * * * * * * * * * * * * * * * * * * * * * * * * *")
    # the following variables may be modified
    vsdir = libastyle.VS_RELEASE
    vscfg= libastyle.STATIC

    print("Compiling with", vsdir)
    print("Building release", __release)
    if not vsdir >= "vs2013":
        libastyle.system_exit("Must compile with vs2013 or greater in libastyle: " + vsdir)
    dist_base = __base_dir + "/DistWindows"
    dist_astyle = dist_base + "/AStyle"
    os.makedirs(dist_astyle)
    libastyle.build_astyle_executable(vscfg)

    # Windows includes an executable in the bin directory
    print("copying exe")
    dist_astyle_bin = dist_astyle + "/bin/"
    os.mkdir(dist_astyle_bin)
    astyle_build_directory = libastyle.get_astyle_build_directory(vscfg)
    if vscfg ==  libastyle.DEBUG:
        shutil.copy(astyle_build_directory + "/debug/AStyle.exe", dist_astyle_bin)
    elif vscfg ==  libastyle.RELEASE:
        shutil.copy(astyle_build_directory + "/bin/AStyle.exe", dist_astyle_bin)
    elif vscfg ==  libastyle.STATIC:
        shutil.copy(astyle_build_directory + "/binstatic/AStyle.exe", dist_astyle_bin)
    else:
        libastyle.system_exit("Invalid compile configuration: " + vscfg)

    # top directory
    dist_top = dist_astyle + "/"
    copy_astyle_top(dist_top, True)

    # build directory
    dist_build = dist_astyle + "/build"
    os.mkdir(dist_build)
    copy_windows_build_directories(dist_build)

    # doc directory
    dist_doc = dist_astyle + "/doc/"
    os.mkdir(dist_doc)
    copy_astyle_doc(dist_doc, True)

    # src directory
    dist_src = dist_astyle + "/src/"
    os.mkdir(dist_src)
    copy_astyle_src(dist_src, True)

    # create zip
    zipfile = "AStyle_{0}_windows.zip".format(__release)
    call_7zip(dist_base, zipfile)
Esempio n. 3
0
def build_windows_distribution():
    """Copy astyle files to the windows directory.
    """
    print()
    print("* * * * * * * * * * * * * * * * * * * * * * * * * * * * *")
    print("*          Copying AStyle Windows Distribution          *")
    print("* * * * * * * * * * * * * * * * * * * * * * * * * * * * *")
    print("Building release", __release)
    vsdir = libastyle.VS_RELEASE
    print("Compiling with", vsdir)
    if not vsdir >= "vs2013":
        libastyle.system_exit(
            "Must compile with vs2013 or greater in libastyle: " + vsdir)
    dist_base = __base_dir + "/DistWindows"
    dist_astyle = dist_base + "/AStyle"
    os.makedirs(dist_astyle)
    libastyle.build_astyle_executable(libastyle.STATIC_XP)

    # Windows includes an executable in the bin directory
    print("copying exe ({0})".format(vsdir))
    dist_astyle_bin = dist_astyle + "/bin/"
    os.mkdir(dist_astyle_bin)
    astyle_build_directory = libastyle.get_astyle_build_directory(
        libastyle.STATIC_XP)
    shutil.copy(astyle_build_directory + "/binstatic_xp/AStyle.exe",
                dist_astyle_bin)

    # top directory
    dist_top = dist_astyle + "/"
    copy_astyle_top(dist_top, True)

    # build directory
    dist_build = dist_astyle + "/build"
    os.mkdir(dist_build)
    copy_windows_build_directories(dist_build)

    # doc directory
    dist_doc = dist_astyle + "/doc/"
    os.mkdir(dist_doc)
    copy_astyle_doc(dist_doc, True)

    # src directory
    dist_src = dist_astyle + "/src/"
    os.mkdir(dist_src)
    copy_astyle_src(dist_src, True)

    # create zip
    zipfile = "AStyle_{0}_windows.zip".format(__release)
    call_7zip(dist_base, zipfile)
Esempio n. 4
0
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()
Esempio n. 5
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. 6
0
def build_windows_distribution():
	"""Copy astyle files to the windows directory.
	"""
	print()
	print("* * * * * * * * * * * * * * * * * * * * * * * * * * * * *")
	print("*             Copying Windows Distribution              *")
	print("* * * * * * * * * * * * * * * * * * * * * * * * * * * * *")
	print("Building release", __release)
	vsdir = libastyle.VS_RELEASE
	print("Compiling with", vsdir)
	if not vsdir >= "vs2013":
		libastyle.system_exit("Must compile with vs2013 in libastyle: "  + vsdir)
	dist_base = __base_dir + "/DistWindows"
	dist_astyle = dist_base + "/AStyle"
	os.makedirs(dist_astyle)

	# Windows includes an executable in the bin directory
	libastyle.build_astyle_executable(libastyle.STATIC)
	dist_astyle_bin = dist_astyle +  "/bin/"
	os.mkdir(dist_astyle_bin)
	astyle_build_directory = libastyle.get_astyle_build_directory(libastyle.STATIC)
	shutil.copy(astyle_build_directory + "/binstatic/AStyle.exe", dist_astyle_bin)
	print("exe copied ({0})".format(vsdir))

	# top directory
	dist_top = dist_astyle + "/"
	copy_astyle_top(dist_top, True)

	# doc directory
	dist_doc = dist_astyle + "/doc/"
	os.mkdir(dist_doc)
	copy_astyle_doc(dist_doc, True)

	# src directory
	dist_src = dist_astyle +  "/src/"
	os.mkdir(dist_src)
	copy_astyle_src(dist_src, True)

	# build directory
	astyle_build_dir = __astyle_dir + "/build"
	dist_astyle_build = dist_astyle +  "/build"
	os.mkdir(dist_astyle_build)
	copy_vs20xx_directories(astyle_build_dir, dist_astyle_build)

	# create zip
	zipfile = "AStyle_{0}_windows.zip".format(__release)
	call_7zip(dist_base, zipfile)
Esempio n. 7
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)
Esempio n. 8
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. 9
0
def build_windows_distribution():
    """Copy astyle files to the windows directory.
	"""
    print()
    print("* * * * * * * * * * * * * * * * * * * * * * * * * * * * *")
    print("*             Copying Windows Distribution              *")
    print("* * * * * * * * * * * * * * * * * * * * * * * * * * * * *")
    dist_base = __base_dir + "/DistWindows"
    dist_astyle = dist_base + "/AStyle"
    vsdir = libastyle.VS_RELEASE
    if vsdir != "vs2010":
        libastyle.system_exit("Must compile with vs2010 in libastyle: " +
                              vsdir)
    os.makedirs(dist_astyle)

    # Windows includes an executable in the bin directory
    libastyle.build_astyle_executable(libastyle.STATIC)
    dist_astyle_bin = dist_astyle + "/bin/"
    os.mkdir(dist_astyle_bin)
    astyle_build_directory = libastyle.get_astyle_build_directory(
        libastyle.STATIC)
    shutil.copy(astyle_build_directory + "/binstatic/AStyle.exe",
                dist_astyle_bin)
    print("exe copied ({0})".format(vsdir))

    # doc directory
    dist_doc = dist_astyle + "/doc/"
    os.mkdir(dist_doc)
    copy_astyle_doc(dist_doc, True)

    # src directory
    dist_src = dist_astyle + "/src/"
    os.mkdir(dist_src)
    copy_astyle_src(dist_src, True)

    # build directory
    astyle_build_dir = __astyle_dir + "/build"
    dist_astyle_build = dist_astyle + "/build"
    os.mkdir(dist_astyle_build)
    # copy_vs2003_directory(astyle_build_dir, dist_astyle_build)
    copy_vs20xx_directories(astyle_build_dir, dist_astyle_build)

    # create zip
    zipfile = "AStyle_{0}_windows.zip".format(__release)
    call_7zip(dist_base, zipfile)
Esempio n. 10
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. 11
0
def build_windows_distribution():
    """Copy astyle files to the windows directory.
	"""
    print
    print "* * * * * * * * * * * * * * * * * * * * * * * * * * * * *"
    print "*             Copying Windows Distribution              *"
    print "* * * * * * * * * * * * * * * * * * * * * * * * * * * * *"
    distBase = baseDir + "/DistWindows"
    distAStyle = distBase + "/AStyle"
    os.makedirs(distAStyle)

    # Windows includes an executable in the bin directory
    libastyle.build_astyle_executable(libastyle.STATIC)
    distAStyleBin = distAStyle + "/bin/"
    os.mkdir(distAStyleBin)
    astyle_build_directory = libastyle.get_astyle_build_directory(
        libastyle.STATIC)
    shutil.copy(astyle_build_directory + "/binstatic/AStyle.exe",
                distAStyleBin)
    vsi = astyle_build_directory.find("vs20")
    if vsi != -1:
        vsdir = astyle_build_directory[vsi:vsi + 6]
    print "exe copied ({0})".format(vsdir)

    # doc directory
    distDoc = distAStyle + "/doc/"
    os.mkdir(distDoc)
    copy_astyle_doc(distDoc, True)

    # src directory
    distSrc = distAStyle + "/src/"
    os.mkdir(distSrc)
    copy_astyle_src(distSrc, True)

    # build directory
    astyleBuildDir = astyleDir + "/build"
    distAStyleBuild = distAStyle + "/build"
    os.mkdir(distAStyleBuild)
    # copy_vs2003_directory(astyleBuildDir, distAStyleBuild)
    copy_vs20xx_directories(astyleBuildDir, distAStyleBuild)

    # create zip
    zipfile = "AStyle_{0}_windows.zip".format(release)
    call_7zip(distBase, zipfile)
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)
Esempio n. 13
0
def build_windows_distribution():
	"""Copy astyle files to the windows directory.
	"""
	print ()
	print ("* * * * * * * * * * * * * * * * * * * * * * * * * * * * *")
	print ("*             Copying Windows Distribution              *")
	print ("* * * * * * * * * * * * * * * * * * * * * * * * * * * * *")
	distBase = baseDir + "/DistWindows"
	distAStyle = distBase + "/AStyle"
	os.makedirs(distAStyle)

	# Windows includes an executable in the bin directory
	libastyle.build_astyle_executable(libastyle.STATIC)
	distAStyleBin = distAStyle +  "/bin/"
	os.mkdir(distAStyleBin)
	astyle_build_directory = libastyle.get_astyle_build_directory(libastyle.STATIC)
	shutil.copy(astyle_build_directory + "/binstatic/AStyle.exe", distAStyleBin)
	vsi = astyle_build_directory.find("vs20")
	if vsi != -1:
		vsdir = astyle_build_directory[vsi:vsi+6]
	print ("exe copied ({0})".format(vsdir))

	# doc directory
	distDoc = distAStyle + "/doc/"
	os.mkdir(distDoc)
	copy_astyle_doc(distDoc, True)

	# src directory
	distSrc = distAStyle +  "/src/"
	os.mkdir(distSrc)
	copy_astyle_src(distSrc, True)

	# build directory
	astyleBuildDir = astyleDir + "/build"
	distAStyleBuild = distAStyle +  "/build"
	os.mkdir(distAStyleBuild)
	# copy_vs2003_directory(astyleBuildDir, distAStyleBuild)
	copy_vs20xx_directories(astyleBuildDir, distAStyleBuild)

	# create zip
	zipfile = "AStyle_{0}_windows.zip".format(release)
	call_7zip(distBase, zipfile)
Esempio n. 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"
    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. 15
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. 16
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)
Esempio n. 17
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. 18
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)