Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 437548 - app-misc/anki-2.0 - version bump
Summary: app-misc/anki-2.0 - version bump
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal enhancement with 1 vote (vote)
Assignee: Thomas Kahle (RETIRED)
URL: http://ankisrs.net/anki2.html
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-07 21:28 UTC by Nathan
Modified: 2012-10-23 17:04 UTC (History)
4 users (show)

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


Attachments
ebuild for anki 2 (anki-2.0.0.ebuild,1.05 KB, text/plain)
2012-10-10 22:28 UTC, Nathan
Details
ebuild for anki 2 (anki-2.0.0.ebuild,1.30 KB, text/plain)
2012-10-12 03:34 UTC, Nathan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nathan 2012-10-07 21:28:36 UTC
Anki 2 was released a couple of days ago. It has loads of improvements over v1, so it would be awesome if it could be added to the tree
Comment 1 Thomas Kahle (RETIRED) gentoo-dev 2012-10-09 00:05:10 UTC
I looked at this today and Anki-2 is not distutils based anymore.  It comes as-is with bundled python dependencies.  Any comments on how to proceed are welcome.
Comment 2 Nathan 2012-10-10 22:28:43 UTC
Created attachment 326244 [details]
ebuild for anki 2

I have made an ebuild for anki 2. Its probaly not great, as this is only the second one Ive made, but I'm happy to modify anything that needs to be changed.

The ebuild doesnt have any use flags, as there is no way to actually configure/build anki. All of ankis dependecies (including the ones in libanki/thirdparty and the ones that anki can run without) are included.

I also recomend we file bugs upstream for an usuable makefile, and for the removal of libanki/thirdparty, or at least the removal of dependency on it.

Otherwise anki installs, and seems to runs without any errors, although I havent yet tested it extensivly.
Comment 3 Thomas Kahle (RETIRED) gentoo-dev 2012-10-10 22:38:24 UTC
Hi.  Thanks for this.  I know that we can just copy all the stuff using the ebuild, but this is prune to break.  For instance if python-3 is the main python interpreter, then anki will not run, even if python-2 is installed.  The wrapper script "anki" needs to be rewritten for Gentoo.  It would be really great if you could start to inquire upstream about a more distro friendly distribution.  Judging from the traffic on the mailing list it is probably not their top priority, though...

For everybody coming to this bug to find out about Anki in gentoo, until there is an ebuild you can just unpack it in your home directory and run it from there.  I mean, if no installation is necessary, then we don't really need an ebuild.
Comment 4 Nathan 2012-10-12 03:34:56 UTC
Created attachment 326348 [details]
ebuild for anki 2

I realized anki does not actually depend on the libs in libanki/thirdparty, they  are just added to the system path, and so with propper dependencies (specifically >beautifulsoup-4) it doesn't need them at all, hence the ebuild does not install them anymore.

The use flags now control the dependecies anki could do without (ie. if you dont have pyaudio then when you try to record it tells you you need pyaudio to record instead of crashing)

A simple sed replaces makes anki work equally well with ethier python2 or python3 set as the default python

The exec instalation directory has been changed from /usr/local/bin to /usr/bin, as thats where almost all of the binarys go, and at least on my system anki was the only binary installed in /usr/lcoal/bin

And lastly the src_install still uses eutil functions to copy the files to the right places, but its not like theres a whole lot of files that need moving, so its fairly simple. Upstream git has already updated the Makefile to support DISTDIR, so when they make a new release we can update our ebuild to use their makefile
Comment 5 Thomas Kahle (RETIRED) gentoo-dev 2012-10-14 01:32:35 UTC
Hi Nathan,

thanks for your efforts. I have put an updated version into my overlay: https://github.com/tom111/TomOverlay/blob/master/app-misc/anki/anki-2.0.0.ebuild I still want to fix the python install in a better way (maybe using python eclass) before adding it to the tree.

