Requiring setuptools.command.sdist gives an error

16 views
Skip to first unread message

Francesc

unread,
Sep 10, 2009, 7:15:12 AM9/10/09
to paver
Hi,

I'm stuck with a problem with paver (1.0.1), setuptools (0.6c9) and
Python 2.6.1, so I'll appreciate some help.

In my pavement.py I've defined the task sdist as follows:

@task
@needs([ 'build_catalogs', 'make_dist',
'generate_setup', 'minilib',
'setuptools.command.sdist' ])
def sdist():
"""Genera una distribució de codi font."""
pass

and, when executing ``paver sdist`` I get the following error:

"""
Traceback (most recent call last):
File "/home/faltet/vepython/bin/paver", line 8, in <module>
load_entry_point('Paver==1.0.1', 'console_scripts', 'paver')()
File "/home/faltet/vepython/lib/python2.6/site-packages/Paver-1.0.1-
py2.6.egg/paver/tasks.py", line 624, in main
_launch_pavement(args)
File "/home/faltet/vepython/lib/python2.6/site-packages/Paver-1.0.1-
py2.6.egg/paver/tasks.py", line 607, in _launch_pavement
_process_commands(args, auto_pending=auto_pending)
File "/home/faltet/vepython/lib/python2.6/site-packages/Paver-1.0.1-
py2.6.egg/paver/tasks.py", line 560, in _process_commands
task, args = _parse_command_line(args)
File "/home/faltet/vepython/lib/python2.6/site-packages/Paver-1.0.1-
py2.6.egg/paver/tasks.py", line 499, in _parse_command_line
args = task.parse_args(args)
File "/home/faltet/vepython/lib/python2.6/site-packages/Paver-1.0.1-
py2.6.egg/paver/tasks.py", line 319, in parse_args
parser = self.parser
File "/home/faltet/vepython/lib/python2.6/site-packages/Paver-1.0.1-
py2.6.egg/paver/tasks.py", line 271, in parser
for option in task.user_options:
AttributeError: 'module' object has no attribute 'user_options'
"""

After instrumenting a bit the tasks.py source file, I've come to the
conclusion that the problem is that `get_task` acting over
'setuptools.command.sdist' is not returning a proper Task instance,
but rather a module (in fact, I've checked that it is the
`_import_task` function in tasks.py that is returning the module and
never converted into a Task instance).

I'm having this error since I have migrated my project to a new
machine. Before, the same scripts worked just fine with Paver 0.8.1,
setuptools 0.6c9 and Python 2.5.1.

Any hint?

Francesc

ssteiner

unread,
Sep 10, 2009, 5:08:57 PM9/10/09
to paver
> In my pavement.py I've defined the task sdist as follows:
>
> @task
> @needs([ 'build_catalogs', 'make_dist',
>          'generate_setup', 'minilib',
>          'setuptools.command.sdist' ])
> def sdist():
>     """Genera una distribució de codi font."""
>     pass
>
> and, when executing ``paver sdist`` I get the following error:

[snip]

> I'm having this error since I have migrated my project to a new
> machine.  Before, the same scripts worked just fine with Paver 0.8.1,
> setuptools 0.6c9 and Python 2.5.1.

The docs show @needs() using 'setuptools.command.sdist', in @needs,
but you've got them nested an extra level with [] i.e. you have @needs
([stuff...]) and the docs show @needs(stuff...).

I don't know if that'll change anything but it's worth a shot to
remove the [] and see if the behaviour changes at all.

S




ssteiner

unread,
Sep 10, 2009, 8:47:18 PM9/10/09
to paver
My mistake -- just looked at the source for the @needs() decorator and
it does take a list of strings.

I did notice, however, that the very first page of the paver docs
references 'distutils.command.sdist'.

Check at http://www.blueskyonmars.com/projects/paver/ in the first
green code box.

Sorry for the misdirection.

S

Francesc

unread,
Sep 11, 2009, 4:59:35 AM9/11/09
to paver
Hi S,

On 11 Set, 02:47, ssteiner <sstein...@gmail.com> wrote:
> My mistake -- just looked at the source for the @needs() decorator and
> it does take a list of strings.
>
> I did notice, however, that the very first page of the paver docs
> references 'distutils.command.sdist'.

