Commit Graph
450 Commits
Author SHA1 Message Date
John Chilton 099c1562fe Re-organize edge case upload options for my own clarity.
I think setting each of these variables once and simplifing the context they are used in (in the case of purge_upload) makes it more clear what each variable is and how it is set. I also think one, more detailed comment for each variable helps.

Note: This will break run-as-user uploads started prior to the upgrade to 18.XX and executed after the upgrade. It is a small switch to restore the old behavior but I'm not sure it is worth the complexity it adds to the file.

```
run_as_real_user = dataset.get('run_as_real_user', False) or dataset_get.('in_place', True)
```
2017-12-13 12:54:03 -05:00
mvdbeek bac56d6b27 Drop samtools from metadata and upload tools
We only need samtools for the dataproviders, which shouldn't
be used by these tools.
2017-12-08 11:35:31 +01:00
Nicola Soranzo 0dfe73a54c Determine dynamically if an extension corresponds to an unsniffable binary datatype
Remove the need to call `Binary.register_unsniffable_binary_ext()` for
each unsniffable binary datatype.

Fix https://github.com/galaxyproject/galaxy/issues/3441 , where the upload
of files of a datatype defined in datatypes_conf.xml as subclass of an
unsniffable binary datatype ended up with "The uploaded binary file
contains inappropriate content" because it was not possible to register the
subclassed datatype as unsniffable.

Also remove unused `stop_err()` function in upload.py .
2017-12-01 10:30:24 +00:00
Nicola Soranzo 0e0acb5200 Remove is_multi_byte from upload.py
Also, when sniffing binary files, sniff images together with the other
formats and respect sniff order.

Also remove `is_multi_byte` from:
- `stream_to_open_named_file()`
- `stream_to_file()`

Remove the now unused `get_image_ext()` and `Binary.is_sniffable_binary()`
and all the calls to `Binary.register_sniffable_binary_format()`.
2017-11-30 18:06:37 +00:00
Nicola Soranzo 59f44cf2be Update get_fileobj() to use utf-8 encoding in text mode
Also, merge its 3 parameters `gzip_only`, `bz2_only`, `zip_only` into
`compressed_formats` (a list of allowed formats).

As a consequence of the changes in `get_fileobj()`, update:
- `files_diff()`
- `get_file_peek()`, which now determines that a file is binary when a
  `UnicodeDecodeError` exception is raised and doesn't need
  `is_multi_byte` any more
- `iter_headers()` and `get_headers()`, which now return Unicode and don't
  need `is_multi_byte` parameter any more

As a consequence of the changes in `get_file_peek()`, update:
- `set_peek()`, which now doesn't need `is_multi_byte` any more

As a consequence of the changes in `get_headers()`, update:
- `guess_ext` and `is_column_based()`, which now determine that a file is
  binary when a `UnicodeDecodeError` exception is raised and don't need
  `is_multi_byte` any more

