Updating an egg

About updating waitress ( see Plone 5.2.8 released - #5 by alert ) is there a way to install waitress 2.1.2 in the buildout cache dir? Then I would just replace the occourrences of waitress (and dependencies if updated) in bin/instance, parts/instance/bin/interpreter and .installed.cfg.

Btw, both bin/instance and parts/instance/bin/interpreter starts with:

import sys

sys.path[0:0] = [
... <- same lines here

could this stay in a single file? Or having them linked in the venv lib/<python>/site-packages? This is a special case for Plone but then I could do in the venv pip install waitress=2.1.2 using the plone constrains and requirements to be sure to be ok.
Dependencies would install too the same way automatically.

I think I could do just pip install Plone=5.2.9 (which has the constrains and requirements) when the new version will came out.

@gotcha @alert

I just pinned waitress = 2.1.2 in all my buildouts.
Is there something preventing you to do the same?

No, it was just a question if updates can be done differently from running buildout again.

You could create a small buildout to only install the new waitress, and have this use the same buildout cache directory. Then it would be available for your other buildout.
Theoretically, if you then edit bin/instance to use the new version, and restart, it should work. I have tried this previously now and then, and I think it mostly did not work, for unknown reasons. But my conclusions may be wrong.

1 Like

You could also try to build your egg with python setup.py bdist_egg and change the path to the created egg:

[ale@flo waitress]$ python setup.py bdist_egg 
running bdist_egg
zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist/waitress-3.0.0b0-py3.10.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)

The egg will be in the dist directory:

[ale@flo waitress]$ ll dist/
-rw-rw-r-- 1 ale ale 108840 giu  1 12:34 waitress-3.0.0b0-py3.10.egg

If you change the path in your bin/instance script to point to the egg it should work.
Note that the command produces a zipped egg.

I do not remember how to make an unzipped one, I used to play with this kind of stuff a long time ago.
I also think that if the zipped egg causes problems you can just unzip it:

[ale@flo dist]$ mv waitress-3.0.0b0-py3.10.egg waitress-3.0.0b0-py3.10.egg.zip
[ale@flo dist]$ unzip waitress-3.0.0b0-py3.10.egg.zip -d waitress-3.0.0b0-py3.10.egg
Archive:  waitress-3.0.0b0-py3.10.egg.zip
  inflating: waitress-3.0.0b0-py3.10.egg/EGG-INFO/PKG-INFO  
  inflating: waitress-3.0.0b0-py3.10.egg/waitress/__pycache__/wasyncore.cpython-310.pyc 

At the end this is a nice (and totally untested) exercise, but I would definitely update and rerun the buildout.

1 Like