Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow working with pbzip2 compressed files #4559

Merged
merged 4 commits into from Sep 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/galaxy/datatypes/sniff.py
Expand Up @@ -3,7 +3,6 @@
"""
from __future__ import absolute_import

import bz2
import codecs
import gzip
import logging
Expand All @@ -30,6 +29,11 @@
is_gzip
)

if sys.version_info < (3, 3):
import bz2file as bz2
else:
import bz2

log = logging.getLogger(__name__)


Expand Down
3 changes: 2 additions & 1 deletion lib/galaxy/dependencies/pinned-requirements.txt
Expand Up @@ -13,6 +13,7 @@ uWSGI==2.0.15
#python_lzo==1.8

# pure Python packages
bz2file==0.98; python_version < '3.3'
Paste==2.0.2
PasteDeploy==1.5.2
docutils==0.12
Expand Down Expand Up @@ -80,4 +81,4 @@ pysam==0.8.4+gx5
chronos-python==0.38.0

# GenomeSpace dependencies
python-genomespaceclient==0.1.8
python-genomespaceclient==0.1.8
1 change: 1 addition & 0 deletions lib/galaxy/dependencies/requirements.txt
Expand Up @@ -13,6 +13,7 @@ pycrypto
#python_lzo

# pure Python packages
bz2file; python_version < '3.3'
Paste
PasteDeploy
docutils
Expand Down
7 changes: 6 additions & 1 deletion lib/galaxy/util/checkers.py
@@ -1,13 +1,18 @@
import bz2
import gzip
import re
import sys
import zipfile

from six import StringIO

from galaxy import util
from galaxy.util.image_util import image_type

if sys.version_info < (3, 3):
import bz2file as bz2
else:
import bz2

HTML_CHECK_LINES = 100


Expand Down
7 changes: 6 additions & 1 deletion lib/galaxy/util/compression_utils.py
@@ -1,12 +1,17 @@
import bz2
import gzip
import sys
import zipfile

from .checkers import (
is_bz2,
is_gzip
)

if sys.version_info < (3, 3):
import bz2file as bz2
else:
import bz2


def get_fileobj(filename, mode="r", gzip_only=False, bz2_only=False, zip_only=False):
"""
Expand Down
7 changes: 6 additions & 1 deletion lib/tool_shed/util/commit_util.py
@@ -1,9 +1,9 @@
import bz2
import gzip
import json
import logging
import os
import shutil
import sys
import tempfile
from collections import namedtuple

Expand All @@ -14,6 +14,11 @@
from tool_shed.tools import data_table_manager
from tool_shed.util import basic_util, hg_util, shed_util_common as suc

if sys.version_info < (3, 3):
import bz2file as bz2
else:
import bz2

log = logging.getLogger(__name__)

UNDESIRABLE_DIRS = ['.hg', '.svn', '.git', '.cvs']
Expand Down
10 changes: 5 additions & 5 deletions tools/data_source/upload.py
Expand Up @@ -25,12 +25,12 @@
from galaxy.util.image_util import get_image_ext


try:
if sys.version_info < (3, 3):
import bz2file as bz2
else:
import bz2
except:
bz2 = None

assert sys.version_info[:2] >= (2, 4)
assert sys.version_info[:2] >= (2, 7)


def stop_err(msg, ret=1):
Expand Down Expand Up @@ -165,7 +165,7 @@ def add_file(dataset, registry, json_file, output_path):
os.chmod(dataset.path, 0o644)
dataset.name = dataset.name.rstrip('.gz')
data_type = 'gzip'
if not data_type and bz2 is not None:
if not data_type:
# See if we have a bz2 file, much like gzip
is_bzipped, is_valid = check_bz2(dataset.path, check_content)
if is_bzipped and not is_valid:
Expand Down