Skip to content

Commit 1eaa4d9

Browse files
joshmgrantandreastt
authored andcommitted
build: refactor py tragets
Signed-off-by: Andreas Tolfsen <[email protected]>
1 parent 763bbcb commit 1eaa4d9

File tree

3 files changed

+59
-30
lines changed

3 files changed

+59
-30
lines changed

Rakefile

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -385,37 +385,16 @@ task :javadocs => [:common, :firefox, :htmlunit, :ie, :remote, :support, :chrome
385385
sh cmd
386386
end
387387

388-
task :py_prep_for_install_release => ["//javascript/firefox-driver:webdriver", :chrome, "//javascript/firefox-driver:webdriver_prefs"] do
389-
if python? then
390-
391-
firefox_py_home = "py/selenium/webdriver/firefox/"
392-
firefox_build_dir = 'build/javascript/firefox-driver/'
393-
x86 = firefox_py_home + "x86/"
394-
amd64 = firefox_py_home + "amd64/"
395-
396-
if (windows?) then
397-
firefox_build_dir = firefox_build_dir.gsub(/\//, "\\")
398-
firefox_py_home = firefox_py_home .gsub(/\//, "\\")
399-
x86 = x86.gsub(/\//,"\\")
400-
amd64 = amd64.gsub(/\//,"\\")
401-
end
402-
403-
mkdir_p x86 unless File.exists?(x86)
404-
mkdir_p amd64 unless File.exists?(amd64)
405-
406-
cp "cpp/prebuilt/i386/libnoblur.so", x86+"x_ignore_nofocus.so", :verbose => true
407-
cp "cpp/prebuilt/amd64/libnoblur64.so", amd64+"x_ignore_nofocus.so", :verbose => true
408-
409-
cp firefox_build_dir + "webdriver.xpi" , firefox_py_home, :verbose => true
410-
cp firefox_build_dir + "webdriver_prefs.json" , firefox_py_home, :verbose => true
411-
end
412-
end
388+
task :py_prep_for_install_release => [
389+
"//javascript/firefox-driver:webdriver",
390+
:chrome,
391+
"//javascript/firefox-driver:webdriver_prefs",
392+
"//py:prep"
393+
]
413394

414395
task :py_docs => "//py:docs"
415396

416-
task :py_install => :py_prep_for_install_release do
417-
sh "python setup.py install"
418-
end
397+
task :py_install => "//py:install"
419398

420399
task :py_release => :py_prep_for_install_release do
421400
sh "grep -v test setup.py > setup_release.py; mv setup_release.py setup.py"

py/build.desc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,11 @@ py_env(
8989
],
9090
dest = "build/python"
9191
)
92+
93+
py_install(
94+
name = "install"
95+
)
96+
97+
py_prep(
98+
name = "prep"
99+
)

rake-tasks/crazy_fun/mappings/python.rb

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ def add_all(fun)
1212
fun.add_mapping("py_env", Python::VirtualEnv.new)
1313

1414
fun.add_mapping("py_docs", Python::GenerateDocs.new)
15+
16+
fun.add_mapping("py_install", Python::Install.new)
17+
18+
fun.add_mapping("py_prep", Python::Prep.new)
1519
end
1620
end
1721

@@ -213,5 +217,43 @@ def handle(fun, dir, args)
213217
end
214218
end
215219

216-
end
217-
220+
class Install < Tasks
221+
def py_exe
222+
windows? ? "C:\\Python27\\python.exe" : "/usr/bin/python"
223+
end
224+
225+
def handle(fun, dir, args)
226+
task Tasks.new.task_name(dir, args[:name]) do
227+
sh py_exe + " setup.py install", :verbose => true
228+
end
229+
end
230+
end
231+
232+
class Prep < Tasks
233+
def handle(fun, dir, args)
234+
task Tasks.new.task_name(dir, args[:name]) do
235+
firefox_py_home = "py/selenium/webdriver/firefox/"
236+
firefox_build_dir = 'build/javascript/firefox-driver/'
237+
x86 = firefox_py_home + "x86/"
238+
amd64 = firefox_py_home + "amd64/"
239+
240+
if (windows?) then
241+
firefox_build_dir = firefox_build_dir.gsub(/\//, "\\")
242+
firefox_py_home = firefox_py_home .gsub(/\//, "\\")
243+
x86 = x86.gsub(/\//,"\\")
244+
amd64 = amd64.gsub(/\//,"\\")
245+
end
246+
247+
mkdir_p x86 unless File.exists?(x86)
248+
mkdir_p amd64 unless File.exists?(amd64)
249+
250+
cp "cpp/prebuilt/i386/libnoblur.so", x86+"x_ignore_nofocus.so", :verbose => true
251+
cp "cpp/prebuilt/amd64/libnoblur64.so", amd64+"x_ignore_nofocus.so", :verbose => true
252+
253+
cp firefox_build_dir + "webdriver.xpi" , firefox_py_home, :verbose => true
254+
cp firefox_build_dir + "webdriver_prefs.json" , firefox_py_home, :verbose => true
255+
end
256+
end
257+
end
258+
259+
end

0 commit comments

Comments
 (0)