Pybuilder - Non-python files are not packaged

蓝咒 提交于 2020-02-06 03:39:08

问题


My current project is in python. For build package generation + unit test running, I'm using Pybuilder utility and it is pretty cool. I used the wheel distribution to install the module in other systems.

There exist a config file from which certain settings are read by the application. settings.ini file is in following path,

PROJECT-ROOT
     |---- src
            |-main
                |-python
                     |- foo
                         |- conf
                         |   |- settings.ini
                         |
                         |-test.py
                         |-access.py

pybuilder automatically creates setup.py from the build.py script. The problem is that the binary wheel distribution is not packaging the non-python files(*.ini file). While searching on SO posts, got information like adding in MANIFEST.mf will resolve this issue. But while adding

 project._manifest_include_directory('foo/conf', ('*.ini',))

It only updated foo/conf/settings.ini in sdist and not on the bdist(wheel). I want the wheel file to include settings.ini in the conf/ directory. On googling, got information that addition of package_data field in setup.py will resolve this issue. But with Pybuilder's build.py, I'm unable to do this successfully.

Can any one help me to resolve this issue?


回答1:


I've emailed Max(https://github.com/mriehl), who is one among the contributor of PyBuilder code in github. He suggested me to try project.install_file() option.

I tried that option and it worked for me. Thanks to Max. I want to share that info in this thread, so that it will be useful to someone in future !

In the background project.install_file() is modifying data_files part of setup.py of distutils.

My configuration in the build.py are as follows,

@init
def initialize (project):

    # File is installed relative to sys.prefix
    project.install_file("Lib/site-packages/foo/conf","foo/conf/settings.ini")


来源:https://stackoverflow.com/questions/37409282/pybuilder-non-python-files-are-not-packaged

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!