[Distutils] First attempt: close but no data files!

Kaelin Colclasure kaelin at acm.org
Fri Oct 23 03:25:32 CEST 2009


On Oct 22, 2009, at 6:05 PM, ssteinerX at gmail.com wrote:

>
> On Oct 22, 2009, at 8:47 PM, Kaelin Colclasure wrote:
>
>> Greetings,
>>
>> I am attempting my first Python contribution and have run into a  
>> speed bump getting a working setup.py using setuptools.  
>> Specifically, I cannot coax it to install my package data files  
>> into the site-packages directory. Here is a link to my project  
>> where my setup.py is available for browsing:
>>
>> <http://bitbucket.org/kaelin/cuttlefish/>
>>
>> Soooo close!
>
> How about some sort of description of what you're trying to do...
>
> 	• Reproduce steps: Clearly mention the steps to reproduce the bug.
> 	• Expected result: How application should behave on above mentioned  
> steps.
> 	• Actual result: What is the actual result on running above steps  
> i.e. the bug behavior.
>
> Thanks,

My project has a file (cuttlefish-config.plist) that needs to be  
installed next to the module (cuttlefish.py) in the site-packages  
directory. There is also a directory (static) containing some html  
files and png images that should go in the same place.

I first tried using

    include_package_data=True, # Requires setuptools_hg

after installing setuptools_hg to hook setuptools to understand  
Mercurial. This got all my data files added to the ...egg-info/ 
SOURCES.txt and I thought it was good. But then after building an egg  
and installing it with easy_setup, all the data files were missing.

I then tried adding a MANIFEST.in file:
---8<---
(Bottle-python2.6)syn:cuttlefish kaelin$ cat MANIFEST.in
include *.plist
graft static
--->8---

Same result: The files are listed in the "manifest" SOURCES.txt, but  
not installed.

Here is SOURCES.txt:
---8<---
(Bottle-python2.6)syn:cuttlefish kaelin$ cat Cuttlefish.egg-info/ 
SOURCES.txt
.hgignore
MANIFEST.in
README.txt
cuttlefish-config.plist
cuttlefish.py
setup.py
Cuttlefish.egg-info/PKG-INFO
Cuttlefish.egg-info/SOURCES.txt
Cuttlefish.egg-info/dependency_links.txt
Cuttlefish.egg-info/entry_points.txt
Cuttlefish.egg-info/not-zip-safe
Cuttlefish.egg-info/requires.txt
Cuttlefish.egg-info/top_level.txt
static/LICENSE.html
static/bottle-sig.png
static/cuttlefish.png
static/mako-sig.png
--->8---

Here is my setup.py:
---8<---
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Setup script for cuttlefish.
"""
from setuptools import setup, find_packages
import cuttlefish

setup(
    name="Cuttlefish",
    version=cuttlefish.__version__,
    py_modules=[
        'cuttlefish',
    ],
    include_package_data=True, # Requires setuptools_hg
    entry_points={
        'console_scripts': [
            'cuttlefish = cuttlefish:see_bottle_run',
        ],
    },
    zip_safe=False, # Needs a user-editable cuttlefish-config.plist
    install_requires=[
        'Bottle >= 0.6.4',
        'Mako >= 0.2.5',
    ],
    # PyPI metadata
    author='Kaelin Colclasure',
    author_email='kaelin at acm.org',
    description="Browser-based search tool for quickly `grep`ing  
source code.",
    long_description="Cuttlefish is an example project using the  
Bottle flyweight Web framework and the Mako template engine in Python.  
It's intended to run on your desktop, and provide a lightweight search  
engine (using grep) for your source code.",
    license='MIT',
    platforms=['darwin', 'unix'],
    url='http://bitbucket.org/kaelin/cuttlefish/',
    classifiers=[
        'Development Status :: 3 - Alpha',
        'Environment :: Web Environment',
        #'Framework :: Bottle',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: MIT License',
        'Operating System :: MacOS :: MacOS X',
        'Operating System :: Unix',
        'Programming Language :: Python :: 2.6',
        'Topic :: Software Development :: Documentation',
        'Topic :: Text Processing :: Indexing',
    ],
)
--->8---

The whole project is available from <http://bitbucket.org/kaelin/cuttlefish/ 
 >.

TIA,

-- Kaelin



More information about the Distutils-SIG mailing list