From a735a6c830fd2612b815cc5dd11b465170129b12 Mon Sep 17 00:00:00 2001 From: Ken Soh Date: Sat, 4 Jan 2020 17:33:44 +0800 Subject: [PATCH] #36 - include Windows dependency for pack() Including vcredist_x86.exe as part of pack() to streamline deployment on Windows without internet. This lets users enjoy the automated setup on the air-gapped computer without having to download vcredist_x86.exe elsewhere and transfer the file to that computer to install. --- README.md | 2 +- setup.py | 2 +- tagui.py | 19 +++++++++++++++---- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 9a72b1c..9c6a9a7 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # TagUI for Python :snake: -[**Use Cases**](#use-cases) | [**API Reference**](#api-reference) | [**About & Credits**](#about--credits) | [**PyCon Video**](https://www.youtube.com/watch?v=F2aQKWx_EAE) | [**Free Starbucks \***](#api-reference) | [**v1.20**](https://github.com/tebelorg/TagUI-Python/releases) +[**Use Cases**](#use-cases) | [**API Reference**](#api-reference) | [**About & Credits**](#about--credits) | [**PyCon Video**](https://www.youtube.com/watch?v=F2aQKWx_EAE) | [**Free Starbucks \***](#api-reference) | [**v1.21**](https://github.com/tebelorg/TagUI-Python/releases) ![TagUI for Python demo in Jupyter notebook](https://raw.githubusercontent.com/tebelorg/Tump/master/tagui_python.gif) diff --git a/setup.py b/setup.py index dab45d7..78084d9 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name='tagui', - version='1.20.0', + version='1.21.0', py_modules=['tagui'], author='Ken Soh', author_email='opensource@tebel.org', diff --git a/tagui.py b/tagui.py index c013b1c..19a683c 100644 --- a/tagui.py +++ b/tagui.py @@ -2,7 +2,7 @@ # Apache License 2.0, Copyright 2019 Tebel.Automation Private Limited # https://github.com/tebelorg/TagUI-Python/blob/master/LICENSE.txt __author__ = 'Ken Soh ' -__version__ = '1.20.0' +__version__ = '1.21.0' import subprocess import os @@ -411,13 +411,20 @@ def setup(): # check that tagui packaged php is working, it has dependency on MSVCR110.dll if os.system(tagui_directory + '/' + 'src' + '/' + 'php/php.exe -v > nul 2>&1') != 0: print('[TAGUI][INFO] - now installing missing Visual C++ Redistributable dependency') - vcredist_x86_url = 'https://raw.githubusercontent.com/tebelorg/Tump/master/vcredist_x86.exe' - if download(vcredist_x86_url, tagui_directory + '/vcredist_x86.exe'): - os.system(tagui_directory + '/vcredist_x86.exe') + # download from hosted setup file, if not already present when deployed using pack() + if not os.path.isfile(tagui_directory + '/vcredist_x86.exe'): + vcredist_x86_url = 'https://raw.githubusercontent.com/tebelorg/Tump/master/vcredist_x86.exe' + if not download(vcredist_x86_url, tagui_directory + '/vcredist_x86.exe'): + return False + + # run setup to install the MSVCR110.dll dependency (user action required) + os.system(tagui_directory + '/vcredist_x86.exe') + # check again if tagui packaged php is working, after installing vcredist_x86.exe if os.system(tagui_directory + '/' + 'src' + '/' + 'php/php.exe -v > nul 2>&1') != 0: print('[TAGUI][INFO] - MSVCR110.dll is still missing, install vcredist_x86.exe from') + print('[TAGUI][INFO] - the vcredist_x86.exe file in ' + home_directory + '\\tagui or from') print('[TAGUI][INFO] - https://www.microsoft.com/en-us/download/details.aspx?id=30679') print('[TAGUI][INFO] - after that, TagUI ready for use in your Python environment') return False @@ -599,6 +606,10 @@ def pack(): # next download jython to tagui/src/sikulix folder (after init() it can be moved away) if platform.system() == 'Windows': tagui_directory = os.environ['APPDATA'] + '/' + 'tagui' + # pack in Visual C++ MSVCR110.dll dependency from PHP for offline installation + vcredist_x86_url = 'https://raw.githubusercontent.com/tebelorg/Tump/master/vcredist_x86.exe' + if not download(vcredist_x86_url, tagui_directory + '/vcredist_x86.exe'): + return False else: tagui_directory = os.path.expanduser('~') + '/' + '.tagui' sikulix_directory = tagui_directory + '/' + 'src' + '/' + 'sikulix'