Пример #1
0
def makeDllEntryPoint(source_path, dest_path, package_name):
    assert type(dest_path) not in (tuple, list)
    assert type(source_path) not in (tuple, list)

    dest_path = os.path.join(getStandaloneDirectoryPath(), dest_path)

    return makeIncludedEntryPoint("dll", source_path, dest_path, package_name)
Пример #2
0
def makeDllEntryPoint(source_path, dest_path, package_name):
    assert type(dest_path) not in (tuple, list)
    assert type(source_path) not in (tuple, list)
    assert isRelativePath(dest_path), dest_path

    assert os.path.exists(source_path), source_path

    dest_path = os.path.join(getStandaloneDirectoryPath(), dest_path)

    return makeIncludedEntryPoint("dll",
                                  source_path,
                                  dest_path,
                                  package_name,
                                  executable=False)
Пример #3
0
def addShlibEntryPoint(module):
    target_filename = os.path.join(getStandaloneDirectoryPath(),
                                   *module.getFullName().split("."))
    target_filename += getSharedLibrarySuffix(preferred=False)

    target_dir = os.path.dirname(target_filename)

    if not os.path.isdir(target_dir):
        makePath(target_dir)

    shutil.copyfile(module.getFilename(), target_filename)

    standalone_entry_points.append(
        makeExtensionModuleEntryPoint(
            source_path=module.getFilename(),
            dest_path=target_filename,
            package_name=module.getFullName().getPackageName(),
        ))
Пример #4
0
def makeDllEntryPoint(source_path, dest_path, package_name):
    # TODO: Get rid of makeDllEntryPointOld by doing this uniformly here.
    dest_path = os.path.join(getStandaloneDirectoryPath(), dest_path)

    return makeIncludedEntryPoint("dll", source_path, dest_path, package_name)
Пример #5
0
def _handleDataFile(included_datafile):
    """Handle a data file."""
    tracer = included_datafile.tracer

    if not isinstance(included_datafile,
                      (IncludedDataFile, IncludedDataDirectory)):
        tracer.sysexit(
            "Error, can only accept 'IncludedData*' objects from plugins.")

    if not isStandaloneMode():
        tracer.sysexit(
            "Error, package data files are only included in standalone or onefile mode."
        )

    dist_dir = getStandaloneDirectoryPath()

    if included_datafile.kind == "empty_dirs":
        tracer.info("Included empty directories '%s' due to %s." % (
            ",".join(included_datafile.dest_path),
            included_datafile.reason,
        ))

        for sub_dir in included_datafile.dest_path:
            created_dir = os.path.join(dist_dir, sub_dir)

            makePath(created_dir)
            putTextFileContents(filename=os.path.join(created_dir,
                                                      ".keep_dir.txt"),
                                contents="")
    elif included_datafile.kind == "data_blob":
        dest_path = os.path.join(dist_dir, included_datafile.dest_path)
        makePath(os.path.dirname(dest_path))

        putTextFileContents(filename=dest_path,
                            contents=included_datafile.data)

        tracer.info("Included data file '%s' due to %s." % (
            included_datafile.dest_path,
            included_datafile.reason,
        ))
    elif included_datafile.kind == "data_file":
        dest_path = os.path.join(dist_dir, included_datafile.dest_path)

        tracer.info("Included data file '%s' due to %s." % (
            included_datafile.dest_path,
            included_datafile.reason,
        ))

        makePath(os.path.dirname(dest_path))
        copyFileWithPermissions(source_path=included_datafile.source_path,
                                dest_path=dest_path)
    elif included_datafile.kind == "data_dir":
        dest_path = os.path.join(dist_dir, included_datafile.dest_path)
        makePath(os.path.dirname(dest_path))

        copied = []

        for filename in getFileList(
                included_datafile.source_path,
                ignore_dirs=included_datafile.ignore_dirs,
                ignore_filenames=included_datafile.ignore_filenames,
                ignore_suffixes=included_datafile.ignore_suffixes,
                only_suffixes=included_datafile.only_suffixes,
                normalize=included_datafile.normalize,
        ):
            filename_relative = os.path.relpath(filename,
                                                included_datafile.source_path)

            filename_dest = os.path.join(dest_path, filename_relative)
            makePath(os.path.dirname(filename_dest))

            copyFileWithPermissions(source_path=filename,
                                    dest_path=filename_dest)

            copied.append(filename_relative)

        tracer.info("Included data dir %r with %d files due to: %s." % (
            included_datafile.dest_path,
            len(copied),
            included_datafile.reason,
        ))
    else:
        assert False, included_datafile