Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
build/**
dist/**
src/robotframework_autoitlibrary.egg-info/**
**/__pycache__/**
2 changes: 1 addition & 1 deletion Build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
IF EXIST .\dist rmdir /S /Q .\dist
IF EXIST .\build rmdir /S /Q .\build
call Make.bat
python setup.py sdist --format=zip
python -m build --sdist
pause
::
:: -------------------------------- End of file --------------------------------
8 changes: 1 addition & 7 deletions Make.bat
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,11 @@
::
::-------------------------------------------------------------------------------
::
:: Install the AutoItLibrary on the local PC
::
python setup.py install
::
:: Build the updated documentation before installing again
::
libdoc.py --output doc\AutoItLibrary.html AutoItLibrary
::
:: Now install the AutoItLibrary on the local PC including the updated documentation
libdoc.exe src\AutoItLibrary doc\AutoItLibrary.html
::
python setup.py install
pause
::
:: -------------------------------- End of file --------------------------------
92 changes: 45 additions & 47 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
"""
__author__ = "Martin Taylor <cmtaylor@ti.com>"

from distutils.core import setup
from distutils.sysconfig import get_python_lib
from setuptools import setup
from setuptools.command.install import install
from sysconfig import get_path
import sys
import os
import shutil
Expand All @@ -45,6 +46,46 @@
methods in this class.
"""[1:-1]

class InstallCommand(install):
def initialize_options(self):
install.initialize_options(self)

def finalize_options(self):
install.finalize_options(self)

def run(self):
if os.name != "nt" :
print("AutoItLibrary cannot be installed on non-Windows platforms.")
sys.exit(2)
RegisterAutoIT()
install.run(self)

def RegisterAutoIT():
#
# Install and register AutoItX
#
print("[INF] In RegisterAutoIT with params " + " ".join(str(x) for x in sys.argv))

if os.path.isfile(os.path.join(get_path('platlib'), "AutoItLibrary/lib/AutoItX3.dll")) :
print("[INF] Don't think we need to unregister the old one...")

instDir = os.path.normpath(os.path.join(get_path('platlib'), "AutoItLibrary/lib"))
if not os.path.isdir(instDir) :
os.makedirs(instDir)
instFile = os.path.normpath(os.path.join(instDir, "AutoItX3.dll"))
if "32bit" in platform.architecture()[0] :
print("[INF] Here is from 32bit OS")
shutil.copyfile("3rdPartyTools/AutoIt/AutoItX3.dll", instFile)
else :
shutil.copyfile("3rdPartyTools/AutoIt/lib64/AutoItX3.dll", instFile)
#
# Register the AutoItX COM object
# and make its methods known to Python
#
cmd = r"%SYSTEMROOT%\system32\regsvr32.exe /S " + '\"' + instFile + '\"'
print(cmd)
subprocess.check_call(cmd, shell=True)

def getWin32ComRomingPath():
for dirpath, dirs, files in os.walk(os.getenv('APPDATA')):
for filename in files:
Expand All @@ -56,50 +97,6 @@ def getWin32ComRomingPath():

if __name__ == "__main__":
#
# Install the 3rd party packages
#
if sys.argv[1].lower() == "install" :
if os.name == "nt" :
#
# Install and register AutoItX
#
if os.path.isfile(os.path.join(get_python_lib(), "AutoItLibrary/lib/AutoItX3.dll")) :
print("Don't think we need to unregister the old one...")

instDir = os.path.normpath(os.path.join(get_python_lib(), "AutoItLibrary/lib"))
if not os.path.isdir(instDir) :
os.makedirs(instDir)
instFile = os.path.normpath(os.path.join(instDir, "AutoItX3.dll"))
if "32bit" in platform.architecture()[0] :
print("Here is from 32bit OS")
shutil.copyfile("3rdPartyTools/AutoIt/AutoItX3.dll", instFile)
else :
shutil.copyfile("3rdPartyTools/AutoIt/lib64/AutoItX3.dll", instFile)
#
# Register the AutoItX COM object
# and make its methods known to Python
#
cmd = r"%SYSTEMROOT%\system32\regsvr32.exe /S " + '\"' + instFile + '\"'
print(cmd)
subprocess.check_call(cmd, shell=True)
makepy = os.path.normpath(os.path.join(get_python_lib(), "win32com/client/makepy.py"))
if not os.path.isfile(makepy):
print("[WRN] No win32com in get_python_lib(). Try find in %APPDATA%.")
makepy = getWin32ComRomingPath()
#
# Make sure we have win32com installed
#
if makepy is None:
print("[ERR] AutoItLibrary requires win32com. See http://starship.python.net/crew/mhammond/win32/.")
sys.exit(2)

cmd = "python \"%s\" \"%s\"" % (makepy, instFile)
print(cmd)
subprocess.check_call(cmd)
else :
print("AutoItLibrary cannot be installed on non-Windows platforms.")
sys.exit(2)
#
# Figure out the install path
#
root_path = os.path.join(os.getenv("HOMEDRIVE"))
Expand All @@ -122,7 +119,8 @@ def getWin32ComRomingPath():
long_description = DESCRIPTION,
package_dir = {'' : "src"},
packages = ["AutoItLibrary"],
install_requires = ['pywin32', 'pillow'],
cmdclass = {'install': InstallCommand},
install_requires = ['robotframework', 'pywin32', 'pillow'],
data_files = [(destPath,
["COPYRIGHT.txt",
"LICENSE.txt",
Expand Down
4 changes: 2 additions & 2 deletions src/AutoItLibrary/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ class AutoItLibrary(Logger.Logger, Counter.Counter) :
documentation for these keywords is available in the AutoItX documentation file:
*AutoItX.chm*. This file is installed as part of the installation of *AutoItLibrary* as:

C:\RobotFramework\Extensions\AutoItLibrary\AutoItX.chm
C:\\RobotFramework\\Extensions\\AutoItLibrary\\AutoItX.chm

In order to discover the control identifiers in a given Windows GUI, AutoIt provides a standalone
tool called the AutoIt Window Info Tool which is installed as part of the installation of
*AutoItLibrary* as:

C:\RobotFramework\Extensions\AutoItLibrary\Au3Info.exe
C:\\RobotFramework\\Extensions\\AutoItLibrary\\Au3Info.exe

This tool is documented here: http://www.autoitscript.com/autoit3/docs/intro/au3spy.htm
"""
Expand Down