summaryrefslogtreecommitdiff
path: root/python-java-access-bridge-wrapper.spec
diff options
context:
space:
mode:
Diffstat (limited to 'python-java-access-bridge-wrapper.spec')
-rw-r--r--python-java-access-bridge-wrapper.spec352
1 files changed, 352 insertions, 0 deletions
diff --git a/python-java-access-bridge-wrapper.spec b/python-java-access-bridge-wrapper.spec
new file mode 100644
index 0000000..b7b234f
--- /dev/null
+++ b/python-java-access-bridge-wrapper.spec
@@ -0,0 +1,352 @@
+%global _empty_manifest_terminate_build 0
+Name: python-java-access-bridge-wrapper
+Version: 0.10.0
+Release: 1
+Summary: Python wrapper for the Windows Java Access Bridge
+License: Apache-2.0
+URL: https://github.com/robocorp/java-access-bridge-wrapper.git
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/36/7b/04ac2e382f32a85d02599d1d6dd40c4b1cf424f210f1fcb156e1d9219704/java_access_bridge_wrapper-0.10.0.tar.gz
+BuildArch: noarch
+
+Requires: python3-pywin32
+
+%description
+[![Version](https://img.shields.io/pypi/v/java-access-bridge-wrapper.svg?label=version)](https://pypi.org/project/java-access-bridge-wrapper/)
+[![License](https://img.shields.io/pypi/l/java-access-bridge-wrapper.svg)](http://www.apache.org/licenses/LICENSE-2.0.html)
+
+# Introduction
+
+Python wrapper around the Java Access Bridge / Windows Access Bridge.
+
+# Prerequisites
+
+* 64-bit Windows
+* Java >= 8 (https://docs.aws.amazon.com/corretto/latest/corretto-8-ug/downloads-list.html)
+* Python >= 3.7 (https://www.python.org/downloads/release/python-375/)
+
+Enable the Java Access Bridge in windows
+
+ C:\path\to\java\bin\jabswitch -enable
+
+# Install
+
+ pip install java-access-bridge-wrapper
+
+# How to use
+
+Import the Java Access Bridge (JAB) wrapper and optionally the context tree
+
+ from JABWrapper.jab_wrapper import JavaAccessBridgeWrapper
+ from JABWrapper.context_tree import ContextNode, ContextTree, SearchElement
+
+The JAB creates an virtual GUI window when it is opened. For the JAB to operate and receive events from the GUI, the calling code needs to implement the windows
+message pump and call it in a loop. The JABWrapper object needs to be in the same thread.
+
+This can be achieved for example by starting the message pump in a separate thread, where the JAB object is also initialized.
+
+ GetMessage = ctypes.windll.user32.GetMessageW
+ TranslateMessage = ctypes.windll.user32.TranslateMessage
+ DispatchMessage = ctypes.windll.user32.DispatchMessageW
+
+ def pump_background(pipe: queue.Queue):
+ try:
+ jab_wrapper = JavaAccessBridgeWrapper()
+ pipe.put(jab_wrapper)
+ message = byref(wintypes.MSG())
+ while GetMessage(message, 0, 0, 0) > 0:
+ TranslateMessage(message)
+ logging.debug("Dispatching msg={}".format(repr(message)))
+ DispatchMessage(message)
+ except Exception as err:
+ pipe.put(None)
+
+ def main():
+ pipe = queue.Queue()
+ thread = threading.Thread(target=pump_background, daemon=True, args=[pipe])
+ thread.start()
+ jab_wrapper = pipe.get()
+ if not jab_wrapper:
+ raise Exception("Failed to initialize Java Access Bridge Wrapper")
+ time.sleep(0.1) # Wait until the initial messages are parsed, before accessing frames
+
+ if __name__ == "__main__":
+ main()
+
+Once the JABWrapper object is initialized, attach to some frame and optionally create the context tree to get the element tree of the application.
+
+ jab_wrapper.switch_window_by_title("Frame title")
+ context_tree = ContextTree(jab_wrapper)
+
+# Development
+
+## Development prerequisites
+
+* Install poetry: https://python-poetry.org/docs/
+
+## Test
+
+Run test script against simple Swing application
+
+set environment variable
+
+ set RC_JAVA_ACCESS_BRIDGE_DLL="C:\path\to\Java\bin\WindowsAccessBridge-64.dll"
+
+Run test with poetry
+
+ poetry run python tests\test.py
+
+## Packaging
+
+ poetry build
+ poetry publish
+
+## TODO:
+
+* Support for 32-bit Java Access Bridge version
+* Implement rest of the utility functions to the JABWrapper
+
+
+%package -n python3-java-access-bridge-wrapper
+Summary: Python wrapper for the Windows Java Access Bridge
+Provides: python-java-access-bridge-wrapper
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-java-access-bridge-wrapper
+[![Version](https://img.shields.io/pypi/v/java-access-bridge-wrapper.svg?label=version)](https://pypi.org/project/java-access-bridge-wrapper/)
+[![License](https://img.shields.io/pypi/l/java-access-bridge-wrapper.svg)](http://www.apache.org/licenses/LICENSE-2.0.html)
+
+# Introduction
+
+Python wrapper around the Java Access Bridge / Windows Access Bridge.
+
+# Prerequisites
+
+* 64-bit Windows
+* Java >= 8 (https://docs.aws.amazon.com/corretto/latest/corretto-8-ug/downloads-list.html)
+* Python >= 3.7 (https://www.python.org/downloads/release/python-375/)
+
+Enable the Java Access Bridge in windows
+
+ C:\path\to\java\bin\jabswitch -enable
+
+# Install
+
+ pip install java-access-bridge-wrapper
+
+# How to use
+
+Import the Java Access Bridge (JAB) wrapper and optionally the context tree
+
+ from JABWrapper.jab_wrapper import JavaAccessBridgeWrapper
+ from JABWrapper.context_tree import ContextNode, ContextTree, SearchElement
+
+The JAB creates an virtual GUI window when it is opened. For the JAB to operate and receive events from the GUI, the calling code needs to implement the windows
+message pump and call it in a loop. The JABWrapper object needs to be in the same thread.
+
+This can be achieved for example by starting the message pump in a separate thread, where the JAB object is also initialized.
+
+ GetMessage = ctypes.windll.user32.GetMessageW
+ TranslateMessage = ctypes.windll.user32.TranslateMessage
+ DispatchMessage = ctypes.windll.user32.DispatchMessageW
+
+ def pump_background(pipe: queue.Queue):
+ try:
+ jab_wrapper = JavaAccessBridgeWrapper()
+ pipe.put(jab_wrapper)
+ message = byref(wintypes.MSG())
+ while GetMessage(message, 0, 0, 0) > 0:
+ TranslateMessage(message)
+ logging.debug("Dispatching msg={}".format(repr(message)))
+ DispatchMessage(message)
+ except Exception as err:
+ pipe.put(None)
+
+ def main():
+ pipe = queue.Queue()
+ thread = threading.Thread(target=pump_background, daemon=True, args=[pipe])
+ thread.start()
+ jab_wrapper = pipe.get()
+ if not jab_wrapper:
+ raise Exception("Failed to initialize Java Access Bridge Wrapper")
+ time.sleep(0.1) # Wait until the initial messages are parsed, before accessing frames
+
+ if __name__ == "__main__":
+ main()
+
+Once the JABWrapper object is initialized, attach to some frame and optionally create the context tree to get the element tree of the application.
+
+ jab_wrapper.switch_window_by_title("Frame title")
+ context_tree = ContextTree(jab_wrapper)
+
+# Development
+
+## Development prerequisites
+
+* Install poetry: https://python-poetry.org/docs/
+
+## Test
+
+Run test script against simple Swing application
+
+set environment variable
+
+ set RC_JAVA_ACCESS_BRIDGE_DLL="C:\path\to\Java\bin\WindowsAccessBridge-64.dll"
+
+Run test with poetry
+
+ poetry run python tests\test.py
+
+## Packaging
+
+ poetry build
+ poetry publish
+
+## TODO:
+
+* Support for 32-bit Java Access Bridge version
+* Implement rest of the utility functions to the JABWrapper
+
+
+%package help
+Summary: Development documents and examples for java-access-bridge-wrapper
+Provides: python3-java-access-bridge-wrapper-doc
+%description help
+[![Version](https://img.shields.io/pypi/v/java-access-bridge-wrapper.svg?label=version)](https://pypi.org/project/java-access-bridge-wrapper/)
+[![License](https://img.shields.io/pypi/l/java-access-bridge-wrapper.svg)](http://www.apache.org/licenses/LICENSE-2.0.html)
+
+# Introduction
+
+Python wrapper around the Java Access Bridge / Windows Access Bridge.
+
+# Prerequisites
+
+* 64-bit Windows
+* Java >= 8 (https://docs.aws.amazon.com/corretto/latest/corretto-8-ug/downloads-list.html)
+* Python >= 3.7 (https://www.python.org/downloads/release/python-375/)
+
+Enable the Java Access Bridge in windows
+
+ C:\path\to\java\bin\jabswitch -enable
+
+# Install
+
+ pip install java-access-bridge-wrapper
+
+# How to use
+
+Import the Java Access Bridge (JAB) wrapper and optionally the context tree
+
+ from JABWrapper.jab_wrapper import JavaAccessBridgeWrapper
+ from JABWrapper.context_tree import ContextNode, ContextTree, SearchElement
+
+The JAB creates an virtual GUI window when it is opened. For the JAB to operate and receive events from the GUI, the calling code needs to implement the windows
+message pump and call it in a loop. The JABWrapper object needs to be in the same thread.
+
+This can be achieved for example by starting the message pump in a separate thread, where the JAB object is also initialized.
+
+ GetMessage = ctypes.windll.user32.GetMessageW
+ TranslateMessage = ctypes.windll.user32.TranslateMessage
+ DispatchMessage = ctypes.windll.user32.DispatchMessageW
+
+ def pump_background(pipe: queue.Queue):
+ try:
+ jab_wrapper = JavaAccessBridgeWrapper()
+ pipe.put(jab_wrapper)
+ message = byref(wintypes.MSG())
+ while GetMessage(message, 0, 0, 0) > 0:
+ TranslateMessage(message)
+ logging.debug("Dispatching msg={}".format(repr(message)))
+ DispatchMessage(message)
+ except Exception as err:
+ pipe.put(None)
+
+ def main():
+ pipe = queue.Queue()
+ thread = threading.Thread(target=pump_background, daemon=True, args=[pipe])
+ thread.start()
+ jab_wrapper = pipe.get()
+ if not jab_wrapper:
+ raise Exception("Failed to initialize Java Access Bridge Wrapper")
+ time.sleep(0.1) # Wait until the initial messages are parsed, before accessing frames
+
+ if __name__ == "__main__":
+ main()
+
+Once the JABWrapper object is initialized, attach to some frame and optionally create the context tree to get the element tree of the application.
+
+ jab_wrapper.switch_window_by_title("Frame title")
+ context_tree = ContextTree(jab_wrapper)
+
+# Development
+
+## Development prerequisites
+
+* Install poetry: https://python-poetry.org/docs/
+
+## Test
+
+Run test script against simple Swing application
+
+set environment variable
+
+ set RC_JAVA_ACCESS_BRIDGE_DLL="C:\path\to\Java\bin\WindowsAccessBridge-64.dll"
+
+Run test with poetry
+
+ poetry run python tests\test.py
+
+## Packaging
+
+ poetry build
+ poetry publish
+
+## TODO:
+
+* Support for 32-bit Java Access Bridge version
+* Implement rest of the utility functions to the JABWrapper
+
+
+%prep
+%autosetup -n java-access-bridge-wrapper-0.10.0
+
+%build
+%py3_build
+
+%install
+%py3_install
+install -d -m755 %{buildroot}/%{_pkgdocdir}
+if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
+if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
+if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
+if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
+pushd %{buildroot}
+if [ -d usr/lib ]; then
+ find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/lib64 ]; then
+ find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/bin ]; then
+ find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/sbin ]; then
+ find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+touch doclist.lst
+if [ -d usr/share/man ]; then
+ find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
+fi
+popd
+mv %{buildroot}/filelist.lst .
+mv %{buildroot}/doclist.lst .
+
+%files -n python3-java-access-bridge-wrapper -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Tue Apr 11 2023 Python_Bot <Python_Bot@openeuler.org> - 0.10.0-1
+- Package Spec generated