How to add icons to a project with build_icons command

Asked by Javier Collado on 2009-06-18

Hello,

Not being neither a DistutilsExtra or a debian packaging expert , I'm trying to add some icon files to a python project and I've made the following modifications:

=== modified file 'setup.py'
--- setup.py 2009-06-16 10:48:46 +0000
+++ setup.py 2009-06-18 12:08:26 +0000
@@ -3,6 +3,9 @@
+from DistUtilsExtra.command.build_extra import build_extra
+from DistUtilsExtra.command.build_icons import build_icons
+
@@ -37,4 +40,8 @@
+ cmdclass = {
+ "build": build_extra,
+ "build_icons": build_icons,
+ },
 )

In addition to this, I've added some files to the "data/icons" directory (the directory that I see is used by default in build_icons command) under the source code. I took those files from another project as a test so it should be fine. However, when running the build or the build_icons command nothing seems to happen (even using the verbose flag).

I think I'm missing something, probably there's some debian configuration file that I should add (at least to define the location in the menu hierarchy in which the icon should be located), but I'm not sure what it is since other projects I've seen don't make use of the 'menu.ex' file and the manage to get the icons installed.

Could you explain what I'm missing or point me to a good reference? Thanks in advance.

Best regards,
    Javier

Question information

Language:
English Edit question
Status:
Solved
For:
python-distutils-extra Edit question
Assignee:
No assignee Edit question
Solved by:
Martin Pitt
Solved:
2009-06-26
Last query:
2009-06-26
Last reply:
2009-06-19
Martin Pitt (pitti) said : #1

This looks fine. However, it might just be a little confusing, since "build" will not actually touch any of the icons (they don't need to be "built"). It will just cause them to be added to the install rules.

If you do

  ./setup.py install --root=/tmp/x

do you get the icons installed? Check with

  find /tmp/x/usr/local/share/icons/ -type f

Hello Martin,

Thanks for your response. Yes, the icons are there at /tmp/x/usr/local/share/icons/hicolor/<size>/apps/

Is there anything else that I should add to get the icon added to the menu?

Best regards,
    Javier

Best Martin Pitt (pitti) said : #3

So it seems that distutils-extra works as intended. FYI, this will become much easier once https://blueprints.launchpad.net/ubuntu/+spec/desktop-karmic-automagic-python-build-system lands.

> Is there anything else that I should add to get the icon added to the menu?

I need more details about that. You mean "menu" -> "application entry in the panel menu"? For this you just need to make sure that your .desktop file refers to the correct icon name. Also, your debian/*.install files need to install /usr/share/icons/ into your package. But neither of these are related to distutils.

Thanks Martin.

My problem was that the .desktop file was malformed so the icon wasn't correctly added, but the icon files were correctly installed as you already said.

Best regards,
    Javier

Thanks Martin Pitt, that solved my question.