[PyQt] Install script for Python applications

Darren Dale dsdale24 at gmail.com
Sat Dec 12 15:52:17 GMT 2009

On Sat, Dec 12, 2009 at 9:52 AM, Lukas Hetzenecker <LuHe at gmx.at> wrote:
> Hello,
> thank you for your quick answer.
> But I don't quite understand distutils.

Did you read the documentation at http://docs.python.org/distutils/index.html ?

> At the beginning i have some fundamental questions:
>  - Should whole applications also be installed in
>   /usr/lib/python2.6/site-packages ?

That is generally where distutils will put it, unless the user who
runs setup.py tells distutils to install it somewhere else by setting
some install flags.

>  - Should the wrapper script only execute the main python file in
>   /usr/lib/python2.6/site-packages/<name>/<name>.py or should
>   I copy this file to /usr/[local]/bin?

If <name>/<name>.py is a module, you should write a wrapper script
that calls it, and declare the script to distutils. Then the script
will be installed to the proper location, and the proper location can
be overridden by the user if necessary by passing install flags.

>  - Where should I place the language files (app_de.qm  and  qt_de.qm) ?

I'm not familiar with language files. If they are only needed at
buildtime, and not runtime, there is no need to install them at all.
Otherwise, you may need to experiment.

>  - What is the standard path for data files? /usr/share/<application> ?

I guess depends where the python executable is installed, and also
details of the installation. Usually it is /usr/share, but it might be
/usr/local/share, or ~/.local/share, or ~/Library/share. The user can
pass --user or --prefix flags to the install command to specify where
it should be installed. I think many packages just install the data
files along with the package itself (for example in site-packages)

> And now to distutils...
> I have this folder structure:
> <series60-remote-0.4>
>  <pc>
>      <devices>
>        __init__.py
>        series60.py
>      <window>
>        __init__.py
>        about.py
>        chat.py
>        history.py
>        ...
>      series60-remote.py
>  <lib>
>    __init__.py
>    status_numbers.py
>  <mobile>
>     mobile.py
>     series60-remote.sis
> Is it possible to say distutils that it should copy these files to the
> following locations:
> /usr/lib/python2.6/site-packages
>  <series60-remote>
>    <lib>
>     __init__.py
>      status_numbers.py
>    <devices>
>       __init__.py
>      series60.py
>    <window>
>      __init__.py
>      about.py
>      chat.py
>      history.py
>      ...
>    series60-remote.py


> /usr/share/series60-remote
>   series60-remote.sis

I think so, but I've been installing the data files as part of the package.

> /usr/bin
>  series60-remote


> Please note that the root folder isn't pc, but series60-remote when it is
> installed.

I don't think this is a problem. You probably just need to specify the
package_dir to distutils how your tree is organized.

> I have the main python file pc/series60-remote.py. is it possible to tell
> distutils that it should look in this file and find all modules that it needs
> and copy these to /usr/lib/python2.6/site-packages?

If I understand your question: no distutils does not attempt to
determine what packages to include in your distribution by inspecting
some main file. You declare what packages or modules to include. I
suggest reading the distutils documentation at
http://docs.python.org/distutils/index.html before asking for
additional help.


More information about the PyQt mailing list