Python setuptools package_data - pip fails on subfolders

六眼飞鱼酱① 提交于 2019-12-23 17:08:08

问题


I am trying to make my own pip package installation to work and I have troubles with subfolders in additional data specified in package_data. Everything seems to be fine (all data are included in produced .zip file), but when I run "pip install myapp", it says: "error: can't copy 'myapp\web\styles': doesn't exist or not a regular file"

Dirtree:

projectDir
  setup.py
  myapp
    __init__.py
    webapp.py
    web
      index.html
      styles
        style.css

setup.py:

from setuptools import setup
    setup (
        zip_safe = False,
        name = "myapp",
        version = "0.1",
        packages = ["myapp"],
        include_package_data = True,
        package_data = {
            "myapp": ["web/*", "web/styles/*"]
        }
    )

Command to create package:

python setup.py sdist

Command to install:

pip install myapp-0.1.zip

I have even try to specify MANIFEST.in (with no success):

include myapp/web/*.*
include myapp/web/styles/*.*

When I specify only MANIFEST.in withou package_data, installation success, but there are no files in site-packages/myapp/web so no package_data were copied.

I am quite desperate because I haven't found any suggestion what I am doing wrong and I have spent long time to make it work.

Thaks for any advice.


回答1:


Ok, so I have a solution: I have used only MANIFEST.in and removed package_data from setup.py and everything works fine. I thought I have tried this before, but I was wrong.



来源:https://stackoverflow.com/questions/33859550/python-setuptools-package-data-pip-fails-on-subfolders

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