Skip to content

build.run: remove deprecated execute_local(run_script=) argument #1505

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 5, 2024
Merged
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
28 changes: 10 additions & 18 deletions amaranth/build/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def extract(self, root="build"):
finally:
os.chdir(cwd)

def execute_local(self, root="build", *, run_script=None, env=None):
def execute_local(self, root="build", *, env=None):
"""
Execute build plan using the local strategy. Files from the build plan are placed in
the build root directory ``root``, and, if ``run_script`` is ``True``, the script
Expand All @@ -107,25 +107,17 @@ def execute_local(self, root="build", *, run_script=None, env=None):
Returns :class:`LocalBuildProducts`.
"""
build_dir = self.extract(root)
if run_script is None or run_script:
if sys.platform.startswith("win32"):
# Without "call", "cmd /c {}.bat" will return 0.
# See https://stackoverflow.com/a/30736987 for a detailed explanation of why.
# Running the script manually from a command prompt is unaffected.
subprocess.check_call(["cmd", "/c", f"call {self.script}.bat"],
cwd=build_dir, env=os.environ if env is None else env)
else:
subprocess.check_call(["sh", f"{self.script}.sh"],
cwd=build_dir, env=os.environ if env is None else env)
# TODO(amaranth-0.6): remove
if run_script is not None:
warnings.warn("The `run_script` argument is deprecated. If you only want to "
"extract the files from the BuildPlan, use the .extract() method",
DeprecationWarning, stacklevel=2)

if sys.platform.startswith("win32"):
# Without "call", "cmd /c {}.bat" will return 0.
# See https://stackoverflow.com/a/30736987 for a detailed explanation of why.
# Running the script manually from a command prompt is unaffected.
subprocess.check_call(["cmd", "/c", f"call {self.script}.bat"],
cwd=build_dir, env=os.environ if env is None else env)
else:
subprocess.check_call(["sh", f"{self.script}.sh"],
cwd=build_dir, env=os.environ if env is None else env)
return LocalBuildProducts(build_dir)


def execute_local_docker(self, image, *, root="build", docker_args=[]):
"""
Execute build plan inside a Docker container. Files from the build plan are placed in the
Expand Down