-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1169 from sukeesh/revert-1160-master
Revert "Updated some installer files"
- Loading branch information
Showing
3 changed files
with
173 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,28 @@ | ||
import traceback | ||
from helper import log_init, log_close | ||
from unix_windows import IS_WIN | ||
try: | ||
from helper import log_init, log_close | ||
from unix_windows import IS_WIN | ||
|
||
def main(): | ||
try: | ||
log_init() | ||
log_init() | ||
|
||
import os | ||
os.chdir(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) | ||
import os | ||
os.chdir(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) | ||
|
||
import steps.a_setup_virtualenv | ||
import steps.b_pip | ||
import steps.c_nltk | ||
import steps.a_setup_virtualenv | ||
import steps.b_pip | ||
import steps.c_nltk | ||
if not IS_WIN: | ||
# TODO Optional requirements on windows | ||
import steps.d_optional | ||
import steps.e_launcher | ||
|
||
if not IS_WIN: | ||
# TODO Optional requirements on windows | ||
import steps.d_optional | ||
|
||
import steps.e_launcher | ||
|
||
except SystemExit: | ||
# Expected Error | ||
pass | ||
except Exception as e: | ||
handle_unexpected_error(e) | ||
|
||
def handle_unexpected_error(exception): | ||
except SystemExit: | ||
# Expected Error | ||
pass | ||
except BaseException: | ||
print("\n\n") | ||
print("An unexpected error occurred. Please open an issue on github!") | ||
print("Here is the error:") | ||
print("here is the error:") | ||
print('') | ||
traceback.print_exc() | ||
# You can log the exception to a file or external logging system if needed | ||
log_close() | ||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,36 @@ | ||
import os | ||
|
||
def get_system_commands(): | ||
is_windows = os.name == 'nt' | ||
if os.name == 'nt': | ||
IS_WIN = True | ||
else: | ||
IS_WIN = False | ||
|
||
if is_windows: | ||
if os.system('py --version') == 0: | ||
py3_cmd = "py -3" | ||
virtualenv_cmd = "py -3 -m virtualenv" | ||
else: | ||
py3_cmd = "python" | ||
virtualenv_cmd = "python -m virtualenv" | ||
virtualenv_python = "env\\Scripts\\python.exe" | ||
virtualenv_pip = "env\\Scripts\\pip.exe" | ||
virtualenv_install_msg = f"""\ | ||
Note that virtualenv must work with Python 3! | ||
You could do: | ||
{py3_cmd} -m ensurepip | ||
{py3_cmd} -m pip install virtualenv | ||
""" | ||
|
||
if IS_WIN: | ||
if os.system('py --version') == 0: | ||
PY3 = "py -3" | ||
VIRTUALENV_CMD = "py -3 -m virtualenv" | ||
else: | ||
py3_cmd = "python3" | ||
virtualenv_cmd = "virtualenv --python=python3" | ||
virtualenv_python = "env/bin/python" | ||
virtualenv_pip = "env/bin/pip" | ||
virtualenv_install_msg = """\ | ||
For example on Ubuntu you could do | ||
> [sudo] apt install virtualenv | ||
Or use Pip: | ||
> [sudo] pip install virtualenv | ||
""" | ||
PY3 = "python" | ||
VIRTUALENV_CMD = "python -m virtualenv" | ||
VIRTUALENV_PYTHON = "env\\Scripts\\python.exe" | ||
VIRTUALENV_PIP = "env\\Scripts\\pip.exe" | ||
VIRTUALENV_INSTALL_MSG = """\ | ||
Note that virtualenv must work with Python 3! | ||
return py3_cmd, virtualenv_cmd, virtualenv_python, virtualenv_pip, virtualenv_install_msg | ||
You could do: | ||
{PY3} -m ensurepip | ||
{PY3} -m pip install virtualenv | ||
""".format(PY3=PY3) | ||
|
||
PY3, VIRTUALENV_CMD, VIRTUALENV_PYTHON, VIRTUALENV_PIP, VIRTUALENV_INSTALL_MSG = get_system_commands() | ||
else: | ||
PY3 = "python3" | ||
VIRTUALENV_CMD = "virtualenv --python=python3" | ||
VIRTUALENV_PYTHON = "env/bin/python" | ||
VIRTUALENV_PIP = "env/bin/pip" | ||
VIRTUALENV_INSTALL_MSG = """\ | ||
For example on Ubuntu you could do | ||
> [sudo] apt install virtualenv | ||
Or use Pip: | ||
> [sudo] pip install virtualenv | ||
""" |