From 32859d22ffcf1a6a2a338aa1b65ac7b7dc4825bd Mon Sep 17 00:00:00 2001 From: josh Date: Tue, 28 Apr 2015 08:13:19 -0400 Subject: [PATCH 1/3] refactored some python targets in Rakefile for use with crazyfun --- Rakefile | 30 ++--------------- py/build.desc | 8 +++++ rake-tasks/crazy_fun/mappings/python.rb | 44 +++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 28 deletions(-) diff --git a/Rakefile b/Rakefile index 9a65b08b7d40c..69967e02c7c35 100644 --- a/Rakefile +++ b/Rakefile @@ -385,37 +385,11 @@ task :javadocs => [:common, :firefox, :htmlunit, :ie, :remote, :support, :chrome sh cmd end -task :py_prep_for_install_release => ["//javascript/firefox-driver:webdriver", :chrome, "//javascript/firefox-driver:webdriver_prefs"] do - if python? then - - firefox_py_home = "py/selenium/webdriver/firefox/" - firefox_build_dir = 'build/javascript/firefox-driver/' - x86 = firefox_py_home + "x86/" - amd64 = firefox_py_home + "amd64/" - - if (windows?) then - firefox_build_dir = firefox_build_dir.gsub(/\//, "\\") - firefox_py_home = firefox_py_home .gsub(/\//, "\\") - x86 = x86.gsub(/\//,"\\") - amd64 = amd64.gsub(/\//,"\\") - end - - mkdir_p x86 unless File.exists?(x86) - mkdir_p amd64 unless File.exists?(amd64) - - cp "cpp/prebuilt/i386/libnoblur.so", x86+"x_ignore_nofocus.so", :verbose => true - cp "cpp/prebuilt/amd64/libnoblur64.so", amd64+"x_ignore_nofocus.so", :verbose => true - - cp firefox_build_dir + "webdriver.xpi" , firefox_py_home, :verbose => true - cp firefox_build_dir + "webdriver_prefs.json" , firefox_py_home, :verbose => true - end -end +task :py_prep_for_install_release => ["//javascript/firefox-driver:webdriver", :chrome, "//javascript/firefox-driver:webdriver_prefs", "//py:prep"] task :py_docs => "//py:docs" -task :py_install => :py_prep_for_install_release do - sh "python setup.py install" -end +task :py_install => "//py:install" task :py_release => :py_prep_for_install_release do sh "grep -v test setup.py > setup_release.py; mv setup_release.py setup.py" diff --git a/py/build.desc b/py/build.desc index 64fe26ab7b298..0eb6e89f1001a 100644 --- a/py/build.desc +++ b/py/build.desc @@ -89,3 +89,11 @@ py_env( ], dest = "build/python" ) + +py_install( + name = "install" +) + +py_prep( + name = "prep" +) diff --git a/rake-tasks/crazy_fun/mappings/python.rb b/rake-tasks/crazy_fun/mappings/python.rb index 6b3a43d4db4b7..a234dd05c56e3 100644 --- a/rake-tasks/crazy_fun/mappings/python.rb +++ b/rake-tasks/crazy_fun/mappings/python.rb @@ -12,6 +12,10 @@ def add_all(fun) fun.add_mapping("py_env", Python::VirtualEnv.new) fun.add_mapping("py_docs", Python::GenerateDocs.new) + + fun.add_mapping("py_install", Python::Install.new) + + fun.add_mapping("py_prep", Python::Prep.new) end end @@ -213,5 +217,45 @@ def handle(fun, dir, args) end end + class Install < Tasks + def py_exe + windows? ? "C:\\Python27\\python.exe" : "/usr/bin/python" + end + + def handle(fun, dir, args) + task Tasks.new.task_name(dir, args[:name]) do + sh py_exe + " setup.py install", :verbose => true + end + end + end + + class Prep < Tasks + def handle(fun, dir, args) + task Tasks.new.task_name(dir, args[:name]) do + firefox_py_home = "py/selenium/webdriver/firefox/" + firefox_build_dir = 'build/javascript/firefox-driver/' + x86 = firefox_py_home + "x86/" + amd64 = firefox_py_home + "amd64/" + + if (windows?) then + firefox_build_dir = firefox_build_dir.gsub(/\//, "\\") + firefox_py_home = firefox_py_home .gsub(/\//, "\\") + x86 = x86.gsub(/\//,"\\") + amd64 = amd64.gsub(/\//,"\\") + end + + mkdir_p x86 unless File.exists?(x86) + mkdir_p amd64 unless File.exists?(amd64) + + cp "cpp/prebuilt/i386/libnoblur.so", x86+"x_ignore_nofocus.so", :verbose => true + cp "cpp/prebuilt/amd64/libnoblur64.so", amd64+"x_ignore_nofocus.so", :verbose => true + + cp firefox_build_dir + "webdriver.xpi" , firefox_py_home, :verbose => true + cp firefox_build_dir + "webdriver_prefs.json" , firefox_py_home, :verbose => true + end + end + end + + end From fba7b8d1fb969871604425d2be1b5aa630aa7413 Mon Sep 17 00:00:00 2001 From: Josh Grant Date: Tue, 28 Apr 2015 09:24:10 -0400 Subject: [PATCH 2/3] fixes for Ruby style, replacing tabs with 2 spaces where needed --- py/build.desc | 4 +- rake-tasks/crazy_fun/mappings/python.rb | 76 ++++++++++++------------- 2 files changed, 39 insertions(+), 41 deletions(-) diff --git a/py/build.desc b/py/build.desc index 0eb6e89f1001a..a413237e7b85b 100644 --- a/py/build.desc +++ b/py/build.desc @@ -91,9 +91,9 @@ py_env( ) py_install( - name = "install" + name = "install" ) py_prep( - name = "prep" + name = "prep" ) diff --git a/rake-tasks/crazy_fun/mappings/python.rb b/rake-tasks/crazy_fun/mappings/python.rb index a234dd05c56e3..4a8b5c833b5bd 100644 --- a/rake-tasks/crazy_fun/mappings/python.rb +++ b/rake-tasks/crazy_fun/mappings/python.rb @@ -217,45 +217,43 @@ def handle(fun, dir, args) end end - class Install < Tasks - def py_exe - windows? ? "C:\\Python27\\python.exe" : "/usr/bin/python" - end - - def handle(fun, dir, args) - task Tasks.new.task_name(dir, args[:name]) do - sh py_exe + " setup.py install", :verbose => true - end - end - end + class Install < Tasks + def py_exe + windows? ? "C:\\Python27\\python.exe" : "/usr/bin/python" + end - class Prep < Tasks - def handle(fun, dir, args) - task Tasks.new.task_name(dir, args[:name]) do - firefox_py_home = "py/selenium/webdriver/firefox/" - firefox_build_dir = 'build/javascript/firefox-driver/' - x86 = firefox_py_home + "x86/" - amd64 = firefox_py_home + "amd64/" - - if (windows?) then - firefox_build_dir = firefox_build_dir.gsub(/\//, "\\") - firefox_py_home = firefox_py_home .gsub(/\//, "\\") - x86 = x86.gsub(/\//,"\\") - amd64 = amd64.gsub(/\//,"\\") - end - - mkdir_p x86 unless File.exists?(x86) - mkdir_p amd64 unless File.exists?(amd64) - - cp "cpp/prebuilt/i386/libnoblur.so", x86+"x_ignore_nofocus.so", :verbose => true - cp "cpp/prebuilt/amd64/libnoblur64.so", amd64+"x_ignore_nofocus.so", :verbose => true - - cp firefox_build_dir + "webdriver.xpi" , firefox_py_home, :verbose => true - cp firefox_build_dir + "webdriver_prefs.json" , firefox_py_home, :verbose => true - end - end - end + def handle(fun, dir, args) + task Tasks.new.task_name(dir, args[:name]) do + sh py_exe + " setup.py install", :verbose => true + end + end + end + class Prep < Tasks + def handle(fun, dir, args) + task Tasks.new.task_name(dir, args[:name]) do + firefox_py_home = "py/selenium/webdriver/firefox/" + firefox_build_dir = 'build/javascript/firefox-driver/' + x86 = firefox_py_home + "x86/" + amd64 = firefox_py_home + "amd64/" + + if (windows?) then + firefox_build_dir = firefox_build_dir.gsub(/\//, "\\") + firefox_py_home = firefox_py_home .gsub(/\//, "\\") + x86 = x86.gsub(/\//,"\\") + amd64 = amd64.gsub(/\//,"\\") + end + + mkdir_p x86 unless File.exists?(x86) + mkdir_p amd64 unless File.exists?(amd64) + + cp "cpp/prebuilt/i386/libnoblur.so", x86+"x_ignore_nofocus.so", :verbose => true + cp "cpp/prebuilt/amd64/libnoblur64.so", amd64+"x_ignore_nofocus.so", :verbose => true + + cp firefox_build_dir + "webdriver.xpi" , firefox_py_home, :verbose => true + cp firefox_build_dir + "webdriver_prefs.json" , firefox_py_home, :verbose => true + end + end + end -end - +end \ No newline at end of file From a7f12a10eff9fa72fb9484985450cc9f1caf8056 Mon Sep 17 00:00:00 2001 From: Josh Grant Date: Tue, 28 Apr 2015 14:51:49 -0400 Subject: [PATCH 3/3] another set of formatting changes --- Rakefile | 5 ++- rake-tasks/crazy_fun/mappings/python.rb | 48 ++++++++++++------------- 2 files changed, 28 insertions(+), 25 deletions(-) diff --git a/Rakefile b/Rakefile index 69967e02c7c35..05d88e38292f3 100644 --- a/Rakefile +++ b/Rakefile @@ -385,7 +385,10 @@ task :javadocs => [:common, :firefox, :htmlunit, :ie, :remote, :support, :chrome sh cmd end -task :py_prep_for_install_release => ["//javascript/firefox-driver:webdriver", :chrome, "//javascript/firefox-driver:webdriver_prefs", "//py:prep"] +task :py_prep_for_install_release => ["//javascript/firefox-driver:webdriver", + :chrome, + "//javascript/firefox-driver:webdriver_prefs", + "//py:prep"] task :py_docs => "//py:docs" diff --git a/rake-tasks/crazy_fun/mappings/python.rb b/rake-tasks/crazy_fun/mappings/python.rb index 4a8b5c833b5bd..4c54b2ec972c5 100644 --- a/rake-tasks/crazy_fun/mappings/python.rb +++ b/rake-tasks/crazy_fun/mappings/python.rb @@ -12,10 +12,10 @@ def add_all(fun) fun.add_mapping("py_env", Python::VirtualEnv.new) fun.add_mapping("py_docs", Python::GenerateDocs.new) - - fun.add_mapping("py_install", Python::Install.new) - - fun.add_mapping("py_prep", Python::Prep.new) + + fun.add_mapping("py_install", Python::Install.new) + + fun.add_mapping("py_prep", Python::Prep.new) end end @@ -231,26 +231,26 @@ def handle(fun, dir, args) class Prep < Tasks def handle(fun, dir, args) - task Tasks.new.task_name(dir, args[:name]) do - firefox_py_home = "py/selenium/webdriver/firefox/" - firefox_build_dir = 'build/javascript/firefox-driver/' - x86 = firefox_py_home + "x86/" - amd64 = firefox_py_home + "amd64/" - - if (windows?) then - firefox_build_dir = firefox_build_dir.gsub(/\//, "\\") - firefox_py_home = firefox_py_home .gsub(/\//, "\\") - x86 = x86.gsub(/\//,"\\") - amd64 = amd64.gsub(/\//,"\\") - end - - mkdir_p x86 unless File.exists?(x86) - mkdir_p amd64 unless File.exists?(amd64) - - cp "cpp/prebuilt/i386/libnoblur.so", x86+"x_ignore_nofocus.so", :verbose => true - cp "cpp/prebuilt/amd64/libnoblur64.so", amd64+"x_ignore_nofocus.so", :verbose => true - - cp firefox_build_dir + "webdriver.xpi" , firefox_py_home, :verbose => true + task Tasks.new.task_name(dir, args[:name]) do + firefox_py_home = "py/selenium/webdriver/firefox/" + firefox_build_dir = 'build/javascript/firefox-driver/' + x86 = firefox_py_home + "x86/" + amd64 = firefox_py_home + "amd64/" + + if (windows?) then + firefox_build_dir = firefox_build_dir.gsub(/\//, "\\") + firefox_py_home = firefox_py_home .gsub(/\//, "\\") + x86 = x86.gsub(/\//,"\\") + amd64 = amd64.gsub(/\//,"\\") + end + + mkdir_p x86 unless File.exists?(x86) + mkdir_p amd64 unless File.exists?(amd64) + + cp "cpp/prebuilt/i386/libnoblur.so", x86+"x_ignore_nofocus.so", :verbose => true + cp "cpp/prebuilt/amd64/libnoblur64.so", amd64+"x_ignore_nofocus.so", :verbose => true + + cp firefox_build_dir + "webdriver.xpi" , firefox_py_home, :verbose => true cp firefox_build_dir + "webdriver_prefs.json" , firefox_py_home, :verbose => true end end