Entrypoint Spezifikation : String oder Dict und wie beides?
Servus Python Users! Ich habe das Problem zwei Entry-Point Spezifikationen zusammen in eine setup.py zu bekommen. Zum eine habe ich entry_points=""" [z3c.autoinclude.plugin] target = my_base """ von z3c.autoinclude.plugin . Dann brauche ich noch ein Console Script z.B. entry_points={ 'console_scripts' : ['bokeh_server = inqbus.bokeh_plone.bokeh.startup:startup_bokeh'], } Wie man schnell sieht ist das eine ein String, das andere ein Dictionary. Dieser naive Versuch entry_points={ 'z3c.autoinclude.plugin': ['[z3c.autoinclude.plugin] target = plone'], 'console_scripts' : ['bokeh_server = inqbus.bokeh_plone.bokeh.startup:startup_bokeh'], } scheiterte mit File "/home/graphdemoplone/workspace/plone_bokeh/zeocluster/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2695, in get_entry_map self._get_metadata('entry_points.txt'), self File "/home/graphdemoplone/workspace/plone_bokeh/zeocluster/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2425, in parse_map for group, lines in data: File "/home/graphdemoplone/workspace/plone_bokeh/zeocluster/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3030, in split_sections raise ValueError("Invalid section heading", line) ValueError: ('Invalid section heading', '[z3c.autoinclude.plugin] target = plone') Leider gibt die Dokumentation zu pkg-Ressouces also setuptools zu diesem Thema wenig her. Für jede Hilfe dankbar, der Volker -- ========================================================= inqbus Scientific Computing Dr. Volker Jaenisch Richard-Strauss-Straße 1 +49(08861) 690 474 0 86956 Schongau-West http://www.inqbus.de =========================================================
Servus Python Freaks! Zuerst die schlechte Nachricht. Setup-Tools speichert die Entrypoints in den Egg-Infos ab. Das ist an sich ja nicht verkehrt. Aber es erzeugt unnötige Fehler, weil setup-tools offenbar auch die schon erzeugten entrypoints.txt Dateien parsed. Erzeuge ein neues VEnv. $ mkvirtualenv test321 Die setup.py im VEnv # -*- coding: utf-8 -*- """Installer for the inqbus.plone_bokeh package.""" from setuptools import find_packages from setuptools import setup long_description = '\n\n'.join([ open('README.rst').read(), open('CONTRIBUTORS.rst').read(), open('CHANGES.rst').read(), ]) setup( name='inqbus.plone_bokeh', version='1.0a1', description="Bokeh Integration for Plone", long_description=long_description, # Get more from https://pypi.python.org/pypi?%3Aaction=list_classifiers classifiers=[ "Environment :: Web Environment", "Framework :: Plone", "Framework :: Plone :: 5.0", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Operating System :: OS Independent", "License :: OSI Approved :: GNU General Public License v2 (GPLv2)", ], keywords='Python Plone', author='sandra', author_email='sandra.rum@inqbus.de', url='https://pypi.python.org/pypi/inqbus.plone_bokeh', license='GPL version 2', packages=find_packages('src', exclude=['ez_setup']), namespace_packages=['inqbus'], package_dir={'': 'src'}, include_package_data=True, zip_safe=False, install_requires=[ ], extras_require={ 'test': [ ], }, entry_points={ 'z3c.autoinclude.plugin': ['[z3c.autoinclude.plugin] target = plone'], 'console_scripts' : ['bokeh_server = inqbus.bokeh_plone.bokeh.startup:startup_bokeh'], } ) Installieren: python setup.py install ... File "/home/volker/workspace/test321/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 725, in process_distribution self.install_egg_scripts(dist) File "/home/volker/workspace/test321/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 601, in install_egg_scripts self.install_wrapper_scripts(dist) File "/home/volker/workspace/test321/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 793, in install_wrapper_scripts for args in ScriptWriter.best().get_args(dist): File "/home/volker/workspace/test321/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 2070, in get_args for name, ep in dist.get_entry_map(group).items(): File "/home/volker/workspace/test321/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2639, in get_entry_map self._get_metadata('entry_points.txt'), self File "/home/volker/workspace/test321/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2369, in parse_map for group, lines in data: File "/home/volker/workspace/test321/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2975, in split_sections raise ValueError("Invalid section heading", line) ValueError: ('Invalid section heading', '[z3c.autoinclude.plugin] target = plone') Geht schief. Anpassen der setup.py: ... ], extras_require={ 'test': [ ], }, entry_points={ 'console_scripts' : ['bokeh_server = inqbus.bokeh_plone.bokeh.startup:startup_bokeh'], } ) Erneutes installieren: python setup.py install ... File "/usr/lib/python2.7/distutils/core.py", line 111, in setup _setup_distribution = dist = klass(attrs) File "/home/volker/workspace/test321/local/lib/python2.7/site-packages/setuptools/dist.py", line 336, in __init__ for ep in pkg_resources.iter_entry_points('distutils.setup_keywords'): File "/home/volker/workspace/test321/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 726, in iter_entry_points entries = dist.get_entry_map(group) File "/home/volker/workspace/test321/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2639, in get_entry_map self._get_metadata('entry_points.txt'), self File "/home/volker/workspace/test321/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2369, in parse_map for group, lines in data: File "/home/volker/workspace/test321/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2975, in split_sections raise ValueError("Invalid section heading", line) ValueError: ('Invalid section heading', '[z3c.autoinclude.plugin] target = plone') Suche nach Dateien die z3c.autoinstall beinhalten (test321) volker@runner:~/workspace/test321/inqbus.plone_bokeh$ grep -R z3c.auto ../* ../inqbus.plone_bokeh/build/lib.linux-x86_64-2.7/inqbus/plone_bokeh/testing.py: # The z3c.autoinclude feature is disabled in the Plone fixture base ../inqbus.plone_bokeh/src/inqbus.plone_bokeh.egg-info/entry_points.txt:[z3c.autoinclude.plugin] ../inqbus.plone_bokeh/src/inqbus.plone_bokeh.egg-info/entry_points.txt:[z3c.autoinclude.plugin] target = plone ../inqbus.plone_bokeh/src/inqbus/plone_bokeh/testing.py: # The z3c.autoinclude feature is disabled in the Plone fixture base ../inqbus.plone_bokeh/setup.py~: 'z3c.autoinclude.plugin': ['[z3c.autoinclude.plugin] target = plone'], ../lib/python2.7/site-packages/inqbus.plone_bokeh-1.0a1-py2.7.egg/EGG-INFO/entry_points.txt:[z3c.autoinclude.plugin] ../lib/python2.7/site-packages/inqbus.plone_bokeh-1.0a1-py2.7.egg/EGG-INFO/entry_points.txt:[z3c.autoinclude.plugin] target = plone ../lib/python2.7/site-packages/inqbus.plone_bokeh-1.0a1-py2.7.egg/inqbus/plone_bokeh/testing.py: # The z3c.autoinclude feature is disabled in the Plone fixture base ../local/lib/python2.7/site-packages/inqbus.plone_bokeh-1.0a1-py2.7.egg/EGG-INFO/entry_points.txt:[z3c.autoinclude.plugin] ../local/lib/python2.7/site-packages/inqbus.plone_bokeh-1.0a1-py2.7.egg/EGG-INFO/entry_points.txt:[z3c.autoinclude.plugin] target = plone ../local/lib/python2.7/site-packages/inqbus.plone_bokeh-1.0a1-py2.7.egg/inqbus/plone_bokeh/testing.py: # The z3c.autoinclude feature is disabled in the Plone fixture base Löschen der Dateien Erst das Löschen von ../lib/python2.7/site-packages/inqbus.plone_bokeh-1.0a1-py2.7.egg/EGG-INFO/entry_points.txt: ermöglichte, das die setup.py sauber geparsed wurde. Das ist IMHO ein Fehler in Setup-Tools. Was in die Egg-Info geschrieben wurde darf nicht das erneute Ausführen der setup.py behindern. Beste Grüße Volker -- ========================================================= inqbus Scientific Computing Dr. Volker Jaenisch Richard-Strauss-Straße 1 +49(08861) 690 474 0 86956 Schongau-West http://www.inqbus.de =========================================================
participants (1)
-
Dr. Volker Jaenisch