<commit_before>'''Builds an OSX single application package'''

import os
import shutil

from SCons.Script import *


def build_function(target, source, env):
    # Create package build dir
    build_dir = 'build/pkg'
    if os.path.exists(build_dir): shutil.rmtree(build_dir)

    # Make root dir
    root_dir = os.path.join(build_dir, 'root')
    os.makedirs(root_dir, 0775)

    # Apps
    if 'pkg_apps' in env:
        d = os.path.join(root_dir, 'Applications')
        os.makedirs(d, 0775)
        env.InstallFiles('pkg_apps', d, None)

    # Other files
    if 'pkg_files' in env:
        env.InstallFiles('pkg_files', root_dir)

    # pkg_id
    if 'app_id' in env and not 'pkg_id' in env:
        env.Replace(pkg_id = env.get('app_id') + '.pkg')

    # pkgbuild command
    cmd = ['${PKGBUILD}',
           '--root', root_dir,
           '--id', env.get('pkg_id'),
           '--version', env.get('version'),
           '--install-location', env.get('pkg_install_to', '/'),
           ]
    if 'pkg_scripts' in env: cmd += ['--scripts', env.get('pkg_scripts')]
    if 'pkg_plist' in env: cmd += ['--component-plist', env.get('pkg_plist')]
    cmd += [root_dir + '/%s.pkg' % env.get('package_name')]

    env.RunCommand(cmd)
<commit_msg>pkgbuild osx component package outside dest root<commit_after>'''Builds an OSX single application package'''

import os
import shutil

from SCons.Script import *


def build_function(target, source, env):
    # Create package build dir
    build_dir = 'build/pkg'
    if os.path.exists(build_dir): shutil.rmtree(build_dir)

    # Make root dir
    root_dir = os.path.join(build_dir, 'root')
    os.makedirs(root_dir, 0775)

    # Apps
    if 'pkg_apps' in env:
        d = os.path.join(root_dir, 'Applications')
        os.makedirs(d, 0775)
        env.InstallFiles('pkg_apps', d, None)

    # Other files
    if 'pkg_files' in env:
        env.InstallFiles('pkg_files', root_dir)

    # pkg_id
    if 'app_id' in env and not 'pkg_id' in env:
        env.Replace(pkg_id = env.get('app_id') + '.pkg')

    # pkgbuild command
    cmd = ['${PKGBUILD}',
           '--root', root_dir,
           '--id', env.get('pkg_id'),
           '--version', env.get('version'),
           '--install-location', env.get('pkg_install_to', '/'),
           ]
    if 'pkg_scripts' in env: cmd += ['--scripts', env.get('pkg_scripts')]
    if 'pkg_plist' in env: cmd += ['--component-plist', env.get('pkg_plist')]
    cmd += [build_dir + '/%s.pkg' % env.get('package_name')]

    env.RunCommand(cmd)

{'fraction_non_alphanumeric': 0.16019032513877876, 'fraction_numerical': 0.006344171292624901, 'mean_word_length': 2.715758468335788, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1964693', 'n_tokens_mistral': 913, 'n_tokens_neox': 876, 'n_words': 204}