Skip to main content

Setuptools extension to install launcher icons for KDE, GNOME, or other freedesktop.org compatible Linux/UNIX environments.

Desktop entry spec: http://standards.freedesktop.org/desktop-entry-spec/latest/index.html

License

Copyright 2015 Jacob Welsh

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Usage

Once this module is installed (such as by using the setup_requires argument), desktop entry files will be automatically installed for each gui_scripts entry point. Example:

setup(
    ...
    setup_requires=['install_freedesktop'],
    entry_points={
        'gui_scripts': [
            'myapp=myapp:main',
        ],
    },
)

This would create myapp.desktop, setting the Name and Icon keys to “myapp” and Exec to the full path of the script.

To customize, or add desktop files for non-entry-point based scripts, pass a dict to the desktop_entries argument, where each key matches a script name and its value is a dict containing the desktop entry keys/values. Example:

setup(
    ...
    setup_requires=['install_freedesktop'],
    scripts=['myscript'],
    desktop_entries={
        'myscript': {
            'Name': 'MyApp',
            'GenericName': 'Data Processor',
            'Categories': 'Office;Database;',
        },
    },
)

Notes

Either system-wide or --user mode installation is supported, as well as --root= (for package builders). But the setuptools default egg-based installation does not work. (It doesn’t run install_ subcommands; even if it did, the data files would go in the egg, not the real data directory.) So you must either use pip (recommended) or provide the --single-version-externally-managed option yourself, on the command line or in setup.cfg. Wheels and any other relocatable bdist formats will also not work, due to the need to use the final script path for the Exec in the desktop file.

Using the setup_requires argument is potentially dangerous: if the package is not found, EasyInstall will be invoked to fetch it from PyPI, even if the user thinks they have disabled this or chosen a different index. See https://pip.pypa.io/en/latest/reference/pip_install.html#controlling-setup-requires.

There is no automatic handling of icon files presently, though that’s in scope for this project. Quick example for doing it manually:

setup(
    ...
    data_files=[
        ('share/icons/hicolor/16x16/apps', ['icons/16x16/myapp.png']),
        ('share/icons/hicolor/48x48/apps', ['icons/48x48/myapp.png']),
        ('share/icons/hicolor/scalable/apps', ['icons/scalable/myapp.svg']),
    ],
)

Changes

0.1.2 (2015-02-01)

  • Simplify subcommand invocation (hopefully more correct and less fragile)

0.1.1 (2015-01-26)

  • Use README/CHANGES in long_description for PyPI

  • Fix syntax in README examples

  • Support older setuptools (CentOS 6)

0.1.0 (2015-01-26)

  • Initial release

Release files for install-freedesktop 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for install-freedesktop 0.1.2
File Size Uploaded
install_freedesktop-0.1.2.tar.gz 4.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for install-freedesktop 0.1.2
File Interpreter ABI Platform
install_freedesktop-0.1.2-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size:12.4 kB

Release files / install_freedesktop-0.1.2.tar.gz

Download URL install_freedesktop-0.1.2.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
3e5a9b3404175b69c313b6b28c6ba21ec80a2b4abd964af86a4de43c30a195f0
BLAKE2b-256 checksum
How to use checksums
506317fe03a0e470e623ee333d3d37d6d7bad00a9912f3e24b8feee53d0c1912
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / install_freedesktop-0.1.2-py2.py3-none-any.whl

Download URL install_freedesktop-0.1.2-py2.py3-none-any.whl
Size 7.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
10b8a91f9493f20e9b57d8130701b6e30595adcf3df62416e90a48404bf59676
BLAKE2b-256 checksum
How to use checksums
99335dfcb7d0c1bd0fe47e20fd6a0edde86ab15b7bbfba95c192af08c2e448c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page