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

Thumbnail generation and test fixes #32

Merged
merged 3 commits into from
Dec 3, 2016
Merged

Thumbnail generation and test fixes #32

merged 3 commits into from
Dec 3, 2016

Conversation

aszlig
Copy link
Contributor

@aszlig aszlig commented Dec 3, 2016

I've stumbled over a few issues while packaging vimiv for NixOS:

  • Thumbnail generation doesn't work properly if leading directories of input files contain a dot.
  • Finding executables in $PATH relies on external tools.
  • main_test picks up nosetests arguments.

This branch should fix these issues.

Doing a split on . for the full path of the input file is not going to
work out well if one of the parent directories of the input file has a
dot in it.

So let's say if we have an input file with the following path:

/foo.bar/shiny_image.png

The basename of the resulting thumbnail would be:

foo.thumbnail_XXXxYYY.png

So instead of using the full path of the input file for determining the
first path of the new thumbnail file name we now solely use its
basename.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
@aszlig aszlig changed the title Fixes Thumbnail generation and test fixes Dec 3, 2016
aszlig added a commit to NixOS/nixpkgs that referenced this pull request Dec 3, 2016
Packaging itself is pretty much straightforward, the tests however
revealed a few issues, which I have fixed with a small patch that has
been upstreamed at karlch/vimiv#32.

The other sed-based patches in postPatch are mostly NixOS-specific.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Using ls and tr means that we have two external commands just to iterate
through the $PATH environment variable.

This not only is kinda pointless to do (we *can* do this in Python
without forking off) but is also error-prone because it relies not only
on ls/tr being there but also on their outputs being correct.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
If you run nosetests with arguments, the argument parser of vimiv picks
it up and execution may fail depending on which arguments are passed.

We now explicitly pass sys.argv to the main() function via
vimiv/vimiv.py and via main_test.py, so that if we call the main()
function via code we *never* provide arguments implicitly.

This also makes the arguments kvarg of parse_args() mandatory, because
there is no other code in the codebase that doesn't explicitly pass
arguments.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
@karlch
Copy link
Owner

karlch commented Dec 3, 2016

The changes look good to me and all make sense, thanks a lot for your contribution!

EDIT:
Just FYI, I released a follow-up 0.7.3 including your changes and a small fix concerning broken symbolic links.

@karlch karlch merged commit e8072ce into karlch:master Dec 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants