The source for the package is here
I'm installing the package from the index via:
easy_install hackertray
pip install hackertray
easy_install
installs images/hacker-tray.png
to the following folder:
/usr/local/lib/python2.7/dist-packages/hackertray-1.8-py2.7.egg/images/
While, pip
installs it to:
/usr/local/images/
My setup.py is as follows:
from setuptools import setup
setup(name='hackertray',
version='1.8',
description='Hacker News app that sits in your System Tray',
packages=['hackertray'],
data_files=[('images', ['images/hacker-tray.png'])])
My MANIFEST
file is:
include images/hacker-tray.png
Don't use
data_files
with relative paths. Actually, don't usedata_files
at all, unless you make sure the target paths are absolute ones properly generated in a cross-platform way insted of hard coded values.Use
package_data
instead:where
hackertray.data
is a proper python package (i.e. is a directory that contains a file named__init__.py
) andhacker-tray.png
is right next to__init__.py
.Here's how it should look:
You can get the full path to the image file using:
I hope that helps.
PS: Python<2.7 seems to have a bug regarding packaging of the files listed in
package_data
. Always make sure to have a manifest file if you're using something older than Python 2.7 for packaging. See here for more info: https://groups.google.com/d/msg/python-virtualenv/v5KJ78LP9Mo/OiBqMcYVFYAJ