How do I use 'data_files' in setup.py?

Asked by Erigami

I'm trying to add icons to my app's .deb. I've done this by putting them in the data/media directory. I want them to end up in /usr/share/icons/gnome (or somewhere similar).

Question #138208 seems to suggest that I should edit setup.py to specify paths with a 'data_files' argument to setup(). When I do that, I get the following failure when I run 'quickly package':

<pre>
...
Ubuntu packaging created in debian/
............................................
Command returned some WARNINGS:
----------------------------------
** (setup.py:18164): WARNING **: Trying to register gtype 'WnckWindowState' as enum when in fact it is of type 'GFlags'
** (setup.py:18164): WARNING **: Trying to register gtype 'WnckWindowActions' as enum when in fact it is of type 'GFlags'
** (setup.py:18164): WARNING **: Trying to register gtype 'WnckWindowMoveResizeMask' as enum when in fact it is of type 'GFlags'
WARNING: the following files are not recognized by DistUtilsExtra.auto:
  doing/doingconfig.py
----------------------------------
An error has occurred during package building
ERROR: package command failed
Aborting
</pre>

My setup.py now looks like:
---

DistUtilsExtra.auto.setup(
    name='doing',
    version='0.1',
    license='GPL-3',
    author='Erigami Scholey-Fuller',
    <email address hidden>',
    description='Monitor Your Application Usage',
    long_description='Monitor how long you use desktop applications.',
    url='https://launchpad.net/doing',
    cmdclass={'install': InstallAndUpdateDataDirectory},
    data_files=[
            ('share/icons/ubuntu-mono-dark/status/16',
                    'data/media/doing-indicator.png')
    ]
)
---

Why does adding a 'data_files' argument to setup() cause failures in that config file? What's the appropriate way to add extra paths to the .deb?

Question information

Language:
English Edit question
Status:
Answered
For:
Quickly Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Tony Byrne (tony-badwolf) said :
#1

Hi Erigami
 I had a look in setup.py in quickly's source

DistUtilsExtra.auto.setup(name='quickly',
      version="%s" % VERSION,
      description='build new Ubuntu apps quickly',
      long_description='Quickly enables for prospective programmer a way to easily build new ' \
                  'apps for Ubuntu based on templates and other systems for helping them ' \
                  'write their code in a guided manner. This also includes packaging and ' \
                  'deploying code.',
      url='https://launchpad.net/quickly',
      license="GPL v3",
      author='Quickly Developer Team',
      <email address hidden>',
      data_files=[('share/quickly/templates/ubuntu-application/project_root', glob.glob('data/templates/ubuntu-application/project_root/project_name.desktop.in')),
                  ('share/quickly/templates/ubuntu-pygame/project_root', glob.glob('data/templates/ubuntu-pygame/project_root/project_name.desktop.in')),
                  ('share/quickly/templates/ubuntu-flash-game/project_root', glob.glob('data/templates/ubuntu-flash-game/project_root/project_name.desktop.in'))],
      cmdclass={'install': InstallAndUpdateDataDirectory})

The glob.glob command returns a list so I tried

    data_files=[('/usr/local/share', ['data/media/background.png'])]

and it worked. If you find an expert you might get a better solution.

Can you help with this problem?

Provide an answer of your own, or ask Erigami for more information if necessary.

To post a message you must log in.