Skip to content

Commit afcd650

Browse files
JohnDLemyint
authored andcommitted
Added alternative download url for LanguageTool zip file (jxmorris12#62)
* Added alternate download site capability * Updated the README with Environment Variable set instruction * Fixed environment variable documentation to correctly have underscores in name. * Fixed documentation name of environment variable name to match what is in code * Fixed logic to handle unset enviornment variable * fixed length format issue
1 parent 8d35d8c commit afcd650

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

‎README.rst‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ If you are using Python 2, you'll need to install 3to2 beforehand::
6666

6767
$ pip install --upgrade 3to2
6868

69+
To overwrite the host part of URL that is used to download LanguageTool-{version}.zip::
70+
71+
- SET LANGUAGE_CHECK_DOWNLOAD_HOST = [alternate URL]
72+
6973

7074
Prerequisites
7175
-------------

‎download_lt.py‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import shutil
99
import subprocess
1010
import sys
11+
import os
1112

1213
from contextlib import closing
1314
from distutils.spawn import find_executable
@@ -22,8 +23,10 @@
2223
from urllib import urlopen
2324
from urlparse import urljoin
2425

25-
26-
BASE_URL = 'https://www.languagetool.org/download/'
26+
ALT_BASE_URL = os.environ['LANGUAGE_CHECK_DOWNLOAD_HOST'] \
27+
if os.environ.get('LANGUAGE_CHECK_DOWNLOAD_HOST') \
28+
else None
29+
BASE_URL = ALT_BASE_URL or 'https://www.languagetool.org/download/'
2730
FILENAME = 'LanguageTool-{version}.zip'
2831
PACKAGE_PATH = 'language_check'
2932
JAVA_6_COMPATIBLE_VERSION = '2.2'

0 commit comments

Comments
 (0)