Merge lp:~tomasgroth/openlp/py35 into lp:openlp/2.2

Proposed by Tomas Groth
Status: Merged
Merged at revision: 2564
Proposed branch: lp:~tomasgroth/openlp/py35
Merge into: lp:openlp/2.2
Diff against target: 101 lines (+29/-11)
2 files modified
openlp/plugins/bibles/lib/http.py (+2/-3)
openlp/plugins/songs/lib/songselect.py (+27/-8)
To merge this branch: bzr merge lp:~tomasgroth/openlp/py35
Reviewer Review Type Date Requested Status
Raoul Snyman Approve
Tim Bentley Approve
Review via email: mp+275460@code.launchpad.net

This proposal supersedes a proposal from 2015-10-19.

Description of the change

Make OpenLP run on Python 3.3-3.5

To post a comment you must log in.
Revision history for this message
Tomas Groth (tomasgroth) wrote : Posted in a previous version of this proposal

lp:~tomasgroth/openlp/py35 (revision 2565)
[SUCCESS] https//ci.openlp.io/job/Branch-01-Pull/1152/
[SUCCESS] https//ci.openlp.io/job/Branch-02-Functional-Tests/1075/
[SUCCESS] https//ci.openlp.io/job/Branch-03-Interface-Tests/1016/
[SUCCESS] https//ci.openlp.io/job/Branch-04a-Windows_Functional_Tests/863/
[SUCCESS] https//ci.openlp.io/job/Branch-04b-Windows_Interface_Tests/460/
[SUCCESS] https//ci.openlp.io/job/Branch-05a-Code_Analysis/581/
[SUCCESS] https//ci.openlp.io/job/Branch-05b-Test_Coverage/452/

Revision history for this message
Tim Bentley (trb143) wrote : Posted in a previous version of this proposal

Unable to test but makes sense.

review: Approve
Revision history for this message
Raoul Snyman (raoul-snyman) wrote : Posted in a previous version of this proposal

Please don't merge this until my approval. I want to look at a few things first.

Revision history for this message
Tim Bentley (trb143) :
review: Approve
Revision history for this message
Raoul Snyman (raoul-snyman) wrote :

I'm not sure if we should do this with 2.2. I'm more than happy to be convinced otherwise though.

Revision history for this message
Tomas Groth (tomasgroth) wrote :

> I'm not sure if we should do this with 2.2. I'm more than happy to be
> convinced otherwise though.
I'll try to convince you then :)
I think this should in particular should go into 2.2. The 2.4 release is 6-8 months away, which means that 2.2 should be able to be used until then. New releases of ubuntu and other distros will include python 3.5, so we need to support it if OpenLP is to run on those distros.
For 2.4 I think we should drop support for python 3.3.

Revision history for this message
Raoul Snyman (raoul-snyman) wrote :

