在 setup.py 中包含 logging.conf?

Including logging.conf in setup.py?

在我的 package_name 子目录中("setup.py" 下一个)我有一个 "logging.conf" 文件。

如何将其包含在我的设置中?

尝试

from distutils.sysconfig import get_python_lib

data_files=[(path.join(get_python_lib(), package_name),
                     path.join(path.dirname(__file__), package_name, 'logging.conf'))

最好是像这样简单的东西:

data_files = [(package_name, path.join('.', package_name, 'logging.conf'))]

错误

error: can't copy 'c': doesn't exist or not a regular file

您要将 logging.conf 包含在您的软件包分发中吗?使用 package_data 参数到 setup():

setup(
    name = "package-name",
    packages = ["packagename"],
    package_data= {
        "packagename": [
            "resources/foo.bar",
            "resources/static/css/*",
            "README.md",
            "logging.conf"
        ]},
    ...
    )