[Distutils] Problem adding a new setup command..
Etienne Robillard
granted14 at yahoo.com
Tue Sep 11 23:09:29 CEST 2007
Hi there,
I'm a new setuptools user. I think setuptools is very
good, and I'm currently using it for a personal
project. [1]
However, I'm experimenting a small issue when trying
to use a new setup command like so:
$ python setup.py install_media
Distribution.parse_config_files():
reading setup.cfg
options (after parsing config files):
option dict for 'egg_info' command:
{'tag_build': ('setup.cfg', 'p1'),
'tag_svn_revision': ('setup.cfg', '0')}
options (after parsing command line):
option dict for 'aliases' command:
{}
option dict for 'egg_info' command:
{'tag_build': ('setup.cfg', 'p1'),
'tag_svn_revision': ('setup.cfg', '0')}
option dict for 'install_media' command:
{'args': ('command line', [])}
running install_media
Distribution.get_command_obj(): creating
'install_media' command object
setting options for 'install_media' command:
args = [] (from command line)
Traceback (most recent call last):
File "setup.py", line 143, in <module>
zip_safe=(sys.version >= 2.5)
File
"/opt/python25/lib/python2.5/distutils/core.py", line
151, in setup
dist.run_commands()
File
"/opt/python25/lib/python2.5/distutils/dist.py", line
974, in run_commands
self.run_command(cmd)
File
"/opt/python25/lib/python2.5/distutils/dist.py", line
992, in run_command
cmd_obj = self.get_command_obj(command)
File
"/opt/python25/lib/python2.5/distutils/dist.py", line
879, in get_command_obj
self._set_command_options(cmd_obj, options)
File
"/opt/python25/lib/python2.5/distutils/dist.py", line
919, in _set_command_options
% (source, command_name, option))
distutils.errors.DistutilsOptionError: error in
command line: command 'install_media' has no such
option 'a rgs'
Here's the setuptools.Command subclass:
from setuptools import Command
class install_media(Command):
description = "Install app-specific media files"
command_consumes_arguments = True
# List of options for this command
user_options = [
# Perhaps the better option is to use the
'--prefix' arg.
# ('with-docroot=', None, 'Install media files
to this directory'),
('with-apps=', None,
"Search theses subdirs for media files
(comma-separated list)")
]
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
return self._find_media_files()
def _find_media_files(self):
pass
Any insightful hints how to debug this problem?
The Big Idea was to add a new setup command (named
install_media) which could presumely allow things
like:
$ python setup.py install_media --prefix=/var/www
--with-apps=foo,bar
Thanks in advance,
Etienne
1. http://tools.assembla.com/notmm/
----
Etienne Robillard
7680 de jouvence, La Plaine
J7M-2K9, Québec
Telephone: 450-478-5026
Yahoo Messenger ID: granted14
Skype ID: incidah
Ask a question on any topic and get answers from real people. Go to Yahoo! Answers and share what you know at http://ca.answers.yahoo.com
More information about the Distutils-SIG
mailing list