Re: Help needed for eric6 development - support setup.py
Grzegorz Bokota <[email protected]>
| Newsgroups | gmane.comp.python.pyqt-pykde,gmane.comp.ide.eric |
|---|---|
| Message-ID | <CADUBGeRjVGhqB8DPt=iP77RjntDVdM4HoupRDtZ43_-agtHTFQ@mail.gmail.com> |
there is no VERSION file in the repository.
I also suggestto store __version__ varable in __init__.py of eric. The
allows to check it form imported lib.
Some code like:
def read(*parts):
with codecs.open(os.path.join(current_dir, *parts), 'r') as fp:
return fp.read()
def find_version(*file_paths):
version_file = read(*file_paths)
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
version_file, re.M)
if version_match:
return version_match.group(1)
raise RuntimeError("Unable to find version string.")
You put in one file
python_requires=">=3.5",
and
"Programming Language :: Python :: 2.7",
I add few fixes to setup.py to build ui files during build phase (lines
96-118). Now, on my computer, it builds (When add VERSION file) and can be
installed with pip install ./eric6.
I do not use eric earler so i do not know how to test it.
I got warnings like Warning: translation file 'qscintilla_pl_PL'could not
be loaded. on startup.
pon., 15 kwi 2019 o 18:43 Detlev Offenbach <[email protected]>
napisał(a):
> Thanks Barry. Every example is useful.
>
> Detlev
>
> Am Sonntag, 14. April 2019, 22:52:46 CEST schrieb Barry:
> > > On 14 Apr 2019, at 18:36, Detlev Offenbach <[email protected]>
> > > wrote:
> > >
> > > Hello all,
> > >
> > > I would like to support distribution of eric6 via PyPI. This requires
> it
> > > to be packaged as a wheel via setuptools and a setup.py file.
> > > Unfortunately I am not familiar with this task. Nevertheless, I
> > > reorganized the eric 6 source tree and created a first setup.py file
> and
> > > packed everything into the 'setup.py' branch of the eric repository.
> > >
> > > Help with the setup.py file would be much appreciated. Please send
> > > patches/
> > > suggestions/tips, simply everything that makes this task done to me or
> > > these mailing lists.
> >
> > If your code is pure python it should be easy enough to package.
> >
> > Is this example usedul?
> > https://github.com/barry-scott/PythonWinAppPackager/blob/master/setup.py
> >
> > Barry
> >
> > > Regards,
> > > Detlev
> > >
> > > PS: Who to checkout the repository is explained on the eric web site
> > > (https:// eric-ide.python-projects.org).
>
> --
> Detlev Offenbach
> [email protected]
>
>
> _______________________________________________
> PyQt mailing list [email protected]
> https://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
_______________________________________________
PyQt mailing list [email protected]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
setup.py
(text/x-python, 7.4 KB)
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) 2019 Detlev Offenbach <[email protected]> # 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 from setuptools.command.build_py import build_py ###################################################################### ## 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) def pyName(py_dir, py_file): """ Local function to create the Python source file name for the compiled .ui file. @param py_dir suggested name of the directory (string) @param py_file suggested name for the compile source file (string) @return tuple of directory name (string) and source file name (string) """ return py_dir, "Ui_{0}".format(py_file) class CreateUI(build_py): def run(self): from PyQt5.uic import compileUiDir compileUiDir(os.path.join(os.path.dirname(__file__), "eric6"), True, pyName) super().run() CmdClass = { 'install_data': Eric6InstallData, 'build_py': CreateUI } ###################################################################### ## 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="[email protected]", 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, )