<commit_before># -*- coding: utf-8 -*-

#-------------------------------------------------------------------------------
from datetime import date

import os
import fnmatch
import stat
import os.path
import tempfile;
import shutil

from commands.command       import *
from utilities.compression  import *
from utilities.files        import *
from utilities.hashing      import *
from utilities.paths        import *
from utilities.processes    import *
from utilities.perforce     import *

SYMBOLS_FILE_PATTERNS    = [ "*.map", "*.pdb" ]

#-------------------------------------------------------------------------------
class PublishSymbols(Command):
    #---------------------------------------------------------------------------
    def __init__(self):
        Command.__init__(self, "publish-symbols", "Publishes symbols to shared directory")

    #---------------------------------------------------------------------------
    def configure_arguments(self, context, parser):
        parser.add_argument('platform',
                            help    = 'Platform to publish binaries from',
                            metavar = '<platform>')

        return True

    #---------------------------------------------------------------------------
    def run(self, context):
        settings            = context.settings
        arguments           = context.arguments

        head_cl             = p4_get_last_synced_changelist()
        platform            = arguments.platform

        source_format       = settings.symbols_source
        destination_format  = settings.symbols_destination
        source              = source_format.format(platform = platform)
        destination         = destination_format.format(platform = platform, change_list = head_cl)

        mkdir(destination)

        for pattern in SYMBOLS_FILE_PATTERNS:
            for root, directories, filenames in os.walk(source):
                for filename in fnmatch.filter(filenames, '*.pdb'):
                    symbol_path           = os.path.join(root, filename)
                    relative_destination  = os.path.relpath(symbol_path, source)
                    symbol_destination    = os.path.join(destination, relative_destination)
                    destination_directory = os.path.dirname(symbol_destination)

                    if not os.path.isdir(destination_directory):
                        mkdir(destination_directory)

                    try:
                        shutil.copy(symbol_path, symbol_destination)
                    except Exception as ex:
                        log_warning("Unable to copy {0} : {1}", symbol_path, ex)<commit_msg>Fix missing .map files when publishing symbols [Rev:SHO][PC]<commit_after># -*- coding: utf-8 -*-

#-------------------------------------------------------------------------------
from datetime import date

import os
import fnmatch
import stat
import os.path
import tempfile;
import shutil

from commands.command       import *
from utilities.compression  import *
from utilities.files        import *
from utilities.hashing      import *
from utilities.paths        import *
from utilities.processes    import *
from utilities.perforce     import *

SYMBOLS_FILE_PATTERNS    = [ "*.map", "*.pdb" ]

#-------------------------------------------------------------------------------
class PublishSymbols(Command):
    #---------------------------------------------------------------------------
    def __init__(self):
        Command.__init__(self, "publish-symbols", "Publishes symbols to shared directory")

    #---------------------------------------------------------------------------
    def configure_arguments(self, context, parser):
        parser.add_argument('platform',
                            help    = 'Platform to publish binaries from',
                            metavar = '<platform>')

        return True

    #---------------------------------------------------------------------------
    def run(self, context):
        settings            = context.settings
        arguments           = context.arguments

        head_cl             = p4_get_last_synced_changelist()
        platform            = arguments.platform

        source_format       = settings.symbols_source
        destination_format  = settings.symbols_destination
        source              = source_format.format(platform = platform)
        destination         = destination_format.format(platform = platform, change_list = head_cl)

        mkdir(destination)

        for pattern in SYMBOLS_FILE_PATTERNS:
            for root, directories, filenames in os.walk(source):
                for filename in fnmatch.filter(filenames, pattern):
                    symbol_path           = os.path.join(root, filename)
                    relative_destination  = os.path.relpath(symbol_path, source)
                    symbol_destination    = os.path.join(destination, relative_destination)
                    destination_directory = os.path.dirname(symbol_destination)

                    if not os.path.isdir(destination_directory):
                        mkdir(destination_directory)

                    try:
                        shutil.copy(symbol_path, symbol_destination)
                    except Exception as ex:
                        log_warning("Unable to copy {0} : {1}", symbol_path, ex)
{'fraction_non_alphanumeric': 0.20846541115047548, 'fraction_numerical': 0.0014917024053701287, 'mean_word_length': 1.3120689655172413, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4092104', 'n_tokens_mistral': 1192, 'n_tokens_neox': 1126, 'n_words': 280}