diff --git a/Rakefile b/Rakefile index 9a65b08b7d40c..05d88e38292f3 100644 --- a/Rakefile +++ b/Rakefile @@ -385,37 +385,14 @@ 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..a413237e7b85b 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..4c54b2ec972c5 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,43 @@ def handle(fun, dir, args) end 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 \ No newline at end of file