From ad7ec48e702c47d5d9b44e5005f290a32918c9b2 Mon Sep 17 00:00:00 2001 From: Immortalin Date: Wed, 11 Nov 2015 21:28:44 +0800 Subject: [PATCH] Add support for google closure library When the closure library is installed by npm, it is named "google-closure-library", however it is named "closure-library" in build.py. When both blockly and closure are installed by npm, they are in the same folder so theoretically theoretically blockly should be able to build. Formatting and indentation might be a bit off as I edited this using the github editor. This ```python search_paths = calcdeps.ExpandDirectories( ["core", os.path.join(os.path.pardir, "closure-library")]) ``` might need further revision to account for the additional naming. Maybe a try statement? --- build.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/build.py b/build.py index 2d5b50640..f41b41b29 100755 --- a/build.py +++ b/build.py @@ -436,9 +436,20 @@ if __name__ == "__main__": "'closure-library-read-only' to 'closure-library'.\n" "Please rename this directory.") else: - print("""Error: Closure not found. Read this: + try: + calcdeps = import_path(os.path.join( + os.path.pardir, "google-closure-library", "closure", "bin", "calcdeps.py")) + except ImportError: + if os.path.isdir(os.path.join(os.path.pardir, "closure-library-read-only")): + # Dir got renamed when Closure moved from Google Code to GitHub in 2014. + print("Error: Closure directory needs to be renamed from" + "'google-closure-library-read-only' to 'google-closure-library'.\n" + "Please rename this directory.") + else: + print("""Error: Closure not found. Read this: https://developers.google.com/blockly/hacking/closure""") - sys.exit(1) + sys.exit(1) + search_paths = calcdeps.ExpandDirectories( ["core", os.path.join(os.path.pardir, "closure-library")])