|
2 | 2 | # Apache License 2.0, Copyright 2019 Tebel.Automation Private Limited
|
3 | 3 | # https://github.com/tebelorg/RPA-Python/blob/master/LICENSE.txt
|
4 | 4 | __author__ = 'Ken Soh <[email protected]>'
|
5 |
| -__version__ = '1.49.0' |
| 5 | +__version__ = '1.50.0' |
6 | 6 |
|
7 | 7 | import subprocess
|
8 | 8 | import os
|
@@ -245,6 +245,19 @@ def _patch_macos_pjs():
|
245 | 245 | else:
|
246 | 246 | return True
|
247 | 247 |
|
| 248 | +def _patch_macos_py3(): |
| 249 | + """because newer macOS does not have python command only python3 command""" |
| 250 | + if platform.system() == 'Darwin' and not os.path.isfile(tagui_location() + '/.tagui/src/py3_patched'): |
| 251 | + if not os.system('python --version > /dev/null 2>&1') == 0: |
| 252 | + if os.system('python3 --version > /dev/null 2>&1') == 0: |
| 253 | + list_of_patch_files = [tagui_location() + '/.tagui/src/casperjs/bin/casperjs', |
| 254 | + tagui_location() + '/.tagui/src/casperjs/tests/clitests/runtests.py', |
| 255 | + tagui_location() + '/.tagui/src/slimerjs/slimerjs.py'] |
| 256 | + for patch_file in list_of_patch_files: |
| 257 | + dump(load(patch_file).replace('#!/usr/bin/env python', '#!/usr/bin/env python3'), patch_file) |
| 258 | + dump('python updated to python 3', tagui_location() + '/.tagui/src/py3_patched') |
| 259 | + return True |
| 260 | + |
248 | 261 | def coord(x_coordinate = 0, y_coordinate = 0):
|
249 | 262 | """function to form a coordinate string from x and y integers"""
|
250 | 263 | return '(' + str(x_coordinate) + ',' + str(y_coordinate) + ')'
|
@@ -420,6 +433,8 @@ def setup():
|
420 | 433 |
|
421 | 434 | # patch PhantomJS to solve OpenSSL issue
|
422 | 435 | if not _patch_macos_pjs(): return False
|
| 436 | + # patch files to solve no python issue |
| 437 | + if not _patch_macos_py3(): return False |
423 | 438 | print('[RPA][INFO] - TagUI now ready for use in your Python environment')
|
424 | 439 |
|
425 | 440 | # perform Windows specific setup actions
|
@@ -488,6 +503,8 @@ def init(visual_automation = False, chrome_browser = True, headless_mode = False
|
488 | 503 |
|
489 | 504 | # on macOS, patch PhantomJS to latest v2.1.1 to solve OpenSSL issue
|
490 | 505 | if platform.system() == 'Darwin' and not _patch_macos_pjs(): return False
|
| 506 | + # newer macOS has no python command, patch some files header to python3 |
| 507 | + if platform.system() == 'Darwin' and not _patch_macos_py3(): return False |
491 | 508 |
|
492 | 509 | # create entry flow to launch SikuliX accordingly
|
493 | 510 | if visual_automation:
|
|
0 commit comments