From 1196bdfe86d5985a07116cc75ef3cf017a3b7061 Mon Sep 17 00:00:00 2001 From: Karthikeya Garimella Date: Thu, 5 Feb 2015 11:05:13 -0500 Subject: [PATCH 1/5] Update build_component.py Added proper error message with link to build instructions. --- build_component.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/build_component.py b/build_component.py index 66c9905..ef6d7f8 100644 --- a/build_component.py +++ b/build_component.py @@ -295,8 +295,14 @@ def main(): os.chdir(os.path.join(repos_root_dir, "..")) # Copy the necessary files to the respective target folders, # following the instructions in scripts/config_build.txt. - config_file = open("scripts/config_build.txt") - + try: + config_file = open("scripts/config_build.txt") + except IOError: + print "unable to open file scripts/config_build.txt ! This \ + script is not meant to be called individually, but through \ + a wrapper script, build.py. See the Seattle build instructions \ + wiki for details: https://seattle.poly.edu/wiki/BuildInstructions" + return 0 for line in config_file.readlines(): # Ignore comments and blank lines if line.startswith("#") or line.strip() == '': From 9786b1463b892ea38dfb0ea7dad3665f0f4bf708 Mon Sep 17 00:00:00 2001 From: Karthikeya Garimella Date: Thu, 5 Feb 2015 12:34:34 -0500 Subject: [PATCH 2/5] Update build_component.py --- build_component.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/build_component.py b/build_component.py index ef6d7f8..da633f9 100644 --- a/build_component.py +++ b/build_component.py @@ -298,11 +298,7 @@ def main(): try: config_file = open("scripts/config_build.txt") except IOError: - print "unable to open file scripts/config_build.txt ! This \ - script is not meant to be called individually, but through \ - a wrapper script, build.py. See the Seattle build instructions \ - wiki for details: https://seattle.poly.edu/wiki/BuildInstructions" - return 0 + help_exit("unable to open file scripts/config_build.txt !",parser) for line in config_file.readlines(): # Ignore comments and blank lines if line.startswith("#") or line.strip() == '': From 05c40f35465357295d0024d88c6ac66ec7c5fd7b Mon Sep 17 00:00:00 2001 From: Karthikeya Garimella Date: Tue, 10 Feb 2015 08:51:00 -0500 Subject: [PATCH 3/5] Update build_component.py --- build_component.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build_component.py b/build_component.py index da633f9..a74cd66 100644 --- a/build_component.py +++ b/build_component.py @@ -298,7 +298,11 @@ def main(): try: config_file = open("scripts/config_build.txt") except IOError: - help_exit("unable to open file scripts/config_build.txt !",parser) + print "unable to open file scripts/config_build.txt ! This \ + script is not meant to be called individually, but through \ + a wrapper script, build.py. See the Seattle build instructions \ + wiki for details: https://seattle.poly.edu/wiki/BuildInstructions" + raise for line in config_file.readlines(): # Ignore comments and blank lines if line.startswith("#") or line.strip() == '': From a1163498fd72517e2d7c9e7ec13bde2f1518f889 Mon Sep 17 00:00:00 2001 From: Karthikeya Garimella Date: Tue, 10 Feb 2015 09:47:12 -0500 Subject: [PATCH 4/5] Update build_component.py --- build_component.py | 46 ++++++++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/build_component.py b/build_component.py index a74cd66..f12aca9 100644 --- a/build_component.py +++ b/build_component.py @@ -223,7 +223,6 @@ def help_exit(errMsg, parser): sys.exit(1) - def main(): helpstring = """This script is not meant to be run individually. See https://seattle.poly.edu/wiki/BuildInstructions for details.""" @@ -242,7 +241,29 @@ def main(): help="Replace the default ports with random ports between 52000 and 53000. ") (options, args) = parser.parse_args() + + # This script's parent directory is the root dir of all dependent + # repositories, path/to/component/DEPENDENCIES/ + repos_root_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + # Return to the grand-parent directory of the dependent repositories, + # i.e. "/path/to/component/DEPENDENCIES/.." + # We now have + # "." with the sources of the component we want to build, + # "scripts/" with the build config file, and + # "DEPENDENCIES/" with all the dependent repos. + os.chdir(os.path.join(repos_root_dir, "..")) + # Copy the necessary files to the respective target folders, + # following the instructions in scripts/config_build.txt. + try: + config_file = open("scripts/config_build.txt") + except IOError: + print "unable to open file scripts/config_build.txt ! This \ + script is not meant to be called individually, but through \ + a wrapper script, build.py. See the Seattle build instructions \ + wiki for details: https://seattle.poly.edu/wiki/BuildInstructions" + raise + # Determine the target directory. # Use path/to/component/DEPENDENCIES/common/../../RUNNABLE # unless overridden by the user. @@ -269,11 +290,6 @@ def main(): RANDOMPORTS = options.randomports verbose = options.verbose - - # This script's parent directory is the root dir of all dependent - # repositories, path/to/component/DEPENDENCIES/ - repos_root_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) - # Set working directory to the target os.chdir(target_dir) files_to_remove = glob.glob("*") @@ -285,24 +301,6 @@ def main(): else: os.remove(entry) - - # Return to the grand-parent directory of the dependent repositories, - # i.e. "/path/to/component/DEPENDENCIES/.." - # We now have - # "." with the sources of the component we want to build, - # "scripts/" with the build config file, and - # "DEPENDENCIES/" with all the dependent repos. - os.chdir(os.path.join(repos_root_dir, "..")) - # Copy the necessary files to the respective target folders, - # following the instructions in scripts/config_build.txt. - try: - config_file = open("scripts/config_build.txt") - except IOError: - print "unable to open file scripts/config_build.txt ! This \ - script is not meant to be called individually, but through \ - a wrapper script, build.py. See the Seattle build instructions \ - wiki for details: https://seattle.poly.edu/wiki/BuildInstructions" - raise for line in config_file.readlines(): # Ignore comments and blank lines if line.startswith("#") or line.strip() == '': From 094b395d8c5aae7f45561db2f115c56a2660391d Mon Sep 17 00:00:00 2001 From: Karthikeya Garimella Date: Tue, 10 Feb 2015 12:47:27 -0500 Subject: [PATCH 5/5] Update build_component.py --- build_component.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/build_component.py b/build_component.py index f12aca9..f7c6f87 100644 --- a/build_component.py +++ b/build_component.py @@ -258,10 +258,7 @@ def main(): try: config_file = open("scripts/config_build.txt") except IOError: - print "unable to open file scripts/config_build.txt ! This \ - script is not meant to be called individually, but through \ - a wrapper script, build.py. See the Seattle build instructions \ - wiki for details: https://seattle.poly.edu/wiki/BuildInstructions" + print "Unable to open file scripts/config_build.txt!" raise # Determine the target directory.