requiring packages with distutils
The documentation for distutils alleges that using the requires
keyword allows a package to declare a dependency. I can’t for the life of me make this do anything useful. What I expect to happen is when I use easy_install
to download a package with another requirement, that required package should also be downloaded.
Here’s what I have:
from distutils.core import setup
import os
setup (
name = 'BlogBackup',
version = '1.2',
description = 'Script to dump a blog feed to files suitable for backing up or reprocessing.',
long_description = """
This script uses the feedparser module to access an Atom or RSS feed and
download the individual entries to a backup directory. It tracks both
etag and modified headers for each feed to reduce processing overhead.
""",
author = 'Doug Hellmann',
author_email = 'doug.hellmann@example.com',
url = 'http://www.doughellmann.com/projects/BlogBackup/',
download_url = 'http://www.doughellmann.com/downloads/BlogBackup-1.2.tar.gz',
classifiers = [ 'Development Status :: 4 - Beta',
'License :: OSI Approved :: BSD License',
'Programming Language :: Python',
'Intended Audience :: End Users/Desktop',
'Environment :: Console',
'Topic :: System :: Archiving :: Backup',
'Topic :: Utilities',
],
platforms = ('Any',),
keywords = ('backup', 'archive', 'atom', 'rss', 'blog', 'weblog'),
packages = [ 'blogbackuplib',
],
package_dir = { '': '.' },
scripts = ['blogbackup'],
requires=['CommandLineApp (>=2.5)'],
)
I set up a new virtual environment without any site-packages. I have verified that if I run the virtual environment interpreter, I cannot import CommandLineApp
(so it is not already installed). When I run easy_install BlogBackup
, it downloads and installs the correct version (1.2). Here’s the output:
$ easy_install BlogBackup
Searching for BlogBackup
Reading http://pypi.python.org/simple/BlogBackup/
Reading http://www.doughellmann.com/projects/BlogBackup/
Best match: BlogBackup 1.2
Downloading http://www.doughellmann.com/downloads/BlogBackup-1.2.tar.gz
Processing BlogBackup-1.2.tar.gz
Running BlogBackup-1.2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-p9F4P3/BlogBackup-1.2/egg-dist-tmp-VRoy9D
zip_safe flag not set; analyzing archive contents...
Adding BlogBackup 1.2 to easy-install.pth file
Installing blogbackup script to /Users/dhellmann/Devel/personal/Projects/BlogBackup/Test/bin
Installed /Users/dhellmann/Devel/personal/Projects/BlogBackup/Test/lib/python2.5/site-packages/BlogBackup-1.2-py2.5.egg
Processing dependencies for BlogBackup
Finished processing dependencies for BlogBackup
It says “Processing dependencies”, but does not download the CommandLineApp package.
Have I specified the requirements value incorrectly? Or am I expecting too much?