Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 559448 - app-shells/autojump-22.2.4 - from autojump_argparse import ArgumentParser ImportError: No module named 'autojump_argparse'
Summary: app-shells/autojump-22.2.4 - from autojump_argparse import ArgumentParser Im...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Michael Weber (RETIRED)
URL:
Whiteboard:
Keywords: PATCH
: 559684 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-09-02 19:12 UTC by Lukas Polacek
Modified: 2015-09-23 05:35 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (emerge.info,5.63 KB, text/plain)
2015-09-02 19:27 UTC, Lukas Polacek
Details
Ebuild Patch (autojump-22.2.4.ebuild.patch,667 bytes, patch)
2015-09-03 07:48 UTC, Paul Kramer
Details | Diff
autojump-22.2.4-r1 (autojump-22.2.4-r1.ebuild,1.73 KB, text/plain)
2015-09-04 06:32 UTC, Lukas Polacek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lukas Polacek 2015-09-02 19:12:05 UTC
Steps to reproduce:
$ autojump
Traceback (most recent call last):
  File "/usr/bin/autojump", line 41, in <module>
    from autojump_argparse import ArgumentParser
ImportError: No module named 'autojump_argparse'

I also see that there are probably some files missing:
"equery files autojump" doesn't show any Python file that would implement ArgumentParser.
Comment 1 Lukas Polacek 2015-09-02 19:27:11 UTC
Created attachment 410876 [details]
emerge --info
Comment 2 Paul Kramer 2015-09-03 07:47:54 UTC
I altered the ebuild so it also installs the needed python files. Attached is a patch for that.
Comment 3 Paul Kramer 2015-09-03 07:48:32 UTC
Created attachment 410908 [details, diff]
Ebuild Patch
Comment 4 Lukas Polacek 2015-09-03 08:02:23 UTC
Thanks, that fixes the problem.
Comment 5 Lukas Polacek 2015-09-04 06:32:22 UTC
I've verified the patch works on 3 different Gentoo machines. Can you release a new version? I'm also attaching a full ebuild for convenience.
Comment 6 Lukas Polacek 2015-09-04 06:32:52 UTC
Created attachment 410968 [details]
autojump-22.2.4-r1
Comment 7 Lukas Polacek 2015-09-04 22:40:52 UTC
I've also create a pull request: https://github.com/gentoo/gentoo/pull/66 Don't know if that's the right way to get the ebuild accepted.
Comment 8 Michael Palimaka (kensington) gentoo-dev 2015-09-07 10:25:16 UTC
*** Bug 559684 has been marked as a duplicate of this bug. ***
Comment 9 Patrice Clement gentoo-dev 2015-09-07 11:43:21 UTC
commit 0feaaac (HEAD, master)
Merge: e1e3fe1 fb6b7aa
Author: Patrice Clement <monsieurp@gentoo.org>
Date:   Mon Sep 7 11:39:47 2015 +0000

    app-shells/autojump: Merge 'github/pr/66'. Fixes bug 559448.
Comment 10 Tomasz Golinski 2015-09-10 13:53:17 UTC
The problem still persists is autojump is built with USE=-python. What is the reason to keep that flag if autojump is useless without python?

And BTW - Changelog has not been updated for the last commits.
Comment 11 Leho Kraav (:macmaN @lkraav) 2015-09-10 13:54:06 UTC
(In reply to Tomasz Golinski from comment #10)
> The problem still persists is autojump is built with USE=-python. What is
> the reason to keep that flag if autojump is useless without python?
> 
> And BTW - Changelog has not been updated for the last commits.

USE=python apparently controls ipython integration. It confused me as well.
Comment 12 Tomasz Golinski 2015-09-15 16:17:04 UTC
That is true now in -r2. In -r1 using -python broke the install.

However now -r2 is even more broken! 

1) /etc/profile.d/autojump.sh looks for scripts in /usr/local
2) there are no bash scripts, only autojump.zsh.

And still no update in the changelog, previous version is gone. It seems that maintainer is doing more harm than good at the moment.
Comment 13 Tomasz Golinski 2015-09-15 16:24:02 UTC
Sorry about 1). Checked it before I run etc-update. However still no bash version of the script gets installed. 

That probably leads to the warning:

 * Problems with installed bash completions were found:
 * 
 *      autojump: incorrect name, no completions for 'autojump' command defined.
 *      j: missing alias (symlink) for completed command.
 * 
 * For more details on installing bash-completions, please see:
 * https://wiki.gentoo.org/wiki/Bash/Installing_completion_files
Comment 14 Lukas Polacek 2015-09-16 18:24:25 UTC
(In reply to Tomasz Golinski from comment #13)
> Sorry about 1). Checked it before I run etc-update. However still no bash
> version of the script gets installed. 
> 
> That probably leads to the warning:
> 
>  * Problems with installed bash completions were found:
>  * 
>  *      autojump: incorrect name, no completions for 'autojump' command
> defined.
>  *      j: missing alias (symlink) for completed command.
>  * 
>  * For more details on installing bash-completions, please see:
>  * https://wiki.gentoo.org/wiki/Bash/Installing_completion_files

