Пример #1
0
def putintopackageroot(target, source, env, pkgroot, honor_install_location=1):
    """ Copies all source files to the directory given in pkgroot.

    If honor_install_location is set and the copied source file has an
    PACKAGING_INSTALL_LOCATION attribute, the PACKAGING_INSTALL_LOCATION is
    used as the new name of the source file under pkgroot.

    The source file will not be copied if it is already under the the pkgroot
    directory.

    All attributes of the source file will be copied to the new file.

    Note:
    Uses CopyAs builder.
    """
    # make sure the packageroot is a Dir object.
    if SCons.Util.is_String(pkgroot):
        pkgroot = env.Dir(pkgroot)
    if not SCons.Util.is_List(source):
        source = [source]

    new_source = []
    for file in source:
        if SCons.Util.is_String(file):
            file = env.File(file)

        if file.is_under(pkgroot):
            new_source.append(file)
        else:
            if file.GetTag('PACKAGING_INSTALL_LOCATION') and \
                       honor_install_location:
                new_name = make_path_relative(
                    file.GetTag('PACKAGING_INSTALL_LOCATION'))
            else:
                new_name = make_path_relative(file.get_path())

            new_file = pkgroot.File(new_name)
            new_file = env.CopyAs(new_file, file)[0]
            copy_attr(file, new_file)
            new_source.append(new_file)

    return target, new_source
Пример #2
0
def putintopackageroot(target, source, env, pkgroot, honor_install_location=1):
    """ Uses the CopyAs builder to copy all source files to the directory given
    in pkgroot.

    If honor_install_location is set and the copied source file has an
    PACKAGING_INSTALL_LOCATION attribute, the PACKAGING_INSTALL_LOCATION is
    used as the new name of the source file under pkgroot.

    The source file will not be copied if it is already under the the pkgroot
    directory.

    All attributes of the source file will be copied to the new file.
    """
    # make sure the packageroot is a Dir object.
    if SCons.Util.is_String(pkgroot):
        pkgroot = env.Dir(pkgroot)
    if not SCons.Util.is_List(source):
        source = [source]

    new_source = []
    for file in source:
        if SCons.Util.is_String(file):
            file = env.File(file)

        if file.is_under(pkgroot):
            new_source.append(file)
        else:
            if hasattr(file, 'PACKAGING_INSTALL_LOCATION') and\
                    honor_install_location:
                new_name = make_path_relative(file.PACKAGING_INSTALL_LOCATION)
            else:
                new_name = make_path_relative(file.get_path())

            new_file = pkgroot.File(new_name)
            new_file = env.CopyAs(new_file, file)[0]
            copy_attr(file, new_file)
            new_source.append(new_file)

    return (target, new_source)
Пример #3
0
 def Dir(self, name):
     name = make_path_relative(name)
     return self.dir.Dir(name)
Пример #4
0
 def Entry(self, name):
     name = make_path_relative(name)
     return self.dir.Entry(name)
Пример #5
0
 def Dir(self, name):
     name = make_path_relative(name)
     return self.dir.Dir(name)
Пример #6
0
 def Entry(self, name):
     name = make_path_relative(name)
     return self.dir.Entry(name)