コード例 #1
0
def MakeFile(quiet,
             output_file,
             input_file,
             no_git_hash,
             custom_for_pub,
             version_file=None):
    if version_file:
        version_string = utils.GetVersion(no_git_hash, version_file)
    else:
        version_string = MakeVersionString(quiet, no_git_hash, custom_for_pub)

    version_cc_text = open(input_file).read()
    version_cc_text = version_cc_text.replace("{{VERSION_STR}}",
                                              version_string)
    channel = utils.GetChannel()
    version_cc_text = version_cc_text.replace("{{CHANNEL}}", channel)
    version_time = utils.GetGitTimestamp()
    if no_git_hash or version_time == None:
        version_time = "Unknown timestamp"
    version_cc_text = version_cc_text.replace("{{COMMIT_TIME}}",
                                              version_time.decode("utf-8"))
    abi_version = utils.GetAbiVersion(version_file)
    version_cc_text = version_cc_text.replace("{{ABI_VERSION}}", abi_version)
    oldest_supported_abi_version = utils.GetOldestSupportedAbiVersion(
        version_file)
    version_cc_text = version_cc_text.replace(
        "{{OLDEST_SUPPORTED_ABI_VERSION}}", oldest_supported_abi_version)
    snapshot_hash = MakeSnapshotHashString()
    version_cc_text = version_cc_text.replace("{{SNAPSHOT_HASH}}",
                                              snapshot_hash)
    open(output_file, 'w').write(version_cc_text)
    return True
コード例 #2
0
def FormatVersionString(version,
                        no_git_hash,
                        custom_for_pub,
                        version_file=None,
                        git_revision_file=None):
    use_git_hash = not no_git_hash

    semantic_sdk_version = utils.GetSemanticSDKVersion(no_git_hash,
                                                       version_file,
                                                       git_revision_file)
    semantic_version_format = GetSemanticVersionFormat(no_git_hash,
                                                       custom_for_pub)
    version_str = (semantic_sdk_version
                   if version_file else semantic_version_format)

    version = version.replace('{{VERSION_STR}}', version_str)

    version = version.replace('{{SEMANTIC_SDK_VERSION}}', semantic_sdk_version)

    if custom_for_pub:
        # LATEST is only used for custom_for_pub.
        latest = None
        if use_git_hash:
            # If grabbing the dev tag fails, then fall back on the default VERSION file.
            latest = utils.GetLatestDevTag()
        if not latest:
            latest = utils.GetSemanticSDKVersion(no_git_hash=True)
        version = version.replace('{{LATEST}}', latest)

        version = version.replace('{{PUB_CUSTOM}}', custom_for_pub)

    git_hash = None
    if use_git_hash:
        git_hash = utils.GetShortGitHash()
    if git_hash is None or len(git_hash) != 10:
        git_hash = '0000000000'
    version = version.replace('{{GIT_HASH}}', git_hash)

    channel = utils.GetChannel()
    version = version.replace('{{CHANNEL}}', channel)

    version_time = None
    if use_git_hash:
        version_time = utils.GetGitTimestamp()
    if version_time == None:
        version_time = 'Unknown timestamp'
    version = version.replace('{{COMMIT_TIME}}', version_time.decode('utf-8'))

    abi_version = utils.GetAbiVersion(version_file)
    version = version.replace('{{ABI_VERSION}}', abi_version)

    oldest_supported_abi_version = utils.GetOldestSupportedAbiVersion(
        version_file)
    version = version.replace('{{OLDEST_SUPPORTED_ABI_VERSION}}',
                              oldest_supported_abi_version)

    snapshot_hash = MakeSnapshotHashString()
    version = version.replace('{{SNAPSHOT_HASH}}', snapshot_hash)

    return version
