Skip to content
This repository was archived by the owner on Oct 1, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 19 additions & 18 deletions build_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand All @@ -242,7 +241,26 @@ 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!"
raise

# Determine the target directory.
# Use path/to/component/DEPENDENCIES/common/../../RUNNABLE
# unless overridden by the user.
Expand All @@ -269,11 +287,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("*")
Expand All @@ -285,18 +298,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.
config_file = open("scripts/config_build.txt")

for line in config_file.readlines():
# Ignore comments and blank lines
if line.startswith("#") or line.strip() == '':
Expand Down