[python-windmill] Initial commit

Karel Klíč kklic at fedoraproject.org
Wed Mar 14 17:44:16 UTC 2012


commit 80118f1fb827e43efb25c00463639e4702d64efd
Author: Karel Klic <kklic at redhat.com>
Date:   Wed Mar 14 18:44:47 2012 +0100

    Initial commit

 .gitignore                   |    1 +
 python-windmill-nodeps.patch |  245 ++++++++++++++++++++++++++++++++++++++++++
 python-windmill.spec         |   75 +++++++++++++
 sources                      |    1 +
 4 files changed, 322 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..2d2e0cc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/windmill-windmill-v1.5.0-beta-9-g4304ee7.tar.gz
diff --git a/python-windmill-nodeps.patch b/python-windmill-nodeps.patch
new file mode 100644
index 0000000..2df0f92
--- /dev/null
+++ b/python-windmill-nodeps.patch
@@ -0,0 +1,245 @@
+diff -up windmill-windmill-4304ee7/windmill/browser/__init__.py.nodeps windmill-windmill-4304ee7/windmill/browser/__init__.py
+--- windmill-windmill-4304ee7/windmill/browser/__init__.py.nodeps	2011-04-09 08:38:31.000000000 +0200
++++ windmill-windmill-4304ee7/windmill/browser/__init__.py	2012-01-31 13:29:40.769533657 +0100
+@@ -32,20 +32,20 @@ windmill.browser_registry = {}
+ def get_firefox_controller():
+     """Get the firefox browser object"""
+     from windmill.dep import mozrunner
+-    global_settings = mozrunner.global_settings
++    from windmill.browser import mozilla_global_settings
+     from windmill.dep import simplesettings
+-    
+-    mozrunner_settings = simplesettings.initialize_settings(global_settings, mozrunner,     
+-                                                  local_env_variable=mozrunner.settings_env)
+-    
++
++    mozrunner_settings = simplesettings.initialize_settings(mozilla_global_settings, mozrunner,
++                                                  local_env_variable="WINDMILL_MOZILLA_SETTINGS")
++
+     for key, value in mozrunner.settings.items():
+         if not windmill.settings.has_key(key):
+             windmill.settings[key] = value
+     
+     test_url = windmill.get_test_url(windmill.settings['TEST_URL'])  
+     
+-    if windmill.settings['INSTALL_FIREBUG']:
+-        windmill.settings['MOZILLA_PLUGINS'] = [os.path.join(os.path.dirname(__file__), os.path.pardir, 'xpi', 'firebug-1.5.0.xpi')]
++    #if windmill.settings['INSTALL_FIREBUG']:
++    #    windmill.settings['MOZILLA_PLUGINS'] = [os.path.join(os.path.dirname(__file__), os.path.pardir, 'xpi', 'firebug-1.5.0.xpi')]
+     
+     prop_hash = {
+                 'extensions.chromebug.openalways' : True,
+@@ -113,19 +113,21 @@ def get_firefox_controller():
+         
+     windmill.settings['MOZILLA_CMD_ARGS'] = [test_url]
+     
+-    controller = mozrunner.get_moz_from_settings(copy.copy(windmill.settings))
++    from mozprofile import FirefoxProfile
++    profile = FirefoxProfile(preferences=windmill.settings['MOZILLA_PREFERENCES'])
++    controller = mozrunner.FirefoxRunner(profile, windmill.settings['MOZILLA_BINARY'])
+ 
+     # Override cert8.db with one from windmill which has windmill certificate
+     # in it, that way self-signed certificate warning is suppressed.
+     cert8 = resource_string(__name__, 'cert8.db')
+     if sys.platform not in ('win32', 'cygwin',):
+-        f = open(os.path.join(controller.profile, 'cert8.db'), 'w')        
++        f = open(os.path.join(controller.profile.profile, 'cert8.db'), 'w')        
+     else:
+-        f = open(os.path.join(controller.profile, 'cert8.db'), 'wb')
++        f = open(os.path.join(controller.profile.profile, 'cert8.db'), 'wb')
+         
+     f.write(cert8)
+     f.close()    
+-    windmill.settings['MOZILLA_PROFILE'] = mozrunner.settings['MOZILLA_PROFILE']
++    windmill.settings['MOZILLA_PROFILE'] = controller.profile.profile
+     return controller
+     
+ def get_ie_controller():
+diff -up windmill-windmill-4304ee7/windmill/browser/mozilla_global_settings.py.nodeps windmill-windmill-4304ee7/windmill/browser/mozilla_global_settings.py
+--- windmill-windmill-4304ee7/windmill/browser/mozilla_global_settings.py.nodeps	2012-01-31 13:28:16.434587992 +0100
++++ windmill-windmill-4304ee7/windmill/browser/mozilla_global_settings.py	2012-01-31 13:28:16.434587992 +0100
+@@ -0,0 +1,141 @@
++# ***** BEGIN LICENSE BLOCK *****
++# Version: MPL 1.1/GPL 2.0/LGPL 2.1
++#
++# The contents of this file are subject to the Mozilla Public License Version
++# 1.1 (the "License"); you may not use this file except in compliance with
++# the License. You may obtain a copy of the License at
++# http://www.mozilla.org/MPL/
++#
++# Software distributed under the License is distributed on an "AS IS" basis,
++# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
++# for the specific language governing rights and limitations under the
++# License.
++#
++# The Original Code is Mozilla Corporation Code.
++#
++# The Initial Developer of the Original Code is
++# Mikeal Rogers.
++# Portions created by the Initial Developer are Copyright (C) 2008
++# the Initial Developer. All Rights Reserved.
++#
++# Contributor(s):
++#  Mikeal Rogers <mikeal.rogers at gmail.com>
++#
++# Alternatively, the contents of this file may be used under the terms of
++# either the GNU General Public License Version 2 or later (the "GPL"), or
++# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
++# in which case the provisions of the GPL or the LGPL are applicable instead
++# of those above. If you wish to allow use of your version of this file only
++# under the terms of either the GPL or the LGPL, and not to allow others to
++# use your version of this file under the terms of the MPL, indicate your
++# decision by deleting the provisions above and replace them with the notice
++# and other provisions required by the GPL or the LGPL. If you do not delete
++# the provisions above, a recipient may use your version of this file under
++# the terms of any one of the MPL, the GPL or the LGPL.
++#
++# ***** END LICENSE BLOCK *****
++
++# This global settings files is for use with the simplesettings library
++
++import os, sys, copy
++
++def findInPath(fileName, path=None):
++    if path is None:
++        path = os.environ.get('PATH', '')
++
++    dirs = path.split(os.pathsep)
++    for dir in dirs:
++        if os.path.isfile(os.path.join(dir, fileName)):
++            return os.path.join(dir, fileName)
++        if os.name == 'nt' or sys.platform == 'cygwin':
++            if os.path.isfile(os.path.join(dir, fileName + ".exe")):
++                return os.path.join(dir, fileName + ".exe")
++    return None
++
++# Mozilla prefs
++
++MOZILLA_DEFAULT_PREFS = {'extensions.update.enabled'    : False,
++                         'extensions.update.notifyUser' : False,
++                         'browser.shell.checkDefaultBrowser' : False,
++                         'browser.tabs.warnOnClose' : False,
++                         'browser.warnOnQuit': False,
++                         'browser.sessionstore.resume_from_crash': False,
++                        } 
++                        
++MOZILLA_PREFERENCES = {} # For user config file to set additional prefs
++MOZILLA_CMD_ARGS = []
++MOZILLA_ENV = copy.copy(os.environ) 
++MOZILLA_ENV.update({'MOZ_NO_REMOTE':"1",})
++
++MOZILLA_CREATE_NEW_PROFILE = True
++
++if sys.platform == 'darwin':
++    NETWORK_INTERFACE_NAME = None
++    firefoxApp = os.path.join('Applications', 'Firefox.app')
++    firefoxDir = os.path.join(os.path.expanduser('~/'), firefoxApp)
++
++    if not os.path.isdir(firefoxDir):
++        firefoxDir = os.path.join('/', firefoxApp)
++
++    MOZILLA_DEFAULT_PROFILE = os.path.join(firefoxDir, 'Contents', 'MacOS', 'defaults', 'profile')
++    MOZILLA_BINARY          = os.path.join(firefoxDir, 'Contents', 'MacOS', 'firefox-bin')
++
++
++elif sys.platform == 'linux2':
++    firefoxBin = findInPath('firefox')
++    
++    if firefoxBin is not None and os.path.isfile(firefoxBin):
++        MOZILLA_BINARY = firefoxBin
++    
++    MOZILLA_DEFAULT_PROFILE = None
++    
++    def NaN(str):
++        try: int(str); return False;
++        except: return True 
++
++    for path, name in (('/opt', 'firefox',),
++                       ('/usr/lib', 'iceweasel',),
++                       ('/usr/share', 'firefox',),
++                       ('/usr/lib', 'mozilla-firefox',),
++                       ('/usr/lib', 'firefox',),
++                       ('/usr/lib64', 'iceweasel',),
++                       ('/usr/lib64', 'mozilla-firefox',),
++                       ('/usr/lib64', 'firefox',),
++                       ):
++        if os.path.isdir(path):
++            profiles = sorted([d for d in os.listdir(os.path.join(path)) if (
++                               d.startswith(name) ) and 
++                               ( os.path.isdir(os.path.join(path, d, 'defaults', 'profile')) ) and
++                               ( ('-' not in d) or ( len(name+'-') <= len(d) and not NaN(d[len(name+'-')]) or
++                               (d == 'mozilla-firefox')) )
++                               ])
++            if len(profiles) > 0:
++                MOZILLA_DEFAULT_PROFILE = os.path.join(path, profiles[-1], 'defaults', 'profile') 
++
++
++elif os.name == 'nt' or sys.platform == 'cygwin':
++    firefoxBin = findInPath('firefox')
++    
++    if sys.platform == 'cygwin':
++        program_files = os.environ['PROGRAMFILES'].replace("\\", os.path.sep).replace(':', '')
++        program_files = program_files[0].lower() + program_files[1:]
++        program_files = '/cygdrive/'+program_files.replace("\\", os.path.sep)
++    else:
++        program_files = os.environ['ProgramFiles']
++    
++    bin_locations = [os.path.join(program_files, 'Mozilla Firefox', 'firefox.exe'),
++                     os.path.join(program_files, 'Mozilla Firefox3', 'firefox.exe'),
++                    ]
++    
++    if firefoxBin is None:
++        for loc in bin_locations:
++            if os.path.isfile(loc):
++                firefoxBin = loc
++
++    if firefoxBin is not None and os.path.isfile(firefoxBin):
++        firefoxDir = os.path.dirname(firefoxBin)
++
++        MOZILLA_BINARY          = firefoxBin
++        MOZILLA_DEFAULT_PROFILE = os.path.join(firefoxDir, 'defaults', 'profile')
++        
++        
+diff -up windmill-windmill-4304ee7/windmill/dep/__init__.py.nodeps windmill-windmill-4304ee7/windmill/dep/__init__.py
+--- windmill-windmill-4304ee7/windmill/dep/__init__.py.nodeps	2011-04-09 08:38:31.000000000 +0200
++++ windmill-windmill-4304ee7/windmill/dep/__init__.py	2012-01-31 13:28:16.436587968 +0100
+@@ -1,30 +1,12 @@
+-try:
+-    import json
+-except:
+-    try:
+-        import simplejson as json
+-    except:
+-        import _simplejson as json
+-
+-try:
+-    import uuid
+-except:
+-    import _uuid as uuid
+-
+-# Prefer native version if available
+-try:
+-    # To check that it's a mozrunner 1.x based version, 2.x doesn't have global_settings anymore
+-    import mozrunner.global_settings
+-    import mozrunner
+-except:
+-    import _mozrunner as mozrunner
+-
++import json
++import uuid
++import mozrunner
++import functest
++import wsgi_jsonrpc
++import _wsgi_xmlrpc as wsgi_xmlrpc
++import _wsgi_fileserver as wsgi_fileserver
+ 
+ import _simplesettings as simplesettings
+-import _wsgi_fileserver as wsgi_fileserver
+-import _wsgi_jsonrpc as wsgi_jsonrpc
+-import _wsgi_xmlrpc as wsgi_xmlrpc
+-import _functest as functest
+ 
+ import sys
+-sys.modules['functest'] = functest # Support global access on functest
+\ No newline at end of file
++sys.modules['functest'] = functest # Support global access on functest
diff --git a/python-windmill.spec b/python-windmill.spec
new file mode 100644
index 0000000..492cc26
--- /dev/null
+++ b/python-windmill.spec
@@ -0,0 +1,75 @@
+Name: python-windmill
+Version: 1.7
+Release: 0.2.git4304ee7%{?dist}
+Summary: A web application testing framework
+License: ASL 2.0
+URL: http://getwindmill.com
+# https://nodeload.github.com/windmill/windmill/tarball/master
+Source0: windmill-windmill-v1.5.0-beta-9-g4304ee7.tar.gz
+Patch0: python-windmill-nodeps.patch
+BuildRequires: python-devel python-setuptools trac
+BuildArch: noarch
+Requires: python-mozrunner
+Requires: python-wsgi-jsonrpc
+Requires: python-functest
+
+%description
+Windmill is an open source AJAX Web UI Testing framework. It
+implements cross browser testing, in-browser recording and playback,
+and functionality for fast accurate debugging and test environment
+integration.
+
+%prep
+%setup -q -n windmill-windmill-4304ee7
+%patch0 -p1 -b .nodeps
+
+# Remove embedded dependencies
+#
+# We keep embedded simplesettings dependency, because it's so simple
+# that it doesn't deserve a separate package (see
+# https://bugzilla.redhat.com/show_bug.cgi?id=513779).
+#
+# We keep embedded wsgi_fileserver and wsgi_xmlrpc, because both
+# "projects" come from the same author and they are too simple (a few
+# lines of code in single source file).
+# URL: http://code.google.com/p/wsgi-fileserver/
+# URL: http://code.google.com/p/wsgi-xmlrpc/
+rm -r windmill/dep/_{simplejson,functest,mozrunner,wsgi_jsonrpc}
+rm windmill/dep/_uuid.py
+
+rm windmill/xpi/*.xpi
+
+
+# Set proper file mode
+chmod -x windmill/html/css/jquery.css
+chmod -x windmill/html/js/lib/jquery/jquery-1.4.4.min.js
+chmod -x windmill/html/css/smoothness/jquery-ui-1.7.custom.css
+chmod -x windmill/html/js/lib/jquery/jquery-ui-1.8.6.custom.min.js
+chmod -x windmill/html/js/lib/browserdetect.js
+chmod -x windmill/html/css/dark-hive/jquery-ui-1.8.6.custom.css
+
+%build
+%{__python} setup.py build
+
+%check
+cp -r %{python_sitelib}/trac .
+%{__python} setup.py test
+
+%install
+%{__python} setup.py install -O1 --root %{buildroot}
+
+chmod +x %{buildroot}%{python_sitelib}/windmill/bin/windmill_bin.py
+chmod +x %{buildroot}%{python_sitelib}/windmill/bin/shell_objects.py
+chmod +x %{buildroot}%{python_sitelib}/windmill/server/jsmin.py
+
+%files
+%doc README.txt LICENSE.txt
+%{python_sitelib}/*
+%{_bindir}/windmill
+
+%changelog
+* Thu Mar  8 2012 Karel Klíč <kklic at redhat.com> - 1.7-0.2.git4304ee7
+- Added trac to build dependencies (%%check works now)
+
+* Mon Jan  2 2012 Karel Klíč <kklic at redhat.com> - 1.7-0.1.git4304ee7
+- Initial packaging
diff --git a/sources b/sources
index e69de29..621d479 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+e9919e6d7c0a70856a8c9a67a259dca7  windmill-windmill-v1.5.0-beta-9-g4304ee7.tar.gz


More information about the scm-commits mailing list