From 4481bb011f536fa7eb106123e3c553765cfa67cb Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Tue, 12 Feb 2013 15:30:08 +0100 Subject: [PATCH 1/7] Update to latest version of pake --- pake.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pake.py b/pake.py index dec8b71a7a..27b3648580 100644 --- a/pake.py +++ b/pake.py @@ -288,7 +288,10 @@ def ifind(*paths): for path in paths: for dirpath, dirnames, names in os.walk(path): for name in names: - yield os.path.join(dirpath, name) + if sys.platform == 'win32': + yield '/'.join(dirpath.split('\\') + [name]) + else: + yield os.path.join(dirpath, name) def main(argv=sys.argv): From a3e7528841186841110777ed6c716a3c5ff40a8a Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Tue, 12 Feb 2013 15:30:36 +0100 Subject: [PATCH 2/7] Guess paths to Windows binaries using environment variables --- build.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/build.py b/build.py index 8a9795ee90..2cf4a2ee5d 100755 --- a/build.py +++ b/build.py @@ -13,12 +13,14 @@ from pake import Target, ifind, main, output, rule, target, variables, virtual if sys.platform == 'win32': - variables.GIT = 'C:/Program Files/Git/bin/git.exe' + ProgramFiles = os.environ.get('ProgramFiles', 'C:\\Program Files') + ProgramFiles_X86 = os.environ.get('ProgramFiles(X86)', 'C:\\Program Files') + variables.GIT = os.path.join(ProgramFiles_X86, 'Git', 'bin', 'git.exe') variables.GJSLINT = 'gjslint' # FIXME - variables.JAVA = 'C:/Program Files/Java/jre7/bin/java.exe' + variables.JAVA = os.path.join(ProgramFiles, 'Java', 'jre7', 'bin', 'java.exe') variables.JSDOC = 'jsdoc' # FIXME variables.PHANTOMJS = 'phantomjs' # FIXME - variables.PYTHON = 'C:/Python27/python.exe' + variables.PYTHON = os.path.join(os.environ['SystemDrive'] + '\\', 'Python27', 'python.exe') else: variables.GIT = 'git' variables.GJSLINT = 'gjslint' From 169555f2be20edf392e873e60b80caae5fc38115 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Tue, 12 Feb 2013 15:31:30 +0100 Subject: [PATCH 3/7] Use ifind rather than glob to work around Windows path separator nonsense --- build.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/build.py b/build.py index 2cf4a2ee5d..a416c6c117 100755 --- a/build.py +++ b/build.py @@ -1,10 +1,10 @@ #!/usr/bin/env python from cStringIO import StringIO -import glob import gzip import json import os +import os.path import re import shutil import sys @@ -42,9 +42,14 @@ EXTERNAL_SRC = [ 'build/src/external/src/types.js'] EXAMPLES = [path - for path in glob.glob('examples/*.html') + for path in ifind('examples') + if not path.startswith('examples/standalone/') + if path.endswith('.html') if path != 'examples/example-list.html'] +EXAMPLES_JSON = [example.replace('.html', '.json') + for example in EXAMPLES] + EXAMPLES_SRC = [path for path in ifind('examples') if path.endswith('.js') @@ -195,7 +200,7 @@ def examples_star_combined_js(name, match): @target('serve', PLOVR_JAR, INTERNAL_SRC, 'test/requireall.js', 'examples') def serve(t): - t.run('%(JAVA)s', '-jar', PLOVR_JAR, 'serve', glob.glob('build/*.json'), glob.glob('examples/*.json'), glob.glob('test/*.json')) + t.run('%(JAVA)s', '-jar', PLOVR_JAR, 'serve', 'build/ol.json', 'build/ol-all.json', EXAMPLES_JSON, 'test/test.json') @target('serve-precommit', PLOVR_JAR, INTERNAL_SRC) From d828fee582cc5c58fd13e894eb7191eb39611fc8 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Tue, 12 Feb 2013 15:47:24 +0100 Subject: [PATCH 4/7] Set path to gjslint on Windows --- build.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/build.py b/build.py index a416c6c117..660e8b599e 100755 --- a/build.py +++ b/build.py @@ -15,12 +15,13 @@ from pake import Target, ifind, main, output, rule, target, variables, virtual if sys.platform == 'win32': ProgramFiles = os.environ.get('ProgramFiles', 'C:\\Program Files') ProgramFiles_X86 = os.environ.get('ProgramFiles(X86)', 'C:\\Program Files') + Python27 = os.environ.get('SystemDrive', 'C:') + '\\Python27' variables.GIT = os.path.join(ProgramFiles_X86, 'Git', 'bin', 'git.exe') - variables.GJSLINT = 'gjslint' # FIXME + variables.GJSLINT = os.path.join(Python27, 'Scripts', 'gjslint.exe') variables.JAVA = os.path.join(ProgramFiles, 'Java', 'jre7', 'bin', 'java.exe') variables.JSDOC = 'jsdoc' # FIXME variables.PHANTOMJS = 'phantomjs' # FIXME - variables.PYTHON = os.path.join(os.environ['SystemDrive'] + '\\', 'Python27', 'python.exe') + variables.PYTHON = os.path.join(Python27, 'python.exe') else: variables.GIT = 'git' variables.GJSLINT = 'gjslint' From 3d3436007059c5af68b98597d7941cdfbff9c3ad Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Tue, 12 Feb 2013 15:31:56 +0100 Subject: [PATCH 5/7] Add build.cmd for Windows developers --- build.cmd | 2 ++ 1 file changed, 2 insertions(+) create mode 100755 build.cmd diff --git a/build.cmd b/build.cmd new file mode 100755 index 0000000000..75c1454306 --- /dev/null +++ b/build.cmd @@ -0,0 +1,2 @@ +@echo off +%SystemDrive%\Python27\python.exe build.py %* From 357ca379db14e7ee9d592db9ae1339d2d12a2817 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Tue, 12 Feb 2013 15:47:08 +0100 Subject: [PATCH 6/7] Update build instructions for Windows --- readme.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/readme.md b/readme.md index 62b9f9ed5e..723a41881d 100644 --- a/readme.md +++ b/readme.md @@ -13,12 +13,16 @@ Run build.py: $ ./build.py +Windows users should run `build` instead. + ## Run examples locally Run the [Plovr](http://plovr.com/) web server with: $ ./build.py serve +Windows users should run `build serve` instead. + Then, either open one of the example html files from the `examples` directory directly in your browser, or start a simple webserver, for example: $ python -mSimpleHTTPServer From 9a3e090c2b5db68827cb2bdb299409645bcca1b4 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Tue, 12 Feb 2013 16:07:34 +0100 Subject: [PATCH 7/7] Run tests on Windows --- .gitignore | 2 ++ build.py | 23 +++++++++++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index a691d821e3..24c0e4318d 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,8 @@ /build/ol.js /build/ol-all.js /build/src +/build/phantomjs-*-windows +/build/phantomjs-*-windows.zip /examples/*.json /examples/*.combined.js /examples/example-list.js diff --git a/build.py b/build.py index 660e8b599e..f8ffbb7eb5 100755 --- a/build.py +++ b/build.py @@ -20,15 +20,16 @@ if sys.platform == 'win32': variables.GJSLINT = os.path.join(Python27, 'Scripts', 'gjslint.exe') variables.JAVA = os.path.join(ProgramFiles, 'Java', 'jre7', 'bin', 'java.exe') variables.JSDOC = 'jsdoc' # FIXME - variables.PHANTOMJS = 'phantomjs' # FIXME variables.PYTHON = os.path.join(Python27, 'python.exe') + PHANTOMJS_WINDOWS_ZIP = 'build/phantomjs-1.8.1-windows.zip' + PHANTOMJS = 'build/phantomjs-1.8.1-windows/phantomjs.exe' else: variables.GIT = 'git' variables.GJSLINT = 'gjslint' variables.JAVA = 'java' variables.JSDOC = 'jsdoc' - variables.PHANTOMJS = 'phantomjs' variables.PYTHON = 'python' + PHANTOMJS = 'phantomjs' variables.BRANCH = output('%(GIT)s', 'rev-parse', '--abbrev-ref', 'HEAD').strip() @@ -334,9 +335,23 @@ def hostexamples(t): t.cp('examples/example-list.js', 'examples/example-list.xml', 'examples/Jugl.js', 'build/gh-pages/%(BRANCH)s/examples/') -@target('test', INTERNAL_SRC, 'test/requireall.js', phony=True) +@target('test', PHANTOMJS, INTERNAL_SRC, 'test/requireall.js', phony=True) def test(t): - t.run('%(PHANTOMJS)s', 'test/phantom-jasmine/run_jasmine_test.coffee', 'test/ol.html') + t.run(PHANTOMJS, 'test/phantom-jasmine/run_jasmine_test.coffee', 'test/ol.html') + + +if sys.platform == 'win32': + @target(PHANTOMJS, PHANTOMJS_WINDOWS_ZIP, clean=False) + def phantom_js(t): + from zipfile import ZipFile + ZipFile(PHANTOMJS_WINDOWS_ZIP).extractall('build') + + @target(PHANTOMJS_WINDOWS_ZIP, clean=False) + def phantomjs_windows_zip(t): + t.download('http://phantomjs.googlecode.com/files/' + os.path.basename(t.name)) + +else: + virtual(PHANTOMJS) @target('fixme', phony=True)