Example #1
0
def git_push(path_to_repo):
    v = Version()
    ver_string = v.getVersionString()

    os.chdir(path_to_repo)

    # Work with git
    # Make sure we branch off master
    subprocess.call('git checkout master', shell=True)

    # Update repo to current master, so we don't work off old version of the portsfile
    subprocess.call('git pull Microsoft master', shell=True)
    subprocess.call('git push', shell=True)

    # Create a new branch for the update
    subprocess.call('git checkout -b catch-{}'.format(ver_string), shell=True)
    # Add changed files (should be only our files)
    subprocess.call('git add -u .', shell=True)
    # Create a commit with these changes
    subprocess.call('git commit -m "Update Catch to {}"'.format(ver_string),
                    shell=True)
    # Don't push, so author can review
    print(
        'Changes were commited to the vcpkg fork. Please check, push and open PR.'
    )
def update_portfile(path, header_hash, licence_hash):
    print('Updating portfile')
    v = Version()
    ver_string = v.getVersionString()

    # Update portfile
    lines = []
    portfile_path = os.path.join(path, 'portfile.cmake')
    with open(portfile_path, 'r') as f:
        for line in f:
            lines.append(line)
    with open(portfile_path, 'w') as f:
        # There are three things we need to change/update
        # 1) CATCH_VERSION cmake variable
        # 2) Hash of header
        # 3) Hash of licence
        # We could assume licence never changes, but where is the fun in that?
        for line in lines:
            # Update the version
            if 'set(CATCH_VERSION' in line:
                line = 'set(CATCH_VERSION v{})\n'.format(v.getVersionString())

            # Determine which file we are updating
            if 'vcpkg_download_distfile' in line:
                kind = line.split('(')[-1].strip()

            # Update the hashes
            if 'SHA512' in line and kind == 'HEADER':
                line = '    SHA512 {}\n'.format(header_hash)
            if 'SHA512' in line and kind == 'LICENSE':
                line = '    SHA512 {}\n'.format(licence_hash)
            f.write(line)
Example #3
0
def update_portfile(path, header_hash, licence_hash):
    print('Updating portfile')
    v = Version()
    ver_string = v.getVersionString()

    # Update portfile
    lines = []
    portfile_path = os.path.join(path, 'portfile.cmake')
    with open(portfile_path, 'r') as f:
        for line in f:
            lines.append(line)
    with open(portfile_path, 'w') as f:
        # Two things we need to change/update
        # 1) Link and hash of releaseCommon
        # 2) Link and hash of licence
        # We could assume licence never changes, but where is the fun in that?
        first_hash = True
        for line in lines:
            # Check what we are updating
            if 'vcpkg_download_distfile' in line:
                kind = line.split('(')[-1].strip()
                print(kind)

            # Deal with URLS
            if 'URLS' in line and kind == 'HEADER':
                line = '    URLS "https://github.com/philsquared/Catch/releases/download/v{}/catch.hpp"\n'.format(v.getVersionString())
            if 'URLS' in line and kind == 'LICENSE':
                line = '    URLS "https://raw.githubusercontent.com/philsquared/Catch/v{}/LICENSE.txt"\n'.format(v.getVersionString())

            # Deal with hashes
            if 'SHA512' in line and kind == 'HEADER':
                line = '    SHA512 {}\n'.format(header_hash)
            if 'SHA512' in line and kind == 'LICENSE':
                line = '    SHA512 {}\n'.format(licence_hash)
            f.write(line)
def update_control(path):
    v = Version()

    # Update control
    lines = []
    control_path = os.path.join(path, 'CONTROL')
    with open(control_path, 'r') as f:
        for line in f:
            lines.append(line)
    with open(control_path, 'w') as f:
        for line in lines:
            if 'Version: ' in line:
                line = 'Version: {}\n'.format(v.getVersionString())
            f.write(line)
Example #5
0
def update_control(path):
    v = Version()
    ver_string = v.getVersionString()

    # Update control
    lines = []
    control_path = os.path.join(path, 'CONTROL')
    with open(control_path, 'r') as f:
        for line in f:
            lines.append(line)
    with open(control_path, 'w') as f:
        for line in lines:
            if 'Version: ' in line:
                line = 'Version: {}\n'.format(v.getVersionString())
            f.write(line)