As a consequence of the changes to `guess_ext`, update:
- `handle_uploaded_dataset_file() doesn't need `is_multi_byte` any more

Also, remove duplicated calls to `get_file_peek()` in
lib/galaxy/datatypes/molecules.py and lib/galaxy/datatypes/msa.py

The `is_multi_byte` was not removed from the signature of `get_file_peek()`
and `set_peek()` in order to preserve compatibility for ToolShed datatypes,
thanks @jmchilton for the review.
2017-11-28 17:46:32 +00:00
Martin Cech 7157600f85 fix few stray wiki links 2017-11-15 16:39:26 -05:00
Nicola Soranzo 9b4de72ca6 Fix all E722 errors and ignore E741
Introduced in flake8 3.5.0
Fix import order.
2017-10-24 11:29:09 +01:00
Nate Coraor 3a70d0c648 [GX-2017-0003]: Fix for the reported issue, only allow http, https, and
ftp schemes in the data_source tool.
2017-10-23 10:25:22 -04:00
Nate Coraor 391586ba01 [GX-2017-0003]: Fix for the reported issue, only allow http, https, and
ftp schemes in the data_source tool.
2017-10-23 10:24:50 -04:00
Nicola Soranzo d1bc98dfcb Python3: fix remaining print statements
Remove some debugging prints.
Fix import order.
Consolidate exception logging in ToolShed database migrations.
2017-10-12 18:34:29 +01:00
John Chilton 1fa4ea2a8a Allow multiple simulatenous uploads via single POST.
The upload.py tool itself already allowed this and update upload dataset grouping to handle this.
2017-10-02 14:59:35 -04:00
John Chilton 57ff68edd0 Merge pull request #4539 from mvdbeek/purge_source
Prevent in-place editing of uploaded files if files are imported from the FTP folder
2017-09-07 10:11:04 -04:00
mvdbeek cccf79ac5f Make bz2file dependency conditional on python being below version 3.3 2017-09-05 18:30:25 +02:00
mvdbeek 46c85ffa98 Allow working with pbzip2 compressed files
This adds supprt for uploading and uncompressing pbzip2 compressed
files by exchanging the bz2 module with bz2file (recommended as workaround in
https://docs.python.org/2/library/bz2.html). The problem was reported by
@alpapan in #4538 and this commit should fix #4538.

Depends on https://github.com/galaxyproject/starforge/pull/147 for the
bz2file wheel.
2017-09-05 16:54:34 +02:00
mvdbeek 06db29413e Move instead of copying converted datasets when possible
shutil.move tries to move files by renaming them.  If that fails with
OSError (due to permission or cross-filesystem rename) it falls back to
copying files followed by removing them
(https://github.com/python/cpython/blob/2.7/Lib/shutil.py#L279). By
using shutil.move and catching permission problems we avoid an
unnecessary copy if source and destination are on the same filesystem.

Also avoids shutil.move if the upload tool is run as real-user which
should fix https://github.com/galaxyproject/galaxy/issues/4300.
2017-09-03 12:03:36 +02:00
mvdbeek 62ef8b52ae Fix sniffing for non-binary files 2017-09-03 10:49:23 +02:00
mvdbeek 14497719ba Prevent in-place editing if purge_source is false
When importing files from the FTP folder the admin can choose to prevent
purging of imported files. In this case the source file should not be
modified in-place by galaxy.

This also modifies relevant bare `except:` statements and modifies
the meaning of `in_place` in upload.py from no external chown script to
do not edit files in place if we keep the source file.

This fixes https://github.com/galaxyproject/galaxy/issues/4527.
2017-09-03 09:48:39 +02:00
John Chilton 0fa287f76a Add autopep8 script to help rebasing branches after #4440.
Fixes a few more PEP8 issues as part of the autopep8'ing as well.
2017-08-17 13:47:03 -04:00
Nicola Soranzo a353b2e88f Fix E127 errors introduced by previous commit
using:
```
autopep8 -i -r --exclude $(sed -e 's|^|./|' -e 's|/$||' .ci/flake8_blacklist.txt | paste -sd,) --select E127 .
```
2017-08-17 11:35:39 +01:00
Nicola Soranzo 21b44bf348 Fix all E201 and E202 style errors
using the following command:
```
autopep8 -i -r --exclude $(sed -e 's|^|./|' -e 's|/$||' .ci/flake8_blacklist.txt | paste -sd,) --select E201,E202 .
```
2017-08-17 11:35:39 +01:00
John Chilton fec1eab82d Add ability to arbitrarily not decompress files on upload via API. 2017-08-12 06:36:50 -04:00
John Chilton 59aa11864a Add configuration option to disable upload content checking. 2017-08-12 06:36:50 -04:00
guerler 7a6961e30d Undo dataset renaming 2017-05-01 11:57:07 -04:00
Nate Coraor f645259dd0 Only keep the last path element when naming files uploaded via the URL
paste method
2017-02-27 10:59:21 -05:00
Nicola Soranzo 3d57c22b63 Fix I201 errors from flake8-import-order
Also fix Python3 compatibility.
Remove unused method
galaxy.tools.parameters.sanitize.ToolParameterSanitizer.restore_param() .
2016-11-23 18:31:04 +00:00
Nicola Soranzo 1d17a29c79 Fixes for pycodestyle 2.2.0 2016-11-15 16:56:50 +00:00
Dannon Baker cb6e25278c Refactoring, because it was bugging me. 2016-10-13 10:25:18 -04:00
Dannon Baker bb44288968 Failthrough to using imghdr when PIL does not detect an image correctly.
Some misc cleanup, avoiding use of system functions as variable names,
etc.
2016-10-13 09:55:01 -04:00
Nicola Soranzo 11b4f3a60c Fix import order and Python3 compatibility for tools/
xref #1715
2016-09-29 19:26:22 +01:00
John Chilton d06e2a672b XSD discovered tool problems. 2016-09-08 11:40:01 -04:00
Nicola Soranzo cc336f61c0 Make some files compatible with Python3
Also enlarge the set of files tested with flake8 under Python3
2016-06-03 19:24:46 +01:00
Nicola Soranzo 8a43b2b492 Python 3: use "as" instead of comma in except clause 2016-05-17 23:53:16 +01:00
Nicola Soranzo ed4132d9c0 Python3: Use open() instead of file() 2016-05-17 23:53:16 +01:00
Dannon Baker 97110e2655 Merge branch 'release_16.04' into dev 2016-04-20 11:54:22 -04:00
Dannon Baker 1e7edf0bd7 no parens 2016-04-14 16:59:25 -04:00
Dannon Baker 7bed69ba17 Specify Ensembl biomart server in descriptions. 2016-04-14 16:56:47 -04:00
John Chilton 997b53f3ae Implement option to prevent FTP uploads from being deleted on import.
- Simply set `ftp_upload_purge` to `False` in galaxy.ini to enable this.
 - xref http://dev.list.galaxyproject.org/Data-removal-after-ftp-import-td4667111.html
 - slight xref http://dev.list.galaxyproject.org/Uploading-files-to-galaxy-from-a-folder-td4664614.html
2016-04-14 11:34:21 -04:00
Martin Cech c49e7803fa fix biomart url 2016-04-13 11:12:15 -04:00
Nicola Soranzo 501a10c3f1 Do not import dumps and loads from galaxy.util.json . 2016-03-02 19:04:24 +00:00
Nicola Soranzo 39da6c3278 Fix the remaining 2180 flake8 errors in tools/ . 2016-02-10 18:46:03 +00:00
Martin Cech db1bb2f191 Merge pull request #1556 from jmchilton/datatype_imports
Code design and legacy cleanup of datatypes and metadata.
2016-02-09 12:44:59 -05:00
John Chilton 448aee9f00 Fix for multi-byte char problem in PR #1556...
... caught by @nsoranzo of course.
2016-02-08 13:48:43 +00:00
guerler 193c5293d9 Remove invalid validator from upload.xml 2016-01-26 14:49:35 -05:00
John Chilton 499357e508 Remove unneeded galaxy.model import in upload.py...
... and document the ability to remove from other data sources.
2016-01-21 14:31:42 +00:00
John Chilton 50e531aa59 Refactor galaxy.datatypes.checkers into galaxy.util.checkers.
- Primary reason is because it is used all over the place in contexts that have nothing to do with Galaxy datatype classes or datatype registery or sniffing, most importantly by the code in the tool shed for determining if something is a tool or not.
 - This code has no dependencies on the datatypes module or any hard dependencies on things not in the Python standard library.
2015-12-17 15:41:06 +00:00
John Chilton 83f57c56c1 Refactor is_multi_byte out of galaxy.util.
It introduces a fairly esoteric dependency in galaxy.util for just a couple uses in Galaxy. Separating it out like this will allow reuse of the entire galaxy.util with only one external dependency (docutils, which planemo for instance already depends on).
2015-12-16 21:36:16 +00:00
Mark Einon d6d8e5ef86 upload.py: Remove unused function parameter 2015-11-13 11:33:56 +00:00
Nicola Soranzo 69cda48690 Remove remaining references to galaxy.eggs . flake8 some files in tools/ . 2015-10-26 19:29:13 +00:00
Daniel Blankenberg 092fc17ec0 Merge pull request #846 from jmchilton/ucsc_cleanup
UCSC Tool Cleanup
2015-10-05 17:05:56 -04:00
Martin Cech f90c49e270 Merge pull request #847 from jmchilton/citations_5
Add more distribution tool citations.
2015-10-05 17:01:18 -04:00