build.run: deprecate run_script argument in BuildPlan.execute_local()
This commit is contained in:
parent
b823a8ee9d
commit
c00e770f01
|
@ -5,6 +5,7 @@ import os
|
||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
import tempfile
|
import tempfile
|
||||||
|
import warnings
|
||||||
import zipfile
|
import zipfile
|
||||||
import hashlib
|
import hashlib
|
||||||
import pathlib
|
import pathlib
|
||||||
|
@ -91,7 +92,7 @@ class BuildPlan:
|
||||||
finally:
|
finally:
|
||||||
os.chdir(cwd)
|
os.chdir(cwd)
|
||||||
|
|
||||||
def execute_local(self, root="build", *, run_script=True, env=None):
|
def execute_local(self, root="build", *, run_script=None, env=None):
|
||||||
"""
|
"""
|
||||||
Execute build plan using the local strategy. Files from the build plan are placed in
|
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
|
the build root directory ``root``, and, if ``run_script`` is ``True``, the script
|
||||||
|
@ -99,10 +100,13 @@ class BuildPlan:
|
||||||
is executed in the build root. If ``env`` is not ``None``, the environment is replaced
|
is executed in the build root. If ``env`` is not ``None``, the environment is replaced
|
||||||
with ``env``.
|
with ``env``.
|
||||||
|
|
||||||
|
The ``run_script`` argument is deprecated. If you only want to extract the files
|
||||||
|
into a local folder, use the ``extract`` method.
|
||||||
|
|
||||||
Returns :class:`LocalBuildProducts`.
|
Returns :class:`LocalBuildProducts`.
|
||||||
"""
|
"""
|
||||||
build_dir = self.extract(root)
|
build_dir = self.extract(root)
|
||||||
if run_script:
|
if run_script is None or run_script:
|
||||||
if sys.platform.startswith("win32"):
|
if sys.platform.startswith("win32"):
|
||||||
# Without "call", "cmd /c {}.bat" will return 0.
|
# Without "call", "cmd /c {}.bat" will return 0.
|
||||||
# See https://stackoverflow.com/a/30736987 for a detailed explanation of why.
|
# See https://stackoverflow.com/a/30736987 for a detailed explanation of why.
|
||||||
|
@ -112,6 +116,13 @@ class BuildPlan:
|
||||||
else:
|
else:
|
||||||
subprocess.check_call(["sh", f"{self.script}.sh"],
|
subprocess.check_call(["sh", f"{self.script}.sh"],
|
||||||
env=os.environ if env is None else env)
|
env=os.environ if env is None else env)
|
||||||
|
# TODO(amaranth-0.5): 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)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return LocalBuildProducts(build_dir)
|
return LocalBuildProducts(build_dir)
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ Language changes
|
||||||
|
|
||||||
.. currentmodule:: amaranth.hdl
|
.. currentmodule:: amaranth.hdl
|
||||||
|
|
||||||
|
* Deprecated: argument `run_script=` in :meth:`BuildPlan.execute_local`
|
||||||
* Added: `class:ast.Slice` objects have been made const-castable.
|
* Added: `class:ast.Slice` objects have been made const-castable.
|
||||||
* Removed: (deprecated in 0.4) :meth:`Const.normalize`. (`RFC 5`_)
|
* Removed: (deprecated in 0.4) :meth:`Const.normalize`. (`RFC 5`_)
|
||||||
* Removed: (deprecated in 0.4) :class:`ast.Sample`, :class:`ast.Past`, :class:`ast.Stable`, :class:`ast.Rose`, :class:`ast.Fell`.
|
* Removed: (deprecated in 0.4) :class:`ast.Sample`, :class:`ast.Past`, :class:`ast.Stable`, :class:`ast.Rose`, :class:`ast.Fell`.
|
||||||
|
|
Loading…
Reference in a new issue