make_py2exe.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:PortableApps.com-DevelopmentToolkit 作者: 3D1T0R 项目源码 文件源码
def find_data_files(source, target, patterns):
    """
    Locates the specified data-files and returns the matches in a data_files
    compatible format.

    source is the root of the source data tree.
        Use '' or '.' for current directory.
    target is the root of the target data tree.
        Use '' or '.' for the distribution directory.
    patterns is a sequence of glob-patterns for the
        files you want to copy.

    Modified slightly from http://www.py2exe.org/index.cgi/data_files
    """
    if glob.has_magic(source) or glob.has_magic(target):
        raise ValueError("Magic not allowed in src, target")
    ret = defaultdict(list)
    for pattern in patterns:
        pattern = os.path.join(source, pattern)
        for filename in glob.glob(pattern):
            if os.path.isfile(filename):
                targetpath = os.path.join(target, os.path.relpath(filename,
                    source))
                ret[os.path.dirname(targetpath)].append(filename)
    return sorted(ret.items())
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号