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

ENH: downloaders: Ensure directories for target exist #3646

Merged
merged 1 commit into from Sep 3, 2019

Conversation

@kyleam
Copy link
Member

commented Sep 2, 2019

download_url() doesn't check that leading directories for a target
exist, resulting in a failing .download() call, but it's reasonable
for a download_url() caller to expect that directories will be created
if needed, especially given git annex addurl --file ... does so.
Ensuring target directories exist seems desirable for all .download()
callers, so handle it within downloaders/base.py rather than in
download_url().

Fixes #3642.

ENH: downloaders: Ensure directories for target exist
download_url() doesn't check that leading directories for a target
exist, resulting in a failing .download() call, but it's reasonable
for a download_url() caller to expect that directories will be created
if needed, especially given `git annex addurl --file ...` does so.
Ensuring target directories exist seems desirable for all .download()
callers, so handle it within downloaders/base.py rather than in
download_url().

Fixes #3642.
@adswa

This comment has been minimized.

Copy link
Contributor

commented Sep 3, 2019

Thanks @kyleam!

@yarikoptic yarikoptic merged commit fc66340 into datalad:0.11.x Sep 3, 2019

3 checks passed

WIP Ready for review
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@yarikoptic yarikoptic added this to the Release 0.11.7 milestone Sep 3, 2019

@yarikoptic

This comment has been minimized.

Copy link
Member

commented Sep 3, 2019

I will add changelog and include it into 0.11.7

@kyleam kyleam deleted the kyleam:providers-nonexisting-dir branch Sep 3, 2019

yarikoptic added a commit that referenced this pull request Sep 6, 2019
Merge tag '0.11.7' into debian
0.11.7 (Sep 02, 2019) -- python2-we-still-love-you-but-...

Primarily bugfixes with some optimizations and refactorings.

 Fixes

- [addurls][]
  - now provides better handling when the URL file isn't in the
    expected format.  ([#3579][])
  - always considered a relative file for the URL file argument as
    relative to the current working directory, which goes against the
    convention used by other commands of taking relative paths as
    relative to the dataset argument.  ([#3582][])

- [run-procedure][]
  - hard coded "python" when formatting the command for non-executable
    procedures ending with ".py".  `sys.executable` is now used.
    ([#3624][])
  - failed if arguments needed more complicated quoting than simply
    surrounding the value with double quotes.  This has been resolved
    for systems that support `shlex.quote`, but note that on Windows
    values are left unquoted. ([#3626][])

- [siblings][] now displays an informative error message if a local
  path is given to `--url` but `--name` isn't specified.  ([#3555][])

- [sshrun][], the command DataLad uses for `GIT_SSH_COMMAND`, didn't
  support all the parameters that Git expects it to.  ([#3616][])

- Fixed a number of Unicode py2-compatibility issues. ([#3597][])

- [download-url][] now will create leading directories of the output path
  if they do not exist ([#3646][])

 Enhancements and new features

- The [annotate-paths][] helper now caches subdatasets it has seen to
  avoid unnecessary calls.  ([#3570][])

- A repeated configuration query has been dropped from the handling of
  `--proc-pre` and `--proc-post`.  ([#3576][])

- Calls to `git annex find` now use `--in=.` instead of the alias
  `--in=here` to take advantage of an optimization that git-annex (as
  of the current release, 7.20190730) applies only to the
  former. ([#3574][])

- [addurls][] now suggests close matches when the URL or file format
  contains an unknown field.  ([#3594][])

- Shared logic used in the setup.py files of Datalad and its
  extensions has been moved to modules in the _datalad_build_support/
  directory.  ([#3600][])

- Get ready for upcoming git-annex dropping support for direct mode
  ([#3631][])

* tag '0.11.7':
  Changelog entry for download-url paths handling
  ENH: downloaders: Ensure directories for target exist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.