You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2020/06/17 21:48:04 UTC

[allura] branch db/8367 created (now fc97c0d)

This is an automated email from the ASF dual-hosted git repository.

brondsem pushed a change to branch db/8367
in repository https://gitbox.apache.org/repos/asf/allura.git.


      at fc97c0d  [#8367] switch to mediawiki fork with py3 compatibility

This branch includes the following new commits:

     new 5b512ca  [#8367] upgrade html2text
     new 5f776d4  [#8367] latest version of pip-tools
     new 92c22b5  [#8367] latest oauth2 isn't on pypi, only github.  And fix an API test
     new fc97c0d  [#8367] switch to mediawiki fork with py3 compatibility

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[allura] 01/04: [#8367] upgrade html2text

Posted by br...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

brondsem pushed a commit to branch db/8367
in repository https://gitbox.apache.org/repos/asf/allura.git

commit 5b512ca4580ad18392f4cd3f3d2eca5949455e86
Author: Dave Brondsema <da...@brondsema.net>
AuthorDate: Tue Jun 16 17:15:31 2020 -0400

    [#8367] upgrade html2text
---
 Allura/allura/scripts/trac_export.py                     | 4 +++-
 ForgeBlog/forgeblog/tests/test_commands.py               | 7 ++++---
 ForgeImporters/forgeimporters/github/tests/test_wiki.py  | 5 ++++-
 ForgeImporters/forgeimporters/github/wiki.py             | 2 +-
 ForgeImporters/forgeimporters/trac/tests/test_tickets.py | 4 ++--
 requirements-optional.txt                                | 6 +-----
 6 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/Allura/allura/scripts/trac_export.py b/Allura/allura/scripts/trac_export.py
index be8004c..b5934d8 100644
--- a/Allura/allura/scripts/trac_export.py
+++ b/Allura/allura/scripts/trac_export.py
@@ -74,7 +74,7 @@ Export ticket data from a Trac instance''')
 class TracExport(object):
 
     PAGE_SIZE = 100
-    TICKET_URL = 'ticket/%d'
+    TICKET_URL = 'ticket/%s'
     QUERY_MAX_ID_URL = 'query?col=id&order=id&desc=1&max=2'
     QUERY_BY_PAGE_URL = 'query?col=id&col=time&col=changetime&order=id&max=' + \
         str(PAGE_SIZE) + '&page=%d'
@@ -171,6 +171,7 @@ class TracExport(object):
         ticket['description'] = html2text.html2text(
             desc.renderContents('utf8').decode('utf8')) if desc else ''
         comments = []
+        relative_base_url = six.moves.urllib.parse.urlparse(self.full_url(self.TICKET_URL % '')).path
         for comment in d.findAll('form', action='#comment'):
             c = {}
             c['submitter'] = re.sub(
@@ -180,6 +181,7 @@ class TracExport(object):
             changes = six.text_type(comment.find('ul', 'changes') or '')
             body = comment.find('div', 'comment')
             body = body.renderContents('utf8').decode('utf8') if body else ''
+            body = body.replace('href="{}'.format(relative_base_url), 'href="')  # crude way to rewrite ticket links
             c['comment'] = html2text.html2text(changes + body)
             c['class'] = 'COMMENT'
             comments.append(c)
diff --git a/ForgeBlog/forgeblog/tests/test_commands.py b/ForgeBlog/forgeblog/tests/test_commands.py
index f728ca4..addc8ee 100644
--- a/ForgeBlog/forgeblog/tests/test_commands.py
+++ b/ForgeBlog/forgeblog/tests/test_commands.py
@@ -82,7 +82,7 @@ def test_pull_rss_feeds(parsefeed):
         "foo bar\n"
         "</p>\n"
         "\n"
-        "<p>#foo bar <a href='baz'>\n"
+        "<p>#foo bar <a href='http://other.com/baz'>\n"
         "baz\n"
         "</a></p>\n"
     )
@@ -90,9 +90,10 @@ def test_pull_rss_feeds(parsefeed):
     rendered_html_content = "\n".join([
         r"1\. foo",
         "",
-        r"\#foo bar [baz](baz) foo bar ",
+        r"\#foo bar [baz](http://example.com/baz) foo bar",
+        "",
+        r"\#foo bar [ baz ](http://other.com/baz)",
         "",
-        r"\#foo bar [ baz ](baz)",
         " [link](http://example.com/)",
     ])
 
diff --git a/ForgeImporters/forgeimporters/github/tests/test_wiki.py b/ForgeImporters/forgeimporters/github/tests/test_wiki.py
index 910ac91..d300907 100644
--- a/ForgeImporters/forgeimporters/github/tests/test_wiki.py
+++ b/ForgeImporters/forgeimporters/github/tests/test_wiki.py
@@ -426,6 +426,7 @@ Our website is [[http://domain.net]].
   * [Test2](/p/test/wiki/AgentSpring conventions)
   * [Test3](/p/test/wiki/AgentSpring Q&A)
   * [Test4](/p/test/wiki/Extensions)
+
 '''
 
         assert_equal(f(source, 'test.mediawiki'), result)
@@ -486,13 +487,14 @@ See [Page]'''
   1. Duplicate libraries regularly break builds
   2. Subtle bugs emerge with duplicate libraries, and to a lesser extent, duplicate tools
   3. We want you to try harder to make your formula work with what OS X comes with
+
 '''
 
         assert_equal(f(source, 'test.textile'), result)
 
         # textile-style links converts normal
         source = '*"Textile":Troubleshooting*'
-        result = '**[Textile](Troubleshooting)**\n'
+        result = '**[Textile](Troubleshooting)**\n\n'
         assert_equal(f(source, 'test2.textile'), result)
 
         # links with formatting converts normal in textile now
@@ -507,6 +509,7 @@ some text and *[[Tips n' Tricks]]*
 some text and **[Tips n\u2019 Tricks]**
 
 **[link](http://otherlink.com)**
+
 '''
         assert_equal(f(source, 'test3.textile'), result)
 
diff --git a/ForgeImporters/forgeimporters/github/wiki.py b/ForgeImporters/forgeimporters/github/wiki.py
index 3cc1ba4..9fec9ec 100644
--- a/ForgeImporters/forgeimporters/github/wiki.py
+++ b/ForgeImporters/forgeimporters/github/wiki.py
@@ -334,7 +334,7 @@ class GitHubWikiImporter(ToolImporter):
             if html2text:
                 text = html2text.html2text(text)
                 text = self.convert_gollum_tags(text)
-            text = text.replace('<notextile>', '').replace('</notextile>', '')
+            text = text.replace('<notextile>', '').replace('< notextile>', '').replace('</notextile>', '')
             text = text.replace('&#60;notextile&#62;', '').replace(
                 '&#60;/notextile&#62;', '')
             text = text.replace('&lt;notextile&gt;', '').replace(
diff --git a/ForgeImporters/forgeimporters/trac/tests/test_tickets.py b/ForgeImporters/forgeimporters/trac/tests/test_tickets.py
index b58e122..ee77cd5 100644
--- a/ForgeImporters/forgeimporters/trac/tests/test_tickets.py
+++ b/ForgeImporters/forgeimporters/trac/tests/test_tickets.py
@@ -269,7 +269,7 @@ class TestTracImportSupportFunctional(TestRestApiBase, TestCase):
         csv_fp = open(os.path.dirname(__file__) + '/data/test-list.csv')
         html_fp = open(os.path.dirname(__file__) + '/data/test-list.html')
         with patch.object(TracExport, 'next_ticket_ids', return_value=[(390, {})]):
-            te = TracExport('url', do_attachments=False)
+            te = TracExport('http://somesite.com/apps/trac/open-ms/', do_attachments=False)
             te.exhausted = True
             te.csvopen = lambda s: csv_fp
         with patch('allura.scripts.trac_export.urlopen', return_value=html_fp):
@@ -284,6 +284,6 @@ class TestTracImportSupportFunctional(TestRestApiBase, TestCase):
                                      ticket_num=390)
         self.assertIn('To reproduce:  \n\\- open an mzML file',
                       ticket.description)
-        self.assertIn('duplicate of:  \n\\- [#316](316)',
+        self.assertIn('duplicate of:  \n\\- [#316](316 "defect: SpectraViewWidget is',
                       ticket.discussion_thread.find_posts()[0].text)
         self.assertIn('will crash TOPPView.', ticket.description)
diff --git a/requirements-optional.txt b/requirements-optional.txt
index 2da797a..36ba703 100644
--- a/requirements-optional.txt
+++ b/requirements-optional.txt
@@ -2,11 +2,7 @@
 # License v2
 
 # for ForgeWiki mediawiki importer, as well as ForgeBlog external feed
-# importer
-# Use the bleeding edge since stable release 3.200.3 doesn't have
-# https://github.com/aaronsw/html2text/commit/a5c0f3317edd1c9b61f89539b6a6e8363cf99225
-# or many other escaping/formatting improvements
--e git://github.com/brondsem/html2text.git#egg=html2text # GPL
+html2text==2019.8.11  # last to support py2
 
 # for ForgeWiki's mediawiki importer:
 -e git://github.com/zikzakmedia/python-mediawiki.git#egg=python-mediawiki   # GPL


[allura] 03/04: [#8367] latest oauth2 isn't on pypi, only github. And fix an API test

Posted by br...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

brondsem pushed a commit to branch db/8367
in repository https://gitbox.apache.org/repos/asf/allura.git

commit 92c22b565616a74cb861734ca73a92026e66243b
Author: Dave Brondsema <da...@brondsema.net>
AuthorDate: Wed Jun 17 11:44:29 2020 -0400

    [#8367] latest oauth2 isn't on pypi, only github.  And fix an API test
---
 Allura/allura/controllers/rest.py | 2 +-
 requirements.in                   | 6 ++++--
 requirements.txt                  | 2 +-
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/Allura/allura/controllers/rest.py b/Allura/allura/controllers/rest.py
index ee6548e..6072c6f 100644
--- a/Allura/allura/controllers/rest.py
+++ b/Allura/allura/controllers/rest.py
@@ -399,7 +399,7 @@ class ProjectRestController(object):
         if 'doap' in kw:
             response.headers['Content-Type'] = str('')
             response.content_type = str('application/rdf+xml')
-            return '<?xml version="1.0" encoding="UTF-8" ?>' + c.project.doap()
+            return b'<?xml version="1.0" encoding="UTF-8" ?>' + c.project.doap()
         return c.project.__json__()
 
     @expose('json:')
diff --git a/requirements.in b/requirements.in
index 10f85c7..759d91a 100644
--- a/requirements.in
+++ b/requirements.in
@@ -20,8 +20,10 @@ Markdown<3
 markdown-checklist==0.4.1
 MarkupSafe
 Ming==0.5.7
-# oauth2 doesn't have py3.6 support.  There's a fork with fixes but no pypi releases I can find.  https://github.com/joestump/python-oauth2/issues/223
-oauth2
+# TODO: move to "oauthlib" instead
+# oauth2 doesn't have a release with py3.6 support, but does have fixes on master:
+# archive/.../.zip URL is preferable over git+https://... since it supports pip hash generating+checking
+https://github.com/joestump/python-oauth2/archive/b94f69b1ad195513547924e380d9265133e995fa.zip#egg=oauth2
 paginate
 Paste
 PasteDeploy
diff --git a/requirements.txt b/requirements.txt
index 4030d32..a24ec2c 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -50,7 +50,7 @@ markupsafe==1.1.1         # via -r requirements.in, easywidgets, jinja2, turboge
 ming==0.5.7               # via -r requirements.in
 mock==3.0.5               # via -r requirements.in
 nose==1.3.7               # via -r requirements.in
-oauth2==1.9.0.post1       # via -r requirements.in
+https://github.com/joestump/python-oauth2/archive/b94f69b1ad195513547924e380d9265133e995fa.zip#egg=oauth2  # via -r requirements.in
 oauthlib==3.0.2           # via requests-oauthlib
 paginate==0.5.6           # via -r requirements.in
 paste==3.1.0              # via -r requirements.in, easywidgets, pastescript


[allura] 04/04: [#8367] switch to mediawiki fork with py3 compatibility

Posted by br...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

brondsem pushed a commit to branch db/8367
in repository https://gitbox.apache.org/repos/asf/allura.git

commit fc97c0d4b161cf9d44b34bec4b0086a508b4144d
Author: Dave Brondsema <da...@brondsema.net>
AuthorDate: Wed Jun 17 17:25:13 2020 -0400

    [#8367] switch to mediawiki fork with py3 compatibility
---
 ForgeWiki/forgewiki/converters.py | 4 ++--
 requirements-optional.txt         | 3 +--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/ForgeWiki/forgewiki/converters.py b/ForgeWiki/forgewiki/converters.py
index 072a178..45dae98 100644
--- a/ForgeWiki/forgewiki/converters.py
+++ b/ForgeWiki/forgewiki/converters.py
@@ -65,8 +65,8 @@ def mediawiki2markdown(source):
         from mediawiki import wiki2html
     except ImportError:
         raise ImportError("""This operation requires GPL libraries:
-        "mediawiki" (https://github.com/zikzakmedia/python-mediawiki.git)
-        "html2text" (https://github.com/aaronsw/html2text.git)""")
+        "mediawiki" (https://pypi.org/project/mediawiki2html/)
+        "html2text" (https://pypi.org/project/html2text/)""")
 
     html2text.BODY_WIDTH = 0
 
diff --git a/requirements-optional.txt b/requirements-optional.txt
index 36ba703..037b5d4 100644
--- a/requirements-optional.txt
+++ b/requirements-optional.txt
@@ -5,8 +5,7 @@
 html2text==2019.8.11  # last to support py2
 
 # for ForgeWiki's mediawiki importer:
--e git://github.com/zikzakmedia/python-mediawiki.git#egg=python-mediawiki   # GPL
-MySQL-python  # GPL
+mediawiki2html  # GPL
 
 # for spam checking
 akismet==1.0.1


[allura] 02/04: [#8367] latest version of pip-tools

Posted by br...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

brondsem pushed a commit to branch db/8367
in repository https://gitbox.apache.org/repos/asf/allura.git

commit 5f776d4975362333a4cf30929903458cd4f3e61e
Author: Dave Brondsema <da...@brondsema.net>
AuthorDate: Wed Jun 17 11:40:25 2020 -0400

    [#8367] latest version of pip-tools
---
 requirements-dev.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/requirements-dev.txt b/requirements-dev.txt
index 2938925..2c3f366 100644
--- a/requirements-dev.txt
+++ b/requirements-dev.txt
@@ -16,7 +16,7 @@ imagesize==1.1.0          # via sphinx
 jinja2==2.11.2            # via sphinx
 markupsafe==1.1.1         # via jinja2
 packaging==19.0           # via sphinx
-pip-tools==4.3.0
+pip-tools==5.2.1
 pygments==2.4.2           # via sphinx
 pyparsing==2.4.0          # via packaging
 pytz==2019.1              # via babel