I've tried also with 'distutils.command.sdist' and the error is the
same. By looking at the code of Paver (1.0.1) I'd say that there is
an error in the code (I can't see any place where the module above is
turned into a Task() instance). What baffles me, though, is that
nobody else seems to be affected by this behaviour.

Thanks anyway,

Francesc

Kevin Dangoor

unread,
Sep 11, 2009, 10:54:57 PM9/11/09
to pa...@googlegroups.com
Hi,

Paver's own pavement file does something similar. The only difference that I see right away is that paver's pavement is passing the strings directly to @needs, rather than passing in a list:

@needs('html', "minilib", "generate_setup", old_sdist)

(old_sdist is defined:
if paver.setuputils.has_setuptools:
    old_sdist = "setuptools.command.sdist"
)

Kevin
--
Kevin Dangoor

work: http://labs.mozilla.com/
email: k...@blazingthings.com
blog: http://www.BlueSkyOnMars.com

ssteiner

unread,
Sep 11, 2009, 11:07:36 PM9/11/09
to paver
On Sep 11, 10:54 pm, Kevin Dangoor <dang...@gmail.com> wrote:
> Hi,
>
> Paver's own pavement file does something similar. The only difference that I
> see right away is that paver's pavement is passing the strings directly to
> @needs, rather than passing in a list:
>
> @needs('html', "minilib", "generate_setup", old_sdist)

Kevin,

We tried that two messages ago [1] and it didn't seem to change the
behaviour.

S

[1]

Francesc

unread,
Sep 12, 2009, 3:46:11 AM9/12/09
to paver


On 12 Set, 05:07, ssteiner <sstein...@gmail.com> wrote:
> On Sep 11, 10:54 pm, Kevin Dangoor <dang...@gmail.com> wrote:
>
> > Hi,
>
> > Paver's own pavement file does something similar. The only difference that I
> > see right away is that paver's pavement is passing the strings directly to
> > @needs, rather than passing in a list:
>
> > @needs('html', "minilib", "generate_setup", old_sdist)
>
> Kevin,
>
>   We tried that  two messages ago [1] and it didn't seem to change the
> behaviour.

Yeah. The thing that I don't understand is where a module like
'setuptools.command.sdist' is converted into a task instance. I don't
see the part of the code that does that.

Francesc

Kevin Dangoor

unread,
Sep 14, 2009, 12:49:44 PM9/14/09
to pa...@googlegroups.com
Sorry for the delay on this. I've been really behind on things due to various non-computer-related-stuff and I'm only just catching up.


On Sat, Sep 12, 2009 at 3:46 AM, Francesc <fal...@gmail.com> wrote:
Yeah.  The thing that I don't understand is where a module like
'setuptools.command.sdist' is converted into a task instance.  I don't
see the part of the code that does that.


Ahh, this question actually leads me to guess at what the problem is.

paver.setuputils.install_distutils_tasks is responsible for turning all of the distutils/setuptools commands into Paver tasks.

You can call that directly, or you can use the setup() function in there (which also makes a pavement look like a distutils script).

If you're not calling install_distutils_tasks or setup(), then you won't have the sdist task available.

Kevin

Francesc

unread,
Sep 15, 2009, 7:02:34 AM9/15/09
to paver
On 14 Set, 18:49, Kevin Dangoor <dang...@gmail.com> wrote:
> Sorry for the delay on this. I've been really behind on things due to
> various non-computer-related-stuff and I'm only just catching up.
>
> On Sat, Sep 12, 2009 at 3:46 AM, Francesc <fal...@gmail.com> wrote:
> > Yeah.  The thing that I don't understand is where a module like
> > 'setuptools.command.sdist' is converted into a task instance.  I don't
> > see the part of the code that does that.
>
> Ahh, this question actually leads me to guess at what the problem is.
>
> paver.setuputils.install_distutils_tasks is responsible for turning all of
> the distutils/setuptools commands into Paver tasks.
>
> You can call that directly, or you can use the setup() function in there
> (which also makes a pavement look like a distutils script).
>
> If you're not calling install_distutils_tasks or setup(), then you won't
> have the sdist task available.

Ahh, nice! Calling install_distutils_tasks() did the trick. Maybe
this is worth to be documented (or perhaps I missed it).

Many thanks!

Francesc

Francesc

unread,
Sep 15, 2009, 7:21:30 AM9/15/09
to paver
Reply all
Reply to author
Forward
0 new messages