コード例 #3
0
ファイル: make_version.py プロジェクト: zmtzawqlp/sdk
def MakeFile(quiet, output_file, input_file, no_git_hash, custom_for_pub):
    version_cc_text = open(input_file).read()
    version_string = MakeVersionString(quiet, no_git_hash, custom_for_pub)
    version_cc_text = version_cc_text.replace("{{VERSION_STR}}",
                                              version_string)
    version_time = utils.GetGitTimestamp()
    if no_git_hash or version_time == None:
        version_time = "Unknown timestamp"
    version_cc_text = version_cc_text.replace("{{COMMIT_TIME}}", version_time)
    snapshot_hash = MakeSnapshotHashString()
    version_cc_text = version_cc_text.replace("{{SNAPSHOT_HASH}}",
                                              snapshot_hash)
    open(output_file, 'w').write(version_cc_text)
    return True
コード例 #4
0
ファイル: make_version.py プロジェクト: mfiels/sdk
def makeFile(quiet, output_file, input_file, ignore_svn_revision):
    version_cc_text = open(input_file).read()
    version_string = makeVersionString(quiet, ignore_svn_revision)
    version_cc_text = version_cc_text.replace("{{VERSION_STR}}",
                                              version_string)
    version_time = utils.GetGitTimestamp()
    if version_time == None:
        version_time = "Unknown timestamp"
    version_cc_text = version_cc_text.replace("{{COMMIT_TIME}}", version_time)
    snapshot_hash = makeSnapshotHashString()
    version_cc_text = version_cc_text.replace("{{SNAPSHOT_HASH}}",
                                              snapshot_hash)
    open(output_file, 'w').write(version_cc_text)
    return True
コード例 #5
0
ファイル: make_version.py プロジェクト: mingsai/dartlang-sdk
def FormatVersionString(version,
                        no_git_hash,
                        no_sdk_hash,
                        version_file=None,
                        git_revision_file=None):
    semantic_sdk_version = utils.GetSemanticSDKVersion(no_git_hash,
                                                       version_file,
                                                       git_revision_file)
    semantic_version_format = GetSemanticVersionFormat(no_git_hash)
    version_str = (semantic_sdk_version
                   if version_file else semantic_version_format)

    version = version.replace('{{VERSION_STR}}', version_str)

    version = version.replace('{{SEMANTIC_SDK_VERSION}}', semantic_sdk_version)

    git_hash = None
    # If we need SDK hash and git usage is not suppressed then try to get it.
    if not no_sdk_hash and not no_git_hash:
        git_hash = utils.GetShortGitHash()
    if git_hash is None or len(git_hash) != 10:
        git_hash = '0000000000'
    version = version.replace('{{GIT_HASH}}', git_hash)

    channel = utils.GetChannel()
    version = version.replace('{{CHANNEL}}', channel)

    version_time = None
    if not no_git_hash:
        version_time = utils.GetGitTimestamp()
    if version_time == None:
        version_time = 'Unknown timestamp'
    version = version.replace('{{COMMIT_TIME}}', version_time)

    snapshot_hash = MakeSnapshotHashString()
    version = version.replace('{{SNAPSHOT_HASH}}', snapshot_hash)

    return version
コード例 #6
0
def FormatVersionString(version,
                        no_git_hash,
                        version_file=None,
                        git_revision_file=None):
    use_git_hash = not no_git_hash

    semantic_sdk_version = utils.GetSemanticSDKVersion(no_git_hash,
                                                       version_file,
                                                       git_revision_file)
    semantic_version_format = GetSemanticVersionFormat(no_git_hash)
    version_str = (semantic_sdk_version
                   if version_file else semantic_version_format)

    version = version.replace('{{VERSION_STR}}', version_str)

    version = version.replace('{{SEMANTIC_SDK_VERSION}}', semantic_sdk_version)

    git_hash = None
    if use_git_hash:
        git_hash = utils.GetShortGitHash()
    if git_hash is None or len(git_hash) != 10:
        git_hash = '0000000000'
    version = version.replace('{{GIT_HASH}}', git_hash)

    channel = utils.GetChannel()
    version = version.replace('{{CHANNEL}}', channel)

    version_time = None
    if use_git_hash:
        version_time = utils.GetGitTimestamp()
    if version_time == None:
        version_time = 'Unknown timestamp'
    version = version.replace('{{COMMIT_TIME}}', version_time.decode('utf-8'))

    snapshot_hash = MakeSnapshotHashString()
    version = version.replace('{{SNAPSHOT_HASH}}', snapshot_hash)

    return version