This is an automated email from the ASF dual-hosted git repository. brondsem pushed a commit to branch db/8386 in repository https://gitbox.apache.org/repos/asf/allura.git
commit 98dc61e26362266d956d56a55523ea6dd8b13c9d Author: Dave Brondsema <[email protected]> AuthorDate: Mon May 3 13:56:52 2021 -0400 [#8386] remove chardet, make requests library still work --- .travis.yml | 2 +- Allura/allura/lib/helpers.py | 15 +++++++++++++++ Allura/docs/getting_started/install_each_step.rst | 2 +- Allura/docs/getting_started/installation.rst | 2 +- requirements.txt | 2 -- update.sh | 6 +++--- 6 files changed, 21 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 529efcf..e078ee3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,7 +32,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 -r requirements.txt + - pip install -r requirements.txt --no-deps --upgrade --upgrade-strategy=only-if-needed - npm install script: - ./rebuild-all.bash diff --git a/Allura/allura/lib/helpers.py b/Allura/allura/lib/helpers.py index e63232a..d70f83a 100644 --- a/Allura/allura/lib/helpers.py +++ b/Allura/allura/lib/helpers.py @@ -43,6 +43,21 @@ 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/docs/getting_started/install_each_step.rst b/Allura/docs/getting_started/install_each_step.rst index 3d0a49c..f4ff725 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 + (env-allura)~/src/allura$ pip install -r requirements.txt --no-deps --upgrade --upgrade-strategy=only-if-needed This may take a little while. diff --git a/Allura/docs/getting_started/installation.rst b/Allura/docs/getting_started/installation.rst index d18d818..64ace8f 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 + docker-compose run web pip install -r requirements.txt --no-deps --upgrade --upgrade-strategy=only-if-needed 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/requirements.txt b/requirements.txt index 453c318..cefd5ec 100644 --- a/requirements.txt +++ b/requirements.txt @@ -24,8 +24,6 @@ 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 9bf3a1e..f160744 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 -r requirements.txt` ...' -pip install -r requirements.txt +echo 'Updating python packages with pip install ...' +pip install -r requirements.txt --no-deps --upgrade --upgrade-strategy=only-if-needed if [ "$?" -gt 0 ]; then echo echo - echo 'Command `pip install -r requirements.txt` failed. Sometimes this is a random download error. If so, just try again.' + echo 'Command `pip install ...` failed. Sometimes this is a random download error. If so, just try again.' exit; fi
