-
Notifications
You must be signed in to change notification settings - Fork 105
[WIP] Convert ZODB via zodbupdate to Python 3 #285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
For reference, @icemac wrote a blog article about this at https://blog.gocept.com/2018/06/07/migrate-a-zope-zodb-data-fs-to-python-3/ |
I've been using this script to generate experimental migrations. Given three virtualenvs (Zope2-Python2, Zope4-Python2, Zope4-Python3), I'm creating objects in the first and check if they are still usable in the last. #!/bin/bash
set -e
set -x
basedir=~/zope/instances
instance=$1
[[ -z $instance ]] && { echo "provide instance name as first arg" ; exit ; }
if [[ ! -d $basedir/$instance-2py2 ]] ; then
echo "Creating zope-2py2 $instance"
~/.virtualenvs/zope-2py2/bin/mkzopeinstance --user admin:admin --dir $basedir/$instance-2py2
fi
$basedir/$instance-2py2/bin/runzope
if [[ ! -d $basedir/$instance-4py2 ]] ; then
echo "Creating zope-4py2 $instance"
~/.virtualenvs/zope-4py2/bin/mkwsgiinstance --user admin:admin --dir $basedir/$instance-4py2/
cp $basedir/$instance-2py2/var/Data.fs $basedir/$instance-4py2/var/
fi
~/.virtualenvs/zope-4py2/bin/runwsgi $basedir/$instance-4py2/etc/zope.ini
if [[ ! -d $basedir/$instance-4py3 ]] ; then
echo "Creating zope-4py3 $instance"
~/.virtualenvs/zope-4py3/bin/mkwsgiinstance --user admin:admin --dir $basedir/$instance-4py3/
cp $basedir/$instance-4py2/var/Data.fs $basedir/$instance-4py3/var/
~/.virtualenvs/zope-4py2/bin/zodb-py3migrate-analyze $basedir/$instance-4py3/var/Data.fs
~/.virtualenvs/zope-4py2/bin/zodbupdate \
--pack --convert-py3 --verbose --file \
$basedir/$instance-4py3/var/Data.fs
fi
~/.virtualenvs/zope-4py3/bin/runwsgi $basedir/$instance-4py3/etc/zope.ini |
With d7fcae1, you'll probably see |
just to let you know: i've updated the description of plone ticket dealing with ZODB migration for python3 (plone/Products.CMFPlone#2525) and most of the stuff there is important/relevant for pure zope applications too. |
I started writing some documentation. @icemac, I copied parts of your blog post. Hope that's ok. |
@rbu That's okay. I am merging the PR to get it into the next Zope release. |
The
str
objects stored in the ZODB have either to be converted tobytes
orunicode
.This PR contains the necessary conversion table for
zodbupdate
.Status: The conversion table is not yet complete, but conversion worked for a ZODB containing
OFS File
andOFS Image
objects.Calling the migration (has to be done in a Zope instance running Zope 4 on Python 2):
bin/zodbupdate --pack --convert-py3 -f var/Data.fs