(In reply to comment #4)
> I realized anki does not actually depend on the libs in libanki/thirdparty,
> they  are just added to the system path, and so with propper dependencies
> (specifically >beautifulsoup-4) it doesn't need them at all, hence the
> ebuild does not install them anymore.

Do you mean beautifulsoup:python-2 ?  Also the dependencie in the ebuild were all explicit (like forbidding versions that are not in the tree anyway).  This is not needed, I made them more generic.  httplib2 was too low. 

> The use flags now control the dependecies anki could do without (ie. if you
> dont have pyaudio then when you try to record it tells you you need pyaudio
> to record instead of crashing)

OK

> A simple sed replaces makes anki work equally well with ethier python2 or
> python3 set as the default python

This should probably be done with python.eclass

> The exec instalation directory has been changed from /usr/local/bin to
> /usr/bin, as thats where almost all of the binarys go, and at least on my
> system anki was the only binary installed in /usr/lcoal/bin

yes, sure.

> And lastly the src_install still uses eutil functions to copy the files to
> the right places, but its not like theres a whole lot of files that need
> moving, so its fairly simple. Upstream git has already updated the Makefile
> to support DISTDIR, so when they make a new release we can update our ebuild
> to use their makefile

OK.  I used some functions from eutils, check it out.  Feel free to e-mail me if you have questions about the changes...
Comment 6 Nathan 2012-10-14 22:05:30 UTC
(In reply to comment #5)
> Do you mean beautifulsoup:python-2 ?
I believe that beatfiulsoup4 have a different import header (beautifulsoup4 is called bs4, while beautifulsoup3 is called BeautifulSoup), as well as some other incompatibilities. It may be though that BeautifulSoup4 does not support python2, which would in fact make beautifulsoup3 beautifulsoup:python-2
https://anki.lighthouseapp.com/projects/100923/tickets/90-anki-should-use-beautiful-soup-4
Comment 7 Thomas Kahle (RETIRED) gentoo-dev 2012-10-22 20:10:10 UTC
OK, we are almost there.  I changed the overlay ebuild again to use python.eclass.  Can somebody try it out and give feedback if it works before we expose it to the public?

Regarding beautifulsoup, I think beautifulsoup:python-2 is the right slot (in Gentoo).
Comment 8 Nathan 2012-10-22 20:38:30 UTC
Just tested your ebuild.. on my system it installs the anki and aqt folders into "/usr/lib64/python3.2/site-packages", which causes the anki binary not to be able to find them, and therefore not be able to run
Comment 9 Nathan 2012-10-22 20:42:44 UTC
that is with my default python set to python3, when I changed my default python to python2 and reinstalled it worked. Probably "$(python_get_sitedir)" needs to be changed to its python2 equivalent
Comment 10 Francesco Turco 2012-10-22 20:43:53 UTC
Just tested the new Anki ebuild, and I can confirm I have the same problem as Nathan. Running "anki" fails with the following error:

Traceback (most recent call last):
  File "/usr/bin/anki", line 14, in <module>
    import anki, aqt
ImportError: No module named anki

Anki installs files in /usr/lib64/python3.2/site-packages/, but I think it's a Python-2 application.
Comment 11 Thomas Kahle (RETIRED) gentoo-dev 2012-10-22 20:50:07 UTC
(In reply to comment #10)
> Just tested the new Anki ebuild, and I can confirm I have the same problem
> as Nathan. Running "anki" fails with the following error:
> 
> Traceback (most recent call last):
>   File "/usr/bin/anki", line 14, in <module>
>     import anki, aqt
> ImportError: No module named anki
> 
> Anki installs files in /usr/lib64/python3.2/site-packages/, but I think it's
> a Python-2 application.

OK, I think I fixed that now.  Can you try again please.  Thanks!
Comment 12 Nathan 2012-10-22 20:55:37 UTC
The updated ebuild seems to work for me now, even when my default python is python-3
Comment 13 Francesco Turco 2012-10-22 21:06:43 UTC
Now files are correctly put in /usr/lib64/python2.7/site-packages/. I can launch Anki just fine. Beside installation, uninstallation works fine, too. I have yet to learn how to write ebuilds, so I can't help on properly reviewing it.

Another thing. I used flags -sound -recording -latex, but icons for inserting recordings and LaTeX formulas are still present in Anki's interface. I'm new to Anki, so I don't know if it's expected behaviour.
Comment 14 Thomas Kahle (RETIRED) gentoo-dev 2012-10-23 17:04:04 UTC
(In reply to comment #13)
> Now files are correctly put in /usr/lib64/python2.7/site-packages/. I can
> launch Anki just fine. Beside installation, uninstallation works fine, too.
> I have yet to learn how to write ebuilds, so I can't help on properly
> reviewing it.
> 
> Another thing. I used flags -sound -recording -latex, but icons for
> inserting recordings and LaTeX formulas are still present in Anki's
> interface. I'm new to Anki, so I don't know if it's expected behaviour.

Yes that is expected.  If you don't have the dependencies than certain parts of Anki will just not work.  The developers did not implement hiding them from you or actually deactivating them.

Anki-2 is now in tree and should hit the mirrors soon.  Please open new bugs for further issues.  Thanks everybody.

+
+  23 Oct 2012; Thomas Kahle <tomka@gentoo.org> +anki-2.0.0.ebuild:
+  Bump to Anki2. Thanks to all contributors in bug 437548