Skip to content

Commit

Permalink
#477 - fix macos no python issue
Browse files Browse the repository at this point in the history
  • Loading branch information
kensoh committed Jul 7, 2023
1 parent e5e05a6 commit 0be843d
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# RPA for Python :snake:

[**v1.49**](https://github.com/tebelorg/RPA-Python/releases) • [**Use Cases**](#use-cases) • [**API Reference**](#api-reference) • [**About & Credits**](#about--credits) • [**Try on Cloud**](https://colab.research.google.com/drive/1or8DtXZP8ZxJYK52me0dA6O9A1dXKKOE?usp=sharing) • [**PyCon Video**](https://www.youtube.com/watch?v=F2aQKWx_EAE) • [**Telegram Chat**](https://t.me/pythonrpa) • [*中文*](https://github-com.translate.goog/tebelorg/RPA-Python?_x_tr_sl=en&_x_tr_tl=zh-CN&_x_tr_hl=en-US&_x_tr_pto=wapp) • [*हिन्दी*](https://github-com.translate.goog/tebelorg/RPA-Python?_x_tr_sl=en&_x_tr_tl=hi&_x_tr_hl=en-US&_x_tr_pto=wapp) • [*Español*](https://github-com.translate.goog/tebelorg/RPA-Python?_x_tr_sl=en&_x_tr_tl=es&_x_tr_hl=en-US&_x_tr_pto=wapp) • [*Français*](https://github-com.translate.goog/tebelorg/RPA-Python?_x_tr_sl=en&_x_tr_tl=fr&_x_tr_hl=en-US&_x_tr_pto=wapp) • [*عربى*](https://github-com.translate.goog/tebelorg/RPA-Python?_x_tr_sl=en&_x_tr_tl=ar&_x_tr_hl=en-US&_x_tr_pto=wapp) • [*বাংলা*](https://github-com.translate.goog/tebelorg/RPA-Python?_x_tr_sl=en&_x_tr_tl=bn&_x_tr_hl=en-US&_x_tr_pto=wapp) • [*Русский*](https://github-com.translate.goog/tebelorg/RPA-Python?_x_tr_sl=en&_x_tr_tl=ru&_x_tr_hl=en-US&_x_tr_pto=wapp) • [*Português*](https://github-com.translate.goog/tebelorg/RPA-Python?_x_tr_sl=en&_x_tr_tl=pt&_x_tr_hl=en-US&_x_tr_pto=wapp) • [*Bahasa*](https://github-com.translate.goog/tebelorg/RPA-Python?_x_tr_sl=en&_x_tr_tl=id&_x_tr_hl=en-US&_x_tr_pto=wapp) • [*Deutsch*](https://github-com.translate.goog/tebelorg/RPA-Python?_x_tr_sl=en&_x_tr_tl=de&_x_tr_hl=en-US&_x_tr_pto=wapp) • [*More..*](https://github-com.translate.goog/tebelorg/RPA-Python?_x_tr_sl=en&_x_tr_tl=sr&_x_tr_hl=en-US&_x_tr_pto=wapp)
[**v1.50**](https://github.com/tebelorg/RPA-Python/releases) • [**Use Cases**](#use-cases) • [**API Reference**](#api-reference) • [**About & Credits**](#about--credits) • [**Try on Cloud**](https://colab.research.google.com/drive/1or8DtXZP8ZxJYK52me0dA6O9A1dXKKOE?usp=sharing) • [**PyCon Video**](https://www.youtube.com/watch?v=F2aQKWx_EAE) • [**Telegram Chat**](https://t.me/pythonrpa) • [*中文*](https://github-com.translate.goog/tebelorg/RPA-Python?_x_tr_sl=en&_x_tr_tl=zh-CN&_x_tr_hl=en-US&_x_tr_pto=wapp) • [*हिन्दी*](https://github-com.translate.goog/tebelorg/RPA-Python?_x_tr_sl=en&_x_tr_tl=hi&_x_tr_hl=en-US&_x_tr_pto=wapp) • [*Español*](https://github-com.translate.goog/tebelorg/RPA-Python?_x_tr_sl=en&_x_tr_tl=es&_x_tr_hl=en-US&_x_tr_pto=wapp) • [*Français*](https://github-com.translate.goog/tebelorg/RPA-Python?_x_tr_sl=en&_x_tr_tl=fr&_x_tr_hl=en-US&_x_tr_pto=wapp) • [*عربى*](https://github-com.translate.goog/tebelorg/RPA-Python?_x_tr_sl=en&_x_tr_tl=ar&_x_tr_hl=en-US&_x_tr_pto=wapp) • [*বাংলা*](https://github-com.translate.goog/tebelorg/RPA-Python?_x_tr_sl=en&_x_tr_tl=bn&_x_tr_hl=en-US&_x_tr_pto=wapp) • [*Русский*](https://github-com.translate.goog/tebelorg/RPA-Python?_x_tr_sl=en&_x_tr_tl=ru&_x_tr_hl=en-US&_x_tr_pto=wapp) • [*Português*](https://github-com.translate.goog/tebelorg/RPA-Python?_x_tr_sl=en&_x_tr_tl=pt&_x_tr_hl=en-US&_x_tr_pto=wapp) • [*Bahasa*](https://github-com.translate.goog/tebelorg/RPA-Python?_x_tr_sl=en&_x_tr_tl=id&_x_tr_hl=en-US&_x_tr_pto=wapp) • [*Deutsch*](https://github-com.translate.goog/tebelorg/RPA-Python?_x_tr_sl=en&_x_tr_tl=de&_x_tr_hl=en-US&_x_tr_pto=wapp) • [*More..*](https://github-com.translate.goog/tebelorg/RPA-Python?_x_tr_sl=en&_x_tr_tl=sr&_x_tr_hl=en-US&_x_tr_pto=wapp)

![RPA for Python demo in Jupyter notebook](https://raw.githubusercontent.com/tebelorg/Tump/master/tagui_python.gif)

Expand Down
2 changes: 1 addition & 1 deletion rpa_package/rpa.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Apache License 2.0, Copyright 2019 Tebel.Automation Private Limited
# https://github.com/tebelorg/RPA-Python/blob/master/LICENSE.txt
__author__ = 'Ken Soh <[email protected]>'
__version__ = '1.49.0'
__version__ = '1.50.0'

# for backward compatibility, invoke tagui.py functions to use in rpa.py
from tagui import *
4 changes: 2 additions & 2 deletions rpa_package/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

setup(
name='rpa',
version='1.49.0',
py_modules=['rpa'], install_requires=['tagui>=1.49.0'],
version='1.50.0',
py_modules=['rpa'], install_requires=['tagui>=1.50.0'],
author='Ken Soh',
author_email='[email protected]',
license='Apache License 2.0',
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='tagui',
version='1.49.0',
version='1.50.0',
py_modules=['tagui'],
author='Ken Soh',
author_email='[email protected]',
Expand Down
19 changes: 18 additions & 1 deletion tagui.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Apache License 2.0, Copyright 2019 Tebel.Automation Private Limited
# https://github.com/tebelorg/RPA-Python/blob/master/LICENSE.txt
__author__ = 'Ken Soh <[email protected]>'
__version__ = '1.49.0'
__version__ = '1.50.0'

import subprocess
import os
Expand Down Expand Up @@ -245,6 +245,19 @@ def _patch_macos_pjs():
else:
return True

def _patch_macos_py3():
"""because newer macOS does not have python command only python3 command"""
if platform.system() == 'Darwin' and not os.path.isfile(tagui_location() + '/.tagui/src/py3_patched'):
if not os.system('python --version > /dev/null 2>&1') == 0:
if os.system('python3 --version > /dev/null 2>&1') == 0:
list_of_patch_files = [tagui_location() + '/.tagui/src/casperjs/bin/casperjs',
tagui_location() + '/.tagui/src/casperjs/tests/clitests/runtests.py',
tagui_location() + '/.tagui/src/slimerjs/slimerjs.py']
for patch_file in list_of_patch_files:
dump(load(patch_file).replace('#!/usr/bin/env python', '#!/usr/bin/env python3'), patch_file)
dump('python updated to python 3', tagui_location() + '/.tagui/src/py3_patched')
return True

def coord(x_coordinate = 0, y_coordinate = 0):
"""function to form a coordinate string from x and y integers"""
return '(' + str(x_coordinate) + ',' + str(y_coordinate) + ')'
Expand Down Expand Up @@ -420,6 +433,8 @@ def setup():

# patch PhantomJS to solve OpenSSL issue
if not _patch_macos_pjs(): return False
# patch files to solve no python issue
if not _patch_macos_py3(): return False
print('[RPA][INFO] - TagUI now ready for use in your Python environment')

# perform Windows specific setup actions
Expand Down Expand Up @@ -488,6 +503,8 @@ def init(visual_automation = False, chrome_browser = True, headless_mode = False

# on macOS, patch PhantomJS to latest v2.1.1 to solve OpenSSL issue
if platform.system() == 'Darwin' and not _patch_macos_pjs(): return False
# newer macOS has no python command, patch some files header to python3
if platform.system() == 'Darwin' and not _patch_macos_py3(): return False

# create entry flow to launch SikuliX accordingly
if visual_automation:
Expand Down

0 comments on commit 0be843d

Please sign in to comment.