OK, I'm convinced.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'openlp/plugins/bibles/lib/http.py'
--- openlp/plugins/bibles/lib/http.py 2015-09-08 19:13:59 +0000
+++ openlp/plugins/bibles/lib/http.py 2015-10-22 21:08:23 +0000
@@ -27,7 +27,6 @@
27import socket27import socket
28import urllib.parse28import urllib.parse
29import urllib.error29import urllib.error
30from html.parser import HTMLParseError
3130
32from bs4 import BeautifulSoup, NavigableString, Tag31from bs4 import BeautifulSoup, NavigableString, Tag
3332
@@ -290,7 +289,7 @@
290 page_source = str(page_source, 'cp1251')289 page_source = str(page_source, 'cp1251')
291 try:290 try:
292 soup = BeautifulSoup(page_source)291 soup = BeautifulSoup(page_source)
293 except HTMLParseError:292 except Exception:
294 log.error('BeautifulSoup could not parse the Bible page.')293 log.error('BeautifulSoup could not parse the Bible page.')
295 send_error_message('parse')294 send_error_message('parse')
296 return None295 return None
@@ -762,7 +761,7 @@
762 try:761 try:
763 soup = BeautifulSoup(page_source)762 soup = BeautifulSoup(page_source)
764 CLEANER_REGEX.sub('', str(soup))763 CLEANER_REGEX.sub('', str(soup))
765 except HTMLParseError:764 except Exception:
766 log.exception('BeautifulSoup could not parse the bible page.')765 log.exception('BeautifulSoup could not parse the bible page.')
767 if not soup:766 if not soup:
768 send_error_message('parse')767 send_error_message('parse')
769768
=== modified file 'openlp/plugins/songs/lib/songselect.py'
--- openlp/plugins/songs/lib/songselect.py 2015-07-04 21:09:59 +0000
+++ openlp/plugins/songs/lib/songselect.py 2015-10-22 21:08:23 +0000
@@ -23,10 +23,13 @@
23The :mod:`~openlp.plugins.songs.lib.songselect` module contains the SongSelect importer itself.23The :mod:`~openlp.plugins.songs.lib.songselect` module contains the SongSelect importer itself.
24"""24"""
25import logging25import logging
26import sys
26from http.cookiejar import CookieJar27from http.cookiejar import CookieJar
27from urllib.parse import urlencode28from urllib.parse import urlencode
28from urllib.request import HTTPCookieProcessor, URLError, build_opener29from urllib.request import HTTPCookieProcessor, URLError, build_opener
29from html.parser import HTMLParser30from html.parser import HTMLParser
31if sys.version_info > (3, 4):
32 from html import unescape
3033
3134
32from bs4 import BeautifulSoup, NavigableString35from bs4 import BeautifulSoup, NavigableString
@@ -129,11 +132,18 @@
129 if not search_results:132 if not search_results:
130 break133 break
131 for result in search_results:134 for result in search_results:
132 song = {135 if sys.version_info > (3, 4):
133 'title': self.html_parser.unescape(result.find('h3').string),136 song = {
134 'authors': [self.html_parser.unescape(author.string) for author in result.find_all('li')],137 'title': unescape(result.find('h3').string),
135 'link': BASE_URL + result.find('a')['href']138 'authors': [unescape(author.string) for author in result.find_all('li')],
136 }139 'link': BASE_URL + result.find('a')['href']
140 }
141 else:
142 song = {
143 'title': self.html_parser.unescape(result.find('h3').string),
144 'authors': [self.html_parser.unescape(author.string) for author in result.find_all('li')],
145 'link': BASE_URL + result.find('a')['href']
146 }
137 if callback:147 if callback:
138 callback(song)148 callback(song)
139 songs.append(song)149 songs.append(song)
@@ -167,7 +177,10 @@
167 if callback:177 if callback:
168 callback()178 callback()
169 song['copyright'] = '/'.join([li.string for li in song_page.find('ul', 'copyright').find_all('li')])179 song['copyright'] = '/'.join([li.string for li in song_page.find('ul', 'copyright').find_all('li')])
170 song['copyright'] = self.html_parser.unescape(song['copyright'])180 if sys.version_info > (3, 4):
181 song['copyright'] = unescape(song['copyright'])
182 else:
183 song['copyright'] = self.html_parser.unescape(song['copyright'])
171 song['ccli_number'] = song_page.find('ul', 'info').find('li').string.split(':')[1].strip()184 song['ccli_number'] = song_page.find('ul', 'info').find('li').string.split(':')[1].strip()
172 song['verses'] = []185 song['verses'] = []
173 verses = lyrics_page.find('section', 'lyrics').find_all('p')186 verses = lyrics_page.find('section', 'lyrics').find_all('p')
@@ -180,9 +193,15 @@
180 else:193 else:
181 verse['lyrics'] += '\n'194 verse['lyrics'] += '\n'
182 verse['lyrics'] = verse['lyrics'].strip(' \n\r\t')195 verse['lyrics'] = verse['lyrics'].strip(' \n\r\t')
183 song['verses'].append(self.html_parser.unescape(verse))196 if sys.version_info > (3, 4):
197 song['verses'].append(unescape(verse))
198 else:
199 song['verses'].append(self.html_parser.unescape(verse))
184 for counter, author in enumerate(song['authors']):200 for counter, author in enumerate(song['authors']):
185 song['authors'][counter] = self.html_parser.unescape(author)201 if sys.version_info > (3, 4):
202 song['authors'][counter] = unescape(author)
203 else:
204 song['authors'][counter] = self.html_parser.unescape(author)
186 return song205 return song
187206
188 def save_song(self, song):207 def save_song(self, song):

Subscribers

People subscribed via source and target branches

to all changes: