From 1af0e0a762b33f8804744be8be02484edd223b5b Mon Sep 17 00:00:00 2001 From: IgorKlopov Date: Tue, 25 Nov 2014 10:27:31 -0800 Subject: [PATCH 1/7] Verbose required paths I installed to `c:\nodejs` to avoid spaces in path (old habits die hard). So i had an obstacle you see. --- script/compile-coffee.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/script/compile-coffee.py b/script/compile-coffee.py index 179931a5db0a..aba5665cf0ae 100755 --- a/script/compile-coffee.py +++ b/script/compile-coffee.py @@ -9,6 +9,7 @@ SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__)) WINDOWS_NODE_PATHs = [ 'C:/Program Files/nodejs/node.exe', 'C:/Program Files (x86)/nodejs/node.exe', + 'C:/nodejs/node.exe', ] @@ -21,7 +22,7 @@ def main(): if sys.platform in ['win32', 'cygwin']: node = find_node() if not node: - print 'Node.js is required for building atom-shell' + print 'Node.js is required for building atom-shell at paths:\n' + '\n'.join(WINDOWS_NODE_PATHs) return 1 subprocess.check_call(['node', coffee, '-c', '-o', output_dir, input_file], executable=node) From 6aa6bdebe6ec33b259d689c600df8209bf165f62 Mon Sep 17 00:00:00 2001 From: IgorKlopov Date: Tue, 25 Nov 2014 10:58:13 -0800 Subject: [PATCH 2/7] Travis says `line too long` 80 chars limit hit --- script/compile-coffee.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/script/compile-coffee.py b/script/compile-coffee.py index aba5665cf0ae..319b4b051171 100755 --- a/script/compile-coffee.py +++ b/script/compile-coffee.py @@ -22,7 +22,8 @@ def main(): if sys.platform in ['win32', 'cygwin']: node = find_node() if not node: - print 'Node.js is required for building atom-shell at paths:\n' + '\n'.join(WINDOWS_NODE_PATHs) + print 'Node.js is required for building atom-shell at paths:\n' + \ + '\n'.join(WINDOWS_NODE_PATHs) return 1 subprocess.check_call(['node', coffee, '-c', '-o', output_dir, input_file], executable=node) From 91a3e12ab0a47ed951f2a75beba78ecf6ff907ff Mon Sep 17 00:00:00 2001 From: IgorKlopov Date: Tue, 25 Nov 2014 11:41:11 -0800 Subject: [PATCH 3/7] Paul says `lookup PATH` Works both with trailing slash `c:\nodejs\` and without it `c:\nodejs` --- script/compile-coffee.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/script/compile-coffee.py b/script/compile-coffee.py index 319b4b051171..ed0156fa6cce 100755 --- a/script/compile-coffee.py +++ b/script/compile-coffee.py @@ -6,11 +6,6 @@ import sys SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__)) -WINDOWS_NODE_PATHs = [ - 'C:/Program Files/nodejs/node.exe', - 'C:/Program Files (x86)/nodejs/node.exe', - 'C:/nodejs/node.exe', -] def main(): @@ -22,8 +17,7 @@ def main(): if sys.platform in ['win32', 'cygwin']: node = find_node() if not node: - print 'Node.js is required for building atom-shell at paths:\n' + \ - '\n'.join(WINDOWS_NODE_PATHs) + print 'Node.js not found in PATH for building atom-shell' return 1 subprocess.check_call(['node', coffee, '-c', '-o', output_dir, input_file], executable=node) @@ -32,9 +26,11 @@ def main(): def find_node(): - for path in WINDOWS_NODE_PATHs: - if os.path.exists(path): - return path + PATHs = os.environ['PATH'].split(os.pathsep) + for path in PATHs: + full_path = os.path.join(path, 'node.exe') + if os.path.exists(full_path): + return full_path return None From 5137e16485b32645c35932fb14d46458da155a84 Mon Sep 17 00:00:00 2001 From: IgorKlopov Date: Tue, 25 Nov 2014 13:46:09 -0800 Subject: [PATCH 4/7] WINDOWS_NODE_PATHs are to stay WINDOWS_NODE_PATHs are checked first, and then os.environ['PATH'] --- script/compile-coffee.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/script/compile-coffee.py b/script/compile-coffee.py index ed0156fa6cce..8d02bf9693c2 100755 --- a/script/compile-coffee.py +++ b/script/compile-coffee.py @@ -6,7 +6,10 @@ import sys SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__)) - +WINDOWS_NODE_PATHs = [ + 'C:/Program Files/nodejs', + 'C:/Program Files (x86)/nodejs', +] def main(): input_file = sys.argv[1] @@ -26,7 +29,7 @@ def main(): def find_node(): - PATHs = os.environ['PATH'].split(os.pathsep) + PATHs = WINDOWS_NODE_PATHs + os.environ['PATH'].split(os.pathsep) for path in PATHs: full_path = os.path.join(path, 'node.exe') if os.path.exists(full_path): From 0ab4475f249ff888fe788ae1d6dc09159fc43b85 Mon Sep 17 00:00:00 2001 From: IgorKlopov Date: Tue, 25 Nov 2014 13:53:08 -0800 Subject: [PATCH 5/7] Compose full list in one place --- script/compile-coffee.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/script/compile-coffee.py b/script/compile-coffee.py index 8d02bf9693c2..48c25258a0fb 100755 --- a/script/compile-coffee.py +++ b/script/compile-coffee.py @@ -9,7 +9,7 @@ SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__)) WINDOWS_NODE_PATHs = [ 'C:/Program Files/nodejs', 'C:/Program Files (x86)/nodejs', -] +] + os.environ['PATH'].split(os.pathsep) def main(): input_file = sys.argv[1] @@ -29,8 +29,7 @@ def main(): def find_node(): - PATHs = WINDOWS_NODE_PATHs + os.environ['PATH'].split(os.pathsep) - for path in PATHs: + for path in WINDOWS_NODE_PATHs: full_path = os.path.join(path, 'node.exe') if os.path.exists(full_path): return full_path From b00bbdeb814113052c28b3a2be84c95f3544cf9c Mon Sep 17 00:00:00 2001 From: IgorKlopov Date: Tue, 25 Nov 2014 13:54:02 -0800 Subject: [PATCH 6/7] Preserve that empty line --- script/compile-coffee.py | 1 + 1 file changed, 1 insertion(+) diff --git a/script/compile-coffee.py b/script/compile-coffee.py index 48c25258a0fb..772c7aae11aa 100755 --- a/script/compile-coffee.py +++ b/script/compile-coffee.py @@ -11,6 +11,7 @@ WINDOWS_NODE_PATHs = [ 'C:/Program Files (x86)/nodejs', ] + os.environ['PATH'].split(os.pathsep) + def main(): input_file = sys.argv[1] output_dir = os.path.dirname(sys.argv[2]) From 0fd1f61a242896c4ea9ba65d9fe25ff2a1c76f4d Mon Sep 17 00:00:00 2001 From: IgorKlopov Date: Wed, 26 Nov 2014 01:43:30 +0300 Subject: [PATCH 7/7] Paul suggests paths to be reversed --- script/compile-coffee.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/compile-coffee.py b/script/compile-coffee.py index 772c7aae11aa..c7eb3fccba66 100755 --- a/script/compile-coffee.py +++ b/script/compile-coffee.py @@ -7,8 +7,8 @@ import sys SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__)) WINDOWS_NODE_PATHs = [ - 'C:/Program Files/nodejs', 'C:/Program Files (x86)/nodejs', + 'C:/Program Files/nodejs', ] + os.environ['PATH'].split(os.pathsep)