コード例 #1
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:
        # 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)
コード例 #2
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)
コード例 #3
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.'
    )
コード例 #4
0
ファイル: updateVcpkgPackage.py プロジェクト: 0x1997/Catch
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)
コード例 #5
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)
コード例 #6
0
ファイル: updateVcpkgPackage.py プロジェクト: dvp2015/Catch2
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.')
コード例 #7
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() ) )
コード例 #8
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()))
コード例 #9
0
ファイル: patchRelease.py プロジェクト: 0x1997/Catch
#!/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() ) )
            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")
コード例 #11
0
ファイル: minorRelease.py プロジェクト: BMBurstein/Catch
#!/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() ) )
コード例 #12
0
ファイル: generateSingleHeader.py プロジェクト: Dagarman/mame
                    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' )

out.write( "#endif // TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n\n" )