Bug 1712804: Change comm action to be specific to Thunderbird r=rjl,ahal

Avoid the "Error processing command" warning when building virtualenvs
in a Firefox checkout

Differential Revision: https://phabricator.services.mozilla.com/D115922
This commit is contained in:
Mitchell Hentges 2021-05-27 15:18:37 +00:00
parent 9522e92323
commit 0d1d6ed813
2 changed files with 10 additions and 16 deletions

View File

@ -1,4 +1,4 @@
optional:packages.txt:comm/build/virtualenv_packages.txt thunderbird:packages.txt:comm/build/virtualenv_packages.txt
mozilla.pth:build mozilla.pth:build
mozilla.pth:config mozilla.pth:config
mozilla.pth:config/mozunit mozilla.pth:config/mozunit

View File

@ -302,11 +302,10 @@ class VirtualenvManager(VirtualenvHelper):
filename.pth -- Adds the path given as argument to filename.pth under filename.pth -- Adds the path given as argument to filename.pth under
the virtualenv site packages directory. the virtualenv site packages directory.
optional -- This denotes the action as optional. The requested action thunderbird -- This denotes the action as to only occur for Thunderbird
is attempted. If it fails, we issue a warning and go on. The checkouts. The initial "thunderbird" field is stripped, then the
initial "optional" field is stripped then the remaining line is remaining line is processed like normal. e.g.
processed like normal. e.g. "thunderbird:comms.pth:python/foo"
"optional:mozilla.pth:python/foo
packages.txt -- Denotes that the specified path is a child manifest. It packages.txt -- Denotes that the specified path is a child manifest. It
will be read and processed as if its contents were concatenated will be read and processed as if its contents were concatenated
@ -334,6 +333,7 @@ class VirtualenvManager(VirtualenvHelper):
""" """
import distutils.sysconfig import distutils.sysconfig
is_thunderbird = os.path.exists(os.path.join(self.topsrcdir, "comm"))
packages = self.packages() packages = self.packages()
python_lib = distutils.sysconfig.get_python_lib() python_lib = distutils.sysconfig.get_python_lib()
do_close = not bool(sitecustomize) do_close = not bool(sitecustomize)
@ -374,17 +374,11 @@ class VirtualenvManager(VirtualenvHelper):
f.write("%s\n" % os.path.relpath(path, python_lib)) f.write("%s\n" % os.path.relpath(path, python_lib))
return True return True
if package[0] == "optional": if package[0] == "thunderbird":
try: if is_thunderbird:
handle_package(package[1:]) return handle_package(package[1:])
else:
return True return True
except Exception:
print(
"Error processing command. Ignoring",
"because optional. (%s)" % ":".join(package),
file=self.log_handle,
)
return False
if package[0] in ("windows", "!windows"): if package[0] in ("windows", "!windows"):
for_win = not package[0].startswith("!") for_win = not package[0].startswith("!")