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

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

commit bee3603c70bd319b9b0ee72dbed3d771261d7d83
Author: Dave Brondsema <[email protected]>
AuthorDate: Fri Sep 10 17:59:08 2021 +0000

    [#8396] Revert "[#8386] remove chardet, make requests library still work"
    
    This reverts commit f4ac641bcabcd7bdc199cd022fb13cf79cd93ff3.
---
 .travis.yml                                              |  3 +--
 Allura/allura/lib/custom_middleware.py                   |  2 +-
 Allura/allura/lib/helpers.py                             | 16 ----------------
 Allura/allura/lib/phone/nexmo.py                         |  1 -
 Allura/allura/lib/project_create_helpers.py              |  2 +-
 Allura/allura/lib/search.py                              |  2 +-
 Allura/allura/lib/security.py                            |  2 +-
 Allura/allura/lib/solr.py                                |  2 +-
 Allura/allura/webhooks.py                                |  2 +-
 Allura/docs/getting_started/install_each_step.rst        |  2 +-
 Allura/docs/getting_started/installation.rst             |  2 +-
 AlluraTest/alluratest/validation.py                      |  3 +--
 ForgeImporters/forgeimporters/github/__init__.py         |  1 -
 .../tests/github/functional/test_github.py               |  2 +-
 ForgeImporters/forgeimporters/trac/__init__.py           |  1 -
 requirements.txt                                         |  2 ++
 update.sh                                                |  6 +++---
 17 files changed, 16 insertions(+), 35 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 4d90096..ced0267 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,8 +26,7 @@ jobs:
         - pip install 
https://sourceforge.net/projects/pysvn/files/pysvn/V1.9.12/pysvn-1.9.12.tar.gz
 install:
   - sudo apt-get install -qq libjpeg8-dev zlib1g-dev
-  - pip install nose
-  - pip install -r requirements.txt --no-deps --upgrade 
--upgrade-strategy=only-if-needed
+  - pip install -r requirements.txt
   - npm install
 script:
   - ./rebuild-all.bash
diff --git a/Allura/allura/lib/custom_middleware.py 
b/Allura/allura/lib/custom_middleware.py
index 55f9ab6..25b31bf 100644
--- a/Allura/allura/lib/custom_middleware.py
+++ b/Allura/allura/lib/custom_middleware.py
@@ -29,11 +29,11 @@ from tg import tmpl_context as c
 from tg.support.middlewares import _call_wsgi_application as 
call_wsgi_application
 from timermiddleware import Timer, TimerMiddleware
 from webob import exc, Request
+import pysolr
 import six
 from ming.odm import session
 
 from allura.lib import helpers as h
-import pysolr  # after 'h' import to get requests/chardet patched
 from allura.lib.utils import is_ajax
 from allura import model as M
 import allura.model.repository
diff --git a/Allura/allura/lib/helpers.py b/Allura/allura/lib/helpers.py
index 79f8ad8..a7a334c 100644
--- a/Allura/allura/lib/helpers.py
+++ b/Allura/allura/lib/helpers.py
@@ -44,22 +44,6 @@ from functools import partial
 from io import BytesIO
 import cgi
 
-
-# https://forge-allura.apache.org/p/allura/tickets/8386/
-# we don't want to depend on LGPL'd chardet, but the requests library needs it
-# so if we can't import it, we'll make it exist as a copy of cchardet
-# this spot in the codebase is best, since it is imported by many things and 
is before 'requests' is imported
-# if https://github.com/psf/requests/pull/5797 is resolved, this hack could be 
removed
-try:
-    import chardet
-except ImportError:
-    import sys
-    import cchardet
-    sys.modules['chardet'] = sys.modules['cchardet']
-    import chardet
-    chardet.__version__ += '.cchardet'
-
-
 import emoji
 import tg
 import six
diff --git a/Allura/allura/lib/phone/nexmo.py b/Allura/allura/lib/phone/nexmo.py
index f5025d7..f251c93 100644
--- a/Allura/allura/lib/phone/nexmo.py
+++ b/Allura/allura/lib/phone/nexmo.py
@@ -22,7 +22,6 @@ from six.moves.urllib.parse import urljoin
 import cgi
 import json
 
-from allura.lib import helpers as h  # to get requests/chardet patched
 import requests
 import jinja2
 
diff --git a/Allura/allura/lib/project_create_helpers.py 
b/Allura/allura/lib/project_create_helpers.py
index 026b197..5e08fb3 100644
--- a/Allura/allura/lib/project_create_helpers.py
+++ b/Allura/allura/lib/project_create_helpers.py
@@ -29,6 +29,7 @@ except ImportError:  # py2 doesn't have typing yet
 
 import colander as col
 import bson
+import requests
 import formencode
 import six
 from six.moves.urllib.parse import urlparse
@@ -42,7 +43,6 @@ from tg import tmpl_context as c, app_globals as g
 
 from allura import model as M
 from allura.lib import helpers as h
-import requests
 from allura.lib.plugin import ProjectRegistrationProvider
 
 
diff --git a/Allura/allura/lib/search.py b/Allura/allura/lib/search.py
index 6d44361..462ffc2 100644
--- a/Allura/allura/lib/search.py
+++ b/Allura/allura/lib/search.py
@@ -30,9 +30,9 @@ import jinja2
 from tg import redirect, url
 from tg import tmpl_context as c, app_globals as g
 from tg import request
+from pysolr import SolrError
 
 from allura.lib import helpers as h
-from pysolr import SolrError  # after 'h' import to get requests/chardet 
patched
 from allura.lib.solr import escape_solr_arg
 from allura.lib.utils import urlencode
 import six
diff --git a/Allura/allura/lib/security.py b/Allura/allura/lib/security.py
index 2889c9e..4ff62f7 100644
--- a/Allura/allura/lib/security.py
+++ b/Allura/allura/lib/security.py
@@ -25,6 +25,7 @@ import sys
 import logging
 from collections import defaultdict
 import hashlib
+import requests
 
 from tg import tmpl_context as c
 from tg import request
@@ -562,7 +563,6 @@ class HIBPClient(object):
         Raises a named HIBPCompromisedCredentials exception if any found
         :param password: user-supplied password
         """
-        import requests
         result = 0
         try:
             # sha1 it
diff --git a/Allura/allura/lib/solr.py b/Allura/allura/lib/solr.py
index 138fa6d..d97141e 100644
--- a/Allura/allura/lib/solr.py
+++ b/Allura/allura/lib/solr.py
@@ -21,10 +21,10 @@ import logging
 
 from tg import config
 from paste.deploy.converters import asbool
+import pysolr
 import six
 
 from allura.lib.helpers import shlex_split
-import pysolr  # after helpers import to get requests/chardet patched
 
 log = logging.getLogger(__name__)
 
diff --git a/Allura/allura/webhooks.py b/Allura/allura/webhooks.py
index 5778b44..a5f0004 100644
--- a/Allura/allura/webhooks.py
+++ b/Allura/allura/webhooks.py
@@ -25,6 +25,7 @@ import time
 import socket
 import ssl
 
+import requests
 from bson import ObjectId
 from tg import expose, validate, redirect, flash, config
 from tg.decorators import with_trailing_slash, without_trailing_slash
@@ -39,7 +40,6 @@ from paste.deploy.converters import asint, aslist
 from allura.app import AdminControllerMixin
 from allura.controllers import BaseController
 from allura.lib import helpers as h
-import requests
 from allura.lib import validators as v
 from allura.lib.decorators import require_post, task
 from allura.lib.utils import DateJSONEncoder
diff --git a/Allura/docs/getting_started/install_each_step.rst 
b/Allura/docs/getting_started/install_each_step.rst
index 4bbe8f0..ec948c2 100644
--- a/Allura/docs/getting_started/install_each_step.rst
+++ b/Allura/docs/getting_started/install_each_step.rst
@@ -112,7 +112,7 @@ We'll upgrade `pip <https://pip.pypa.io/en/stable/>`_ to 
make sure its a current
 
     (env-allura)~/src$ cd allura
     (env-allura)~/src/allura$ pip install -U pip
-    (env-allura)~/src/allura$ pip install -r requirements.txt --no-deps 
--upgrade --upgrade-strategy=only-if-needed
+    (env-allura)~/src/allura$ pip install -r requirements.txt
 
 This may take a little while.
 
diff --git a/Allura/docs/getting_started/installation.rst 
b/Allura/docs/getting_started/installation.rst
index 1074af5..0c06b18 100644
--- a/Allura/docs/getting_started/installation.rst
+++ b/Allura/docs/getting_started/installation.rst
@@ -165,7 +165,7 @@ Update requirements and reinstall apps:
 
 .. code-block:: bash
 
-    docker-compose run web pip install -r requirements.txt --no-deps --upgrade 
--upgrade-strategy=only-if-needed
+    docker-compose run web pip install -r requirements.txt
     docker-compose run web ./rebuild-all.bash
 
 You may want to restart at least "taskd" container after that in order for it 
to
diff --git a/AlluraTest/alluratest/validation.py 
b/AlluraTest/alluratest/validation.py
index b10a783..30f9c46 100644
--- a/AlluraTest/alluratest/validation.py
+++ b/AlluraTest/alluratest/validation.py
@@ -39,10 +39,9 @@ import six
 import webtest
 from webtest import TestApp
 from ming.utils import LazyProperty
+import requests
 
 from allura.lib import utils
-from allura.lib import helpers as h  # to get requests/chardet patched
-import requests
 
 log = logging.getLogger(__name__)
 
diff --git a/ForgeImporters/forgeimporters/github/__init__.py 
b/ForgeImporters/forgeimporters/github/__init__.py
index 2d570b3..32098fa 100644
--- a/ForgeImporters/forgeimporters/github/__init__.py
+++ b/ForgeImporters/forgeimporters/github/__init__.py
@@ -29,7 +29,6 @@ from datetime import datetime
 from tg import config, session, redirect, request, expose
 from tg.decorators import without_trailing_slash
 from tg import tmpl_context as c
-from allura.lib import helpers as h  # to get requests/chardet patched
 from requests_oauthlib import OAuth2Session
 import requests
 from formencode import validators as fev
diff --git 
a/ForgeImporters/forgeimporters/tests/github/functional/test_github.py 
b/ForgeImporters/forgeimporters/tests/github/functional/test_github.py
index c83cc50..5cb7b8f 100644
--- a/ForgeImporters/forgeimporters/tests/github/functional/test_github.py
+++ b/ForgeImporters/forgeimporters/tests/github/functional/test_github.py
@@ -16,6 +16,7 @@
 #       under the License.
 from __future__ import unicode_literals
 from __future__ import absolute_import
+import requests
 import tg
 from mock import patch, call, Mock
 from alluratest.tools import assert_equal
@@ -23,7 +24,6 @@ from unittest import TestCase
 
 from allura.tests import TestController
 from allura import model as M
-import requests
 
 
 class TestGitHubImportController(TestController, TestCase):
diff --git a/ForgeImporters/forgeimporters/trac/__init__.py 
b/ForgeImporters/forgeimporters/trac/__init__.py
index 7ba6693..3a0949d 100644
--- a/ForgeImporters/forgeimporters/trac/__init__.py
+++ b/ForgeImporters/forgeimporters/trac/__init__.py
@@ -18,7 +18,6 @@
 from __future__ import unicode_literals
 from __future__ import absolute_import
 from formencode import validators as fev
-from allura.lib import helpers as h  # to get requests/chardet patched
 import requests
 
 from allura.lib import validators
diff --git a/requirements.txt b/requirements.txt
index 967a992..d442ab7 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -20,6 +20,8 @@ certifi==2019.6.16
     # via requests
 cffi==1.12.2
     # via cryptography
+chardet==3.0.4
+    # via requests
 colander==1.7.0
     # via -r requirements.in
 crank==0.8.1
diff --git a/update.sh b/update.sh
index f160744..9bf3a1e 100755
--- a/update.sh
+++ b/update.sh
@@ -25,12 +25,12 @@ fi
 echo 'Getting latest code with `git pull` ...'
 git pull
 
-echo 'Updating python packages with pip install ...'
-pip install -r requirements.txt --no-deps --upgrade 
--upgrade-strategy=only-if-needed
+echo 'Updating python packages with `pip install -r requirements.txt` ...'
+pip install -r requirements.txt
 if [ "$?" -gt 0 ]; then
        echo
        echo
-       echo 'Command `pip install ...` failed.  Sometimes this is a random 
download error.  If so, just try again.'
+       echo 'Command `pip install -r requirements.txt` failed.  Sometimes this 
is a random download error.  If so, just try again.'
        exit;
 fi
 

Reply via email to