Skip to content
This repository has been archived by the owner on Sep 28, 2023. It is now read-only.

Added code to handle .bz2 archives. #1

Closed
wants to merge 1 commit into from
Closed

Added code to handle .bz2 archives. #1

wants to merge 1 commit into from

Conversation

nmcbride
Copy link

I came across an issue while basket was downloading pytz. pytz is a
bz2 archive. Basket tested to see if the archive was a type that
tarfile could extract, which bz2 is, however in the extraction function
only .gz was being handled. I simply extracted the extension and then
used an if statement to change which archive format tarfile was
extracting. Probably can be done a bit more efficient but I'm flying
out in a few moments and wanted to get it uploaded.

I came across an issue while basket was downloading pytz.  pytz is a
bz2 archive.  Basket tested to see if the archive was a type that
tarfile could extract, which bz2 is, however in the extraction function
only .gz was being handled.  I simply extracted the extension and then
used an if statement to change which archive format tarfile was
extracting.  Probably can be done a bit more efficient but I'm flying
out in a few moments and wanted to get it uploaded.
@dbaty
Copy link
Owner

dbaty commented Apr 16, 2012

Thanks for the bug report! I'll fix that.

@dbaty dbaty closed this in e19cba2 Apr 16, 2012
@jenisys
Copy link

jenisys commented Apr 16, 2012

The problem seems to exist still for basket 0.9 with *.tar.gz archives.
In addition, an "basket update PACKAGE" does not download the missing dependencies.

(basket-virtualenv) basket download sphinx
Added Sphinx 1.1.3.
Traceback (most recent call last):
  File "/Users/xxx/tmp/virtualenv/basket/bin/basket", line 8, in <module>
    load_entry_point('Basket==0.9', 'console_scripts', 'basket')()
  File "/Users/xxx/tmp/virtualenv/basket/lib/python2.6/site-packages/basket/main.py", line 330, in main
    return basket.cmd_download(argv)
  File "/Users/xxx/tmp/virtualenv/basket/lib/python2.6/site-packages/basket/main.py", line 229, in cmd_download
    requirements = self._find_requirements(path)
  File "/Users/xxx/tmp/virtualenv/basket/lib/python2.6/site-packages/basket/main.py", line 139, in _find_requirements
    lines = self._open_req_in_tar_archive(path)
  File "/Users/xxx/tmp/virtualenv/basket/lib/python2.6/site-packages/basket/main.py", line 104, in _open_req_in_tar_archive
    with tarfile.open(path, 'r:%s' % extension) as archive:
AttributeError: 'TarFile' object has no attribute '__exit__'

@dbaty
Copy link
Owner

dbaty commented Apr 17, 2012

This traceback is not related to the original bug report.

Also, you are using Python 2.6. Basket does not support Python 2.6. The traceback shows an error that appears because in Python 2.6, tarfile.Tarfile could not be used as a context manager.

As for missing dependencies not being downloaded, I cannot reproduce that. If you can reproduce the bug with Python 2.7, feel free to open a new issue. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants