Mon, 15 Apr 2019 19:53:29 +0200
setup.py: continued implementing support for setup.py.
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) 2019 Detlev Offenbach <detlev@die-offenbachs.de> # from __future__ import unicode_literals import os import sys import subprocess from setuptools import setup, find_packages from distutils.command.install_data import install_data ###################################################################### ## some helper functions below ###################################################################### def getVersion(): """ Function to get the version from file. @return string containing the version @rtype str """ version = "<unknown>" with open(os.path.join(os.path.dirname(__file__), "VERSION"), encoding="ASCII") as f: version = f.read().strip() return version def getPackageData(package, extensions): """ Function to return data files of a package with givene extensions. @param package name of the package directory @type str @param extensions list of extensions to test for @type list of str @return list of package data files @rtype list of str """ filesList = [] for dirpath, _dirnames, filenames in os.walk(package): for fname in filenames: if not fname.startswith('.') and \ os.path.splitext(fname)[1] in extensions: filesList.append( os.path.relpath(os.path.join(dirpath, fname), package)) return filesList def getDataFiles(): """ Return data_files in a platform dependent manner """ if sys.platform.startswith('linux'): dataFiles = [ ('share/applications', [ 'linux/eric6.desktop', 'linux/eric6_browser.desktop', ]), ('share/icons', [ 'eric6/icons/default/eric.png', 'eric6/icons/default/ericWeb48.png' ]), ('share/metainfo', ['linux/eric6.appdata.xml']) ] elif os.name == 'nt': dataFiles = [ ('scripts', [ 'eric6/pixmaps/eric6.ico', 'eric6/pixmaps/ericWeb48.ico']) ] else: dataFiles = [] return dataFiles ###################################################################### ## make Linux detect eric6 desktop files ###################################################################### class Eric6InstallData(install_data): def run(self): install_data.run(self) if sys.platform.startswith('linux'): try: subprocess.call(['update-desktop-database']) except: print("ERROR: unable to update desktop database", file=sys.stderr) CmdClass = { 'install_data': Eric6InstallData, } ###################################################################### ## setup() below ###################################################################### setup( name="eric6", version=getVersion(), description="eric6 is an integrated development environment for the" " Python language.", long_description="eric6 is an integrated development environment for the" " Python language. It uses the PyQt5 bindings and the QScintilla2" " editor widget. See https://eric-ide.python-projects.org for more" " details.", author="Detlev Offenbach", author_email="detlev@die-offenbachs.de", url="https://eric-ide.python-projects.org", project_urls={ "Source Code": "https://die-offenbachs.homelinux.org/hg/eric/", "Issues Tracker": "https://die-offenbachs.homelinux.org/issues/", }, platforms=["Linux", "Windows", "macOS"], license="GPLv3", classifiers=[ "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "Environment :: MacOS X", "Environment :: Win32 (MS Windows)", "Environment :: X11 Applications", "Environment :: X11 Applications :: Qt", "Intended Audience :: Developers", "Intended Audience :: End Users/Desktop", "Natural Language :: English", "Natural Language :: German", "Natural Language :: Russian", "Natural Language :: Spanish", "Operating System :: MacOS :: MacOS X", "Operating System :: Microsoft :: Windows :: Windows 10", "Operating System :: POSIX :: Linux", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Software Development", "Topic :: Text Editors :: Integrated Development Environments (IDE)" ], keywords="Development PyQt5 IDE Python3", python_requires=">=3.5", install_requires=[ "PyQt5>=5.12.1", "PyQtWebEngine>=5.12.1", "QScintilla>=2.11.1", "pip", "docutils", "Markdown", ], data_files=getDataFiles(), packages=find_packages(), # include_package_data=True, zip_safe=False, package_data={ "": getPackageData( "eric6", [".png", ".svg", ".svgz", ".xpm", ".ico", ".gif", ".icns", ".txt", ".style", ".tmpl", ".html", ".qch", ".css", ".qss", ".e4h", ".e6h", ".api", ".bas" ".dat"]) + ["i18n/eric6_de.qm", "i18n/eric6_en.qm", "i18n/eric6_es.qm", "i18n/eric6_ru.qm", ] }, entry_points={ "gui_scripts": [ "eric6 = eric6.eric6:main", "eric6_browser = eric6.eric6_browser:main", "eric6_compare = eric6.eric6_compare:main", "eric6_configure = eric6.eric6_configure:main", "eric6_diff = eric6.eric6_diff:main", "eric6_editor = eric6.eric6_editor:main", "eric6_hexeditor = eric6.eric6_hexeditor:main", "eric6_iconeditor = eric6.eric6_iconeditor:main", "eric6_plugininstall = eric6.eric6_plugininstall:main", "eric6_pluginrepository = eric6.eric6_pluginrepository:main", "eric6_pluginuninstall = eric6.eric6_pluginuninstall:main", "eric6_qregexp = eric6.eric6_qregexp:main", "eric6_qregularexpression = eric6.eric6_qregularexpression:main", "eric6_re = eric6.eric6_re:main", "eric6_shell = eric6.eric6_shell:main", "eric6_snap = eric6.eric6_snap:main", "eric6_sqlbrowser = eric6.eric6_sqlbrowser:main", "eric6_tray = eric6.eric6_tray:main", "eric6_trpreviewer = eric6.eric6_trpreviewer:main", "eric6_uipreviewer = eric6.eric6_uipreviewer:main", "eric6_unittest = eric6.eric6_unittest:main", ], "console_scripts":[ "eric6_api = eric6.eric6_api:main", "eric6_doc = eric6.eric6_doc:main", ], }, cmdclass=CmdClass, )