offline feature doesn't work at Buildout's first run

Bug #730211 reported by Jonathan Ballet
22
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Buildout
New
Undecided
Unassigned

Bug Description

[I lost my first - long - message, so here's the short version]

Given this:

buildout.cfg:

    [buildout]
    develop = .
    parts = foo

    [foo]
    recipe = zc.recipe.egg
    eggs =
        foo

setup.py:

    from setuptools import setup

    setup(
        name='foo',
    )

~/.buildout/default.cfg:

    [buildout]
    download-cache = /home/jon/.buildout/downloads
    prefer-final = true
    unzip = true
    newest = false

    include-site-packages = false
    exec-sitecustomize = false

$ ls -1 /home/jon/.buildout/downloads/dist/zc.recipe.egg-1.*
    /home/jon/.buildout/downloads/dist/zc.recipe.egg-1.2.2.tar.gz
    /home/jon/.buildout/downloads/dist/zc.recipe.egg-1.3.2.tar.gz

Ends up with:

    $ ./bin/buildout -o
    Develop: '/tmp/foo/.'
    install_dir /tmp/foo/develop-eggs/tmpumPC3Kbuild
    install_dir /tmp/tmpfvlKcd
    While:
      Installing.
      Getting section foo
      Initializing section foo
      Installing recipe zc.recipe.egg.
      Getting distribution for 'zc.recipe.egg'.

    An internal error occurred due to a bug in either zc.buildout or in a
    recipe being used:
    Traceback (most recent call last):
      File "/tmp/foo/eggs/zc.buildout-1.5.2-py2.6.egg/zc/buildout/buildout.py", line 1805, in main
        getattr(buildout, command)(args)
      File "/tmp/foo/eggs/zc.buildout-1.5.2-py2.6.egg/zc/buildout/buildout.py", line 468, in install
        [self[part]['recipe'] for part in install_parts]
      File "/tmp/foo/eggs/zc.buildout-1.5.2-py2.6.egg/zc/buildout/buildout.py", line 1056, in __getitem__
        options._initialize()
      File "/tmp/foo/eggs/zc.buildout-1.5.2-py2.6.egg/zc/buildout/buildout.py", line 1141, in _initialize
        recipe_class = _install_and_load(reqs, 'zc.buildout', entry, buildout)
      File "/tmp/foo/eggs/zc.buildout-1.5.2-py2.6.egg/zc/buildout/buildout.py", line 1097, in _install_and_load
        prefer_final=not buildout.accept_buildout_test_releases)
      File "/tmp/foo/eggs/zc.buildout-1.5.2-py2.6.egg/zc/buildout/easy_install.py", line 1090, in install
        return installer.install(specs, working_set)
      File "/tmp/foo/eggs/zc.buildout-1.5.2-py2.6.egg/zc/buildout/easy_install.py", line 896, in install
        for dist in self._get_dist(requirement, ws, self._always_unzip):
      File "/tmp/foo/eggs/zc.buildout-1.5.2-py2.6.egg/zc/buildout/easy_install.py", line 791, in _get_dist
        dist.location, ws, self._dest, dist)
      File "/tmp/foo/eggs/zc.buildout-1.5.2-py2.6.egg/zc/buildout/easy_install.py", line 615, in _call_easy_install
        newloc = os.path.join(dest, os.path.basename(d.location))
      File "/usr/lib/python2.6/posixpath.py", line 67, in join
        elif path == '' or path.endswith('/'):
    AttributeError: 'NoneType' object has no attribute 'endswith'

Due to zc/buildout/buildout.py's _install_and_load() function:

           if buildout.offline:
>> dest = None
               path = [buildout_options['develop-eggs-directory'],
                       buildout_options['eggs-directory'],
                       ]
           else:
               dest = buildout_options['eggs-directory']
               path = [buildout_options['develop-eggs-directory']]

Which seems to be a bug for me. Setting "dest" as in the 'else' clause solves the problem.

Tags: offline
Revision history for this message
Jonathan Ballet (multani) wrote :

OK, this is a dup of 229678 with more context, though.

tags: added: offline
Revision history for this message
Jonathan Ballet (multani) wrote :

I also have this error on subsequent Buildout run, after adding more dependencies to my project.

This time, this is due to zc.recipe.egg egg.py's Eggs.working_set() method:

           [...]
           if b_options.get('offline') == 'true':
>>> ws = zc.buildout.easy_install.working_set(
                   distributions, options['executable'],
                   [options['develop-eggs-directory'],
                    options['eggs-directory']],
                   include_site_packages=self.include_site_packages,
                   allowed_eggs_from_site_packages=self.allowed_eggs,
                   )
           else:
           [...]

And the Buildout function called:

       def working_set(specs, executable, path, include_site_packages=None,
                       allowed_eggs_from_site_packages=None, prefer_final=None):
           return install(
>>> specs, None, executable=executable, path=path,
               include_site_packages=include_site_packages,
               allowed_eggs_from_site_packages=allowed_eggs_from_site_packages,
               prefer_final=prefer_final)

And of course, the None here is the "dest" variable which triggers the error.

Revision history for this message
Philippe Ombredanne (pombredanne) wrote :

I think I found the culprit : See https://github.com/buildout/buildout/issues/41

Revision history for this message
Philippe Ombredanne (pombredanne) wrote :

well I meant the error exist both in the main buildout and the zc.recipe.egg ... I wonder if there is any way to get an offline buildout working

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.