I am the one responsible for -a2, but I'm not the maintainer. I made a pull request a couple of days ago (https://github.com/gentoo/gentoo/pull/87), got a lot of feedback and improved many things in the ebuild.

It was suggested to me that there is a new way of installing bash completion, so I made a patch doing that https://github.com/lukipuki/gentoo/commit/3c5fbd4b17df82fd7ad99d88dbd0491dc9d463ca

I said that I'm not a bash user and I can't test the completion (https://github.com/gentoo/gentoo/pull/87#issuecomment-139857736) but my patch got merged anyway. Too bad they didn't wait for someone to test it.

Sorry for the mess. It would be great if we got the bash completion to work with the new installation procedure. If you have ideas how to fix it, I'll be happy to make a new pull request.
Comment 15 Tomasz Golinski 2015-09-16 18:44:00 UTC
The line "doins bin/${PN}.bash" which you removed in "use newbashcomp" commit is not related to bash completion, but to bash part of autojump itself. Thus -r2 doesn't work at all with bash due to missing loading scripts. 

And let me note that bash completion script seems to be installed correctly as /usr/share/bash-completion/completions/autojump.
Comment 16 Lukas Polacek 2015-09-16 19:03:02 UTC
(In reply to Tomasz Golinski from comment #15)
> The line "doins bin/${PN}.bash" which you removed in "use newbashcomp"
> commit is not related to bash completion, but to bash part of autojump
> itself. Thus -r2 doesn't work at all with bash due to missing loading
> scripts. 

No, autojump is a Python program, it doesn't need bash to run. Previously, the file was installed only when the old bash-completion flag was set:
https://github.com/lukipuki/gentoo/commit/28c2d4a5b24c4fccb4e5acf58088d1a6887a62f5#diff-364138cf1fe4a2d01021c945c17349b8L45

I think we need to run 'bashcomp_alias' for the 'j' command (according to the second item in https://wiki.gentoo.org/wiki/Bash/Installing_completion_files). Can you check this ebuild: http://lukas.vms.6com.net/~lukas/autojump-22.2.4-r3.ebuild ?

There is an extra line 'bashcomp_alias autojump j'.
Comment 17 Tomasz Golinski 2015-09-16 19:28:04 UTC
I agree that autojump is python program and does not require bash to run. But in order to use it usual in bash, it needs to set certain aliases. It's done via /etc/profile.d/autojump.sh  which runs a correct alias-setting script depending on the active shell: source /usr/share/autojump/autojump.${shell}. In case of bash, it fails as there is no corresponding file. 

In my understanding of things, bash-completions are a different thing altogether - they should only make bash understand that "j" is a command which should be followed by a directory name. 

Right now, both in -r2 and your new ebuild, alias "j" doesn't get defined (unless I'm doing something really wrong) and running autojump directly produce:

"Please source the correct autojump file in your shell's
startup file. For more information, please reinstall autojump
and read the post installation instructions."
Comment 18 Lukas Polacek 2015-09-17 05:38:18 UTC
(In reply to Tomasz Golinski from comment #17)
> I agree that autojump is python program and does not require bash to run.
> But in order to use it usual in bash, it needs to set certain aliases. It's
> done via /etc/profile.d/autojump.sh  which runs a correct alias-setting
> script depending on the active shell: source
> /usr/share/autojump/autojump.${shell}. In case of bash, it fails as there is
> no corresponding file. 
> 
> In my understanding of things, bash-completions are a different thing
> altogether - they should only make bash understand that "j" is a command
> which should be followed by a directory name. 
> 
> Right now, both in -r2 and your new ebuild, alias "j" doesn't get defined
> (unless I'm doing something really wrong) and running autojump directly
> produce:
> 
> "Please source the correct autojump file in your shell's
> startup file. For more information, please reinstall autojump
> and read the post installation instructions."

I didn't get this error when I ran bash from my regular zsh terminal, but I did get it when trying "sudo bash". I have now added back the line "doins bin/${PN}.bash". Please try again: http://lukas.vms.6com.net/~lukas/autojump-22.2.4-r3.ebuild 

If it works, I'll make a new pull request.

By the way, the previous ebuild only installed the .bash file when bash-completion was set, so it was broken for people not wanting completion.
Comment 19 Tomasz Golinski 2015-09-17 18:10:01 UTC
Now it works but I'm not sure if it is the correct way as the same file gets installed in two places:

/usr/share/bash-completion/completions/autojump 
and 
/usr/share/autojump/autojump.bash 


However I still get the warning:

 * Problems with installed bash completions were found:
 * 
 *      autojump: incorrect name, no completions for 'autojump' command defined.
 * 
 * For more details on installing bash-completions, please see:
 * https://wiki.gentoo.org/wiki/Bash/Installing_completion_files
 * 

If it worked for you in some cases before, it may mean that I have something broken in my setup. Bash-comp files are probably not parsed. However, they shouldn't need to be enabled for autojump to work. 

Currently, it seems that for some people the config file will be parsed twice...
Comment 20 Lukas Polacek 2015-09-23 05:35:54 UTC
I've made a new PR, the bash file is installed and no bash completion files are installed: https://github.com/gentoo/gentoo/pull/121