def generate_header():
    with open(output_header, mode='w', encoding='utf-8') as header:
        header.write(formatted_file_header(Version()))
        header.write('#ifndef CATCH_AMALGAMATED_HPP_INCLUDED\n')
        header.write('#define CATCH_AMALGAMATED_HPP_INCLUDED\n')
        print('Concatenated {} headers'.format(concatenate_file(header, starting_header, True)))
        header.write('#endif // CATCH_AMALGAMATED_HPP_INCLUDED\n')
def generate_cpp():
    from glob import glob
    cpp_files = sorted(glob(os.path.join(root_path, 'catch2', '**/*.cpp'), recursive=True))
    with open(output_cpp, mode='w', encoding='utf-8') as cpp:
        cpp.write(formatted_file_header(Version()))
        cpp.write('\n#include "catch_amalgamated.hpp"\n')
        for file in cpp_files:
            concatenate_file(cpp, file, False)
    print('Concatenated {} cpp files'.format(len(cpp_files)))
Example #8
0
def git_push(path_to_repo):
    v = Version()
    ver_string = v.getVersionString()

    os.chdir(path_to_repo)

    # Work with git
    # Make sure we branch off master
    subprocess.call('git checkout master', shell=True)
    
    # Update repo to current master, so we don't work off old version of the portsfile 
    subprocess.call('git pull Microsoft master', shell=True)
    subprocess.call('git push', shell=True)

    # Create a new branch for the update
    subprocess.call('git checkout -b catch-{}'.format(ver_string), shell=True)
    # Add changed files (should be only our files)
    subprocess.call('git add -u .', shell=True)
    # Create a commit with these changes
    subprocess.call('git commit -m "Update Catch to {}"'.format(ver_string), shell=True)
    # Don't push, so author can review
    print('Changes were commited to the vcpkg fork. Please check, push and open PR.')
def update_portfile(path, header_hash, licence_hash):
    print('Updating portfile')
    v = Version()
    ver_string = v.getVersionString()

    # Update portfile
    lines = []
    portfile_path = os.path.join(path, 'portfile.cmake')
    with open(portfile_path, 'r') as f:
        for line in f:
            lines.append(line)
    with open(portfile_path, 'w') as f:
        # Two things we need to change/update
        # 1) Link and hash of releaseCommon
        # 2) Link and hash of licence
        # We could assume licence never changes, but where is the fun in that?
        first_hash = True
        for line in lines:
            # Check what we are updating
            if 'vcpkg_download_distfile' in line:
                kind = line.split('(')[-1].strip()
                print(kind)

            # Deal with URLS
            if 'URLS' in line and kind == 'HEADER':
                line = '    URLS "https://github.com/philsquared/Catch/releases/download/v{}/catch.hpp"\n'.format(
                    v.getVersionString())
            if 'URLS' in line and kind == 'LICENSE':
                line = '    URLS "https://raw.githubusercontent.com/philsquared/Catch/v{}/LICENSE.txt"\n'.format(
                    v.getVersionString())

            # Deal with hashes
            if 'SHA512' in line and kind == 'HEADER':
                line = '    SHA512 {}\n'.format(header_hash)
            if 'SHA512' in line and kind == 'LICENSE':
                line = '    SHA512 {}\n'.format(licence_hash)
            f.write(line)
Example #10
0
#!/usr/bin/env python

from __future__ import print_function
from releaseCommon import Version

v = Version()
v.incrementMinorVersion()
v.updateVersionFile()
v.updateReadmeFile()
v.updateConanFile()
v.updateConanTestFile()

print("Updated Version.hpp, README and Conan to v{0}".format(
    v.getVersionString()))
Example #11
0
#!/usr/bin/env python

from  __future__ import  print_function
from releaseCommon import Version

v = Version()
v.incrementPatchNumber()
v.updateVersionFile()
v.updateReadmeFile()

print( "Updated Version.hpp and README to v{0}".format( v.getVersionString() ) )
Example #12
0
#!/usr/bin/env python

