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
Родитель 9522e92323
Коммит 0d1d6ed813
2 изменённых файлов: 10 добавлений и 16 удалений

Просмотреть файл

@ -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:config
mozilla.pth:config/mozunit

Просмотреть файл

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