diff -r 660757d6c57b -r a5255f1ba3f0 setup.py --- a/setup.py Sun Apr 14 19:29:24 2019 +0200 +++ b/setup.py Mon Apr 15 19:53:29 2019 +0200 @@ -1,27 +1,121 @@ #!/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="19.5", # TODO: replace with reading from file + 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. It may be used with PyQt4 as well.", + " 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", - download_url="https://sourceforge.net/projects/eric-ide/files/eric6/" - "stable", - platforms=[ - "Linux", - "Windows", - "macOS" - ], + 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", @@ -46,51 +140,7 @@ "Topic :: Text Editors :: Integrated Development Environments (IDE)" ], keywords="Development PyQt5 IDE Python3", - packages=find_packages("eric6"), - include_package_data=True, -## scripts=[ -## "eric6_api.py", -## "eric6_browser.py", -## "eric6_compare.py", -## "eric6_configure.py", -## "eric6_diff.py", -## "eric6_doc.py", -## "eric6_editor.py", -## "eric6_hexeditor.py", -## "eric6_iconeditor.py", -## "eric6_plugininstall.py", -## "eric6_pluginrepository.py", -## "eric6_pluginuninstall.py", -## "eric6_qregexp.py", -## "eric6_qregularexpression.py", -## "eric6_re.py", -## "eric6_shell.py", -## "eric6_snap.py", -## "eric6_sqlbrowser.py", -## "eric6_tray.py", -## "eric6_trpreviewer.py", -## "eric6_uipreviewer.py", -## "eric6_unittest.py", -## "eric6_webbrowser.py", -## "eric6.py" -## ], python_requires=">=3.5", - package_data={ - # TODO: fill with package data - "": [ - "*.qm", "*.html", - ], - }, - # TODO: fill with entry points - entry_points={ -## "gui_scripts": [ -## "eric6 = eric6.eric:main", -## ], -## "scripts":[ -## "eric6_api = eric6.eric6_api:main", -## "eric6_doc = eric6.eric6_doc:main", -## ], - }, install_requires=[ "PyQt5>=5.12.1", "PyQtWebEngine>=5.12.1", @@ -99,4 +149,48 @@ "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, )