Simone Pelosi has proposed merging ~pelpsi/txpkgupload:build-dropin-cache-make-compile into txpkgupload:master.
Commit message: Added plugincache.py file to build dropin.cache Make file will call `TWISTD_BUILD_CACHE` once the `plugincache.py` file is compiled as console_script by setup. Requested reviews: Launchpad code reviewers (launchpad-reviewers) For more details, see: https://code.launchpad.net/~pelpsi/txpkgupload/+git/txpkgupload/+merge/450702 -- Your team Launchpad code reviewers is requested to review the proposed merge of ~pelpsi/txpkgupload:build-dropin-cache-make-compile into txpkgupload:master.
diff --git a/Makefile b/Makefile index b849c49..3b3935d 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,7 @@ VIRTUALENV += --extra-search-dir=$(DEPENDENCY_DIR)/ PIP := $(PIP_ENV) $(ENV)/bin/pip TWISTD = $(ENV)/bin/twistd +TWISTD_BUILD_CACHE = $(ENV)/bin/build-twisted-plugin-cache VERSION_INFO = version-info.py @@ -47,6 +48,7 @@ bootstrap: $(DEPENDENCY_DIR) compile: $(MAKE) $(ENV) + $(TWISTD_BUILD_CACHE) [ ! -d .git ] || $(MAKE) $(VERSION_INFO) diff --git a/setup.py b/setup.py index fc284de..6f3ae16 100755 --- a/setup.py +++ b/setup.py @@ -81,6 +81,11 @@ setup( test=['fixtures', 'testtools'], ), + entry_points={ + 'console_scripts': [ + 'build-twisted-plugin-cache = twisted.plugins.plugincache:main', + ] + }, # This does not play nicely with buildout because it downloads but does # not cache the package. # setup_requires=['eggtestinfo', 'setuptools_bzr'], diff --git a/src/twisted/plugins/plugincache.py b/src/twisted/plugins/plugincache.py new file mode 100644 index 0000000..f71dcba --- /dev/null +++ b/src/twisted/plugins/plugincache.py @@ -0,0 +1,17 @@ +# Copyright 2023 Canonical Ltd. This software is licensed under the +# GNU Affero General Public License version 3 (see the file LICENSE). + +"""Build dropin.cache for all installed Twisted plugins. + +This would be built on the fly if we didn't do it here, but we want to make +sure to build it in a predictable environment. In particular, if a plugin's +cache is first built as a result of being run via ampoule, then ampoule will +fail if any part of the process of importing the plugin installs a default +reactor. +""" + +from twisted.plugin import IPlugin, getPlugins + + +def main(): + list(getPlugins(IPlugin))
_______________________________________________ Mailing list: https://launchpad.net/~launchpad-reviewers Post to : launchpad-reviewers@lists.launchpad.net Unsubscribe : https://launchpad.net/~launchpad-reviewers More help : https://help.launchpad.net/ListHelp