在setup.py(setuptools)中包含静态数据

cum*_*mul 8 python setuptools

我目前正在使用setuptools编写setup.py.我想将静态数据(不是Python模块)复制到site-packages.

问题是,当前文件夹层次结构的结构如下:

setup.py
src
    Pure Python Module
skeleton
    example
        __init__.py
    resources
        static
            error.css
            example.css
            logo_shadow.png
        template
            error.html
            example.html
    server.tmplt
Run Code Online (Sandbox Code Playgroud)

我想将骨架目录复制到site-packages WHILE维护文件夹结构/层次结构,但我该怎么办呢?

cum*_*mul 2

我通过单独处理静态文件而不是使用setuptools解决了这个问题。

from sys import argv
try:
    if argv[1] == 'install':
        from os.path import join
        from distutils.sysconfig import get_python_lib
        from shutil import copytree
        OrigSkeleton = join('src', 'skeleton')
        DestSkeleton = join(get_python_lib(), 'cumulus', 'skeleton')
        copytree(OrigSkeleton, DestSkeleton)

except IndexError: pass
Run Code Online (Sandbox Code Playgroud)