Example #1
0
def copy_script_file(self,
                     infile,
                     outfile,
                     preserve_mode=1,
                     preserve_times=1,
                     link=None,
                     level=1,
                     tagdict={}):
    """
    Override of basic copy file method in distutil.cmd to
    perform tag replacements for script files.
    """
    Command.copy_file(self, infile, outfile, preserve_mode, preserve_times,
                      link, level)
    self.set_undefined_options('install', ('install_base', 'install_base'))

    # Now update the outfile with tags
    tagdict['_application_prefix'] = self.install_base
    tagdict['_application_name'] = os.path.basename(infile)

    for key in TAGDICT:
        if key not in tagdict.keys():
            tagdict[key] = TAGDICT[key]

    replace_tags(outfile, tagdict, self.dry_run)
Example #2
0
def _exec_cmake_build(sdist_cmd: Command):
    mkpath(SDIST_TEMP)

    cmake_build_dir = path.join(SDIST_TEMP, 'cmake_build')
    mkpath(cmake_build_dir)

    cmake_args = [
        '-DCMAKE_BUILD_TYPE=Release',
        '-DAKASHI_BUILD_TESTS=OFF',
    ]

    if 'CUSTOM_BOOST_TAR_PATH' in os.environ.keys():
        cmake_args.append('-DAKASHI_BOOST_TAR_PATH=' +
                          os.environ['CUSTOM_BOOST_TAR_PATH'])

    build_concurrency = 4 if os.cpu_count() is None else cast(
        int, os.cpu_count()) * 2
    build_args = ['--', f'-j{build_concurrency}']

    sdist_cmd.spawn(['cmake', '-S', 'akashi_engine', '-B', cmake_build_dir] +
                    cmake_args)

    sdist_cmd.spawn(['cmake', '--build', cmake_build_dir] + build_args)

    sdist_cmd.copy_file(path.join(cmake_build_dir, BIN_NAME), SDIST_TEMP)
    sdist_cmd.copy_file(path.join(cmake_build_dir, ENCODER_BIN_NAME),
                        SDIST_TEMP)
    sdist_cmd.copy_file(path.join(cmake_build_dir, KERNEL_BIN_NAME),
                        SDIST_TEMP)
    sdist_cmd.copy_file(path.join(cmake_build_dir, LIBAKPROBE_NAME),
                        SDIST_TEMP)

    sdist_credits_dir = path.join(SDIST_TEMP, 'credits')
    mkpath(sdist_credits_dir)
    sdist_cmd.copy_tree(path.join('akashi_engine', 'credits'),
                        sdist_credits_dir)
    sdist_cmd.copy_tree(path.join(SDIST_TEMP, 'vendor', 'credits'),
                        sdist_credits_dir)

    sdist_assets_dir = path.join(SDIST_TEMP, 'assets')
    mkpath(sdist_assets_dir)
    sdist_cmd.copy_tree(path.join('akashi_engine', 'src', 'akui', 'assets'),
                        sdist_assets_dir)

    sdist_lib_dir = path.join(SDIST_TEMP, 'lib')
    mkpath(sdist_lib_dir)
    sdist_cmd.copy_tree(path.join(SDIST_TEMP, 'vendor', 'lib'), sdist_lib_dir)
    sdist_cmd.copy_file(path.join(cmake_build_dir, LIBAKEVAL_NAME),
                        sdist_lib_dir)

    remove_tree(cmake_build_dir)
    remove_tree(path.join(SDIST_TEMP, "vendor"))
    remove_tree(path.join(SDIST_TEMP, "shared_temp"))
Example #3
0
def copy_std_file(self, infile, outfile, preserve_mode=1, preserve_times=1, link=None, level=1, tagdict={}):
    """
    Override of basic copy file method in distutil.cmd to
    perform tag replacements for most files.
    """
    Command.copy_file(self, infile, outfile, preserve_mode, preserve_times, link, level)
    # Now update the outfile with tags
    tagdict['_application_name'] = os.path.basename(infile)

    for key in TAGDICT:
        if key not in tagdict.keys():
            tagdict[key] = TAGDICT[key]

    replace_tags(outfile, tagdict, self.dry_run)