from __future__ import print_function
from releaseCommon import Version

v = Version()
v.incrementPatchNumber()
v.updateVersionFile()
v.updateReadmeFile()
v.updateConanFile()
v.updateConanTestFile()

print("Updated Version.hpp, README and Conan to v{0}".format(
    v.getVersionString()))
Example #13
0
#!/usr/bin/env python

from  __future__ import  print_function
from releaseCommon import Version

v = Version()
v.incrementMinorVersion()
v.updateVersionFile()
v.updateReadmeFile()
v.updateConanFile()
v.updateConanTestFile()

print( "Updated Version.hpp, README and Conan to v{0}".format( v.getVersionString() ) )
Example #14
0
    write(u" *  ----------------------------------------------------------\n")
    write(
        u" *  This file has been merged from multiple headers. Please don't edit it directly\n"
    )
    write(u" *  Copyright (c) {} Two Blue Cubes Ltd. All rights reserved.\n".
          format(datetime.date.today().year))
    write(u" *\n")
    write(
        u" *  Distributed under the Boost Software License, Version 1.0. (See accompanying\n"
    )
    write(
        u" *  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n"
    )
    write(u" */\n")
    write(u"#ifndef TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n")
    write(u"#define TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n")

    collectPossibleHeaders()
    parseFile(rootPath, 'catch.hpp')
    warnUnparsedHeaders()

    write(u"#endif // TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n\n")
    out.close()
    print("Generated single include for Catch v{0}\n".format(
        v.getVersionString()))


if __name__ == '__main__':
    from releaseCommon import Version
    generate(Version())
Example #15
0
                    parseFile( path + headerPath + sep, headerFile )
                else:
                    parseFile( rootPath + headerPath + sep, headerFile )
        else:
            if ifImplParser.match(line):
                implIfDefs = ifdefs
            if (not guardParser.match( line ) or defineParser.match( line ) ) and not commentParser1.match( line )and not commentParser2.match( line ):
                if blankParser.match( line ):
                    blanks = blanks + 1
                else:
                    blanks = 0
                if blanks < 2:
                    write( line.rstrip() + "\n" )


v = Version()
out.write( "/*\n" )
out.write( " *  Catch v{0}\n".format( v.getVersionString() ) )
out.write( " *  Generated: {0}\n".format( datetime.datetime.now() ) )
out.write( " *  ----------------------------------------------------------\n" )
out.write( " *  This file has been merged from multiple headers. Please don't edit it directly\n" )
out.write( " *  Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved.\n" )
out.write( " *\n" )
out.write( " *  Distributed under the Boost Software License, Version 1.0. (See accompanying\n" )
out.write( " *  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n" )
out.write( " */\n" )
out.write( "#ifndef TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n" )
out.write( "#define TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n" )

parseFile( rootPath, 'catch.hpp' )
Example #16
0
from  __future__ import  print_function
from releaseCommon import Version

v = Version()
v.incrementMinorVersion()
v.updateVersionFile()
v.updateReadmeFile()

print( "Updated Version.hpp and README to v{0}".format( v.getVersionString() ) )
                    parseFile(rootPath + headerPath + sep, headerFile)
        else:
            if ifImplParser.match(line):
                implIfDefs = ifdefs
            if (not guardParser.match(line)
                    or defineParser.match(line)) and not commentParser1.match(
                        line) and not commentParser2.match(line):
                if blankParser.match(line):
                    blanks = blanks + 1
                else:
                    blanks = 0
                if blanks < 2:
                    write(line.rstrip() + "\n")


v = Version()
out.write("/*\n")
out.write(" *  Catch v{0}\n".format(v.getVersionString()))
out.write(" *  Generated: {0}\n".format(datetime.datetime.now()))
out.write(" *  ----------------------------------------------------------\n")
out.write(
    " *  This file has been merged from multiple headers. Please don't edit it directly\n"
)
out.write(" *  Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved.\n")
out.write(" *\n")
out.write(
    " *  Distributed under the Boost Software License, Version 1.0. (See accompanying\n"
)
out.write(
    " *  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n"
)