Skip to content
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

Plone 5.2 and Python 3 support #197

Merged
merged 40 commits into from Mar 23, 2020
Merged

Plone 5.2 and Python 3 support #197

merged 40 commits into from Mar 23, 2020

Conversation

buchi
Copy link
Member

@buchi buchi commented Mar 15, 2020

Adds support for Plone 5.2 and Python 3

Mainly compatibility fixes. Uses Plone's installer view PLIP 1340 if available and falls back to QuickInstaller if not.

@mauritsvanrees
Copy link
Contributor

I tried it out, and seems to work on 5.2 Py 3. Note that I don't use the zcml upgrade steps, so I did not test those.

I have one problem though.
In the extras_require we have: 'colors': ['blessed <= 1.9.5']. That does not work on Python 3:

$ bin/upgrade plone_upgrade --all-sites
Traceback (most recent call last):
  File "/Users/maurits/.pyenv/versions/3.7.6/lib/python3.7/sre_parse.py", line 1015, in parse_template
    this = chr(ESCAPES[this][1])
KeyError: '\\d'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "bin/upgrade", line 308, in <module>
    import ftw.upgrade.command
  File "/Users/maurits/clients/zeelandia/plone52/develop/ftw.upgrade/ftw/upgrade/command/__init__.py", line 1, in <module>
    from ftw.upgrade.command import combine_bundles
  File "/Users/maurits/clients/zeelandia/plone52/develop/ftw.upgrade/ftw/upgrade/command/combine_bundles.py", line 5, in <module>
    from ftw.upgrade.command.terminal import TERMINAL
  File "/Users/maurits/clients/zeelandia/plone52/develop/ftw.upgrade/ftw/upgrade/command/terminal.py", line 30, in <module>
    TERMINAL = Terminal()
  File "/Users/maurits/shared-eggs/cp37m/blessed-1.9.5-py3.7.egg/blessed/terminal.py", line 207, in __init__
    for re_name, re_val in init_sequence_patterns(self).items():
  File "/Users/maurits/shared-eggs/cp37m/blessed-1.9.5-py3.7.egg/blessed/sequences.py", line 281, in init_sequence_patterns
    _wont_move = _merge_sequences(get_wontmove_sequence_patterns(term))
  File "/Users/maurits/shared-eggs/cp37m/blessed-1.9.5-py3.7.egg/blessed/sequences.py", line 233, in get_wontmove_sequence_patterns
    ] + list(map(re.escape, (term.r1, term.r2, term.r3,))))
  File "/Users/maurits/shared-eggs/cp37m/blessed-1.9.5-py3.7.egg/blessed/sequences.py", line 68, in _build_any_numeric_capability
    cap_re = re.sub('(\d+)', r'(\d+)', cap_re)
  File "/Users/maurits/.pyenv/versions/3.7.6/lib/python3.7/re.py", line 192, in sub
    return _compile(pattern, flags).sub(repl, string, count)
  File "/Users/maurits/.pyenv/versions/3.7.6/lib/python3.7/re.py", line 309, in _subx
    template = _compile_repl(template, pattern)
  File "/Users/maurits/.pyenv/versions/3.7.6/lib/python3.7/re.py", line 300, in _compile_repl
    return sre_parse.parse_template(repl, pattern)
  File "/Users/maurits/.pyenv/versions/3.7.6/lib/python3.7/sre_parse.py", line 1018, in parse_template
    raise s.error('bad escape %s' % this, len(this))
re.error: bad escape \d at position 1

The version restriction was added in 2015 to avoid a conflict with six pinning by Plone: 7f145e4
But blessings only requires six >= 1.9.0. This only conflicts with the 1.8.0 pin of Plone 4.3.8 and earlier, and 5.0.2 and earlier.
So I think it is fine to remove the version restriction on blessed from our setup.py. The latest blessed version seems to work on Python 2.7 too.

This could be done outside of this PR too, but it is most necessary for Python 3.

Workaround for users: do not add ftw.upgrade['colors'] to the eggs, but simply ftw.upgrade.
Then it seems to work fine with the python3 branch of this PR.
And actually, even with the colors extra I don't see any colors, except some green lines in the help text. There may be a few commands that are more colourful though.

The version restriction was added to avoid a conflict with six pinnings
by older Plone versions (Plone <= 4.3.8 and <= 5.0.2).
@buchi buchi marked this pull request as ready for review March 17, 2020 13:13
@buchi
Copy link
Member Author

buchi commented Mar 17, 2020

@mauritsvanrees thanks for your feedback! I've removed the version constraint for blessed.

I've also cherry-picked your fix for the port number into this PR.

Copy link
Contributor

@deiferni deiferni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the mostly small and granular commits. Made reviewing this a bit easier.

Some comments/suggestions, but nothing that would block a merge. Some things i mentioned were fixed in later commits. Apart from that LGTM 👍.

Did a testrun upgrading https://github.com/4teamwork/opengever.core/ from 2019.1 to 2020.1. Worked flawlessly from what i can tell ✨.

ftw/upgrade/command/help.py Show resolved Hide resolved
test-plone-5.2.x-py37.cfg Outdated Show resolved Hide resolved
ftw/upgrade/gatherer.py Outdated Show resolved Hide resolved
ftw/upgrade/gatherer.py Outdated Show resolved Hide resolved
ftw/upgrade/executioner.py Outdated Show resolved Hide resolved
It's no longer needed as of Plone 5.2.1
@buchi
Copy link
Member Author

buchi commented Mar 23, 2020

@deiferni @mauritsvanrees thans for reviewing!

@buchi buchi merged commit 2fc531e into master Mar 23, 2020
@buchi buchi deleted the python3 branch March 23, 2020 17:54
@buchi buchi mentioned this pull request Mar 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants