launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #24626
[Merge] ~cjwatson/launchpad:gi-is-optional into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:gi-is-optional into launchpad:master.
Commit message:
Make the system "gi" package optional
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/382990
The gi (gobject-introspection) package is only used in the test suite, and isn't installed by launchpad-dependencies. Make it optional.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:gi-is-optional into launchpad:master.
diff --git a/system-packages.txt b/system-packages.txt
index 1737888..5fe7918 100644
--- a/system-packages.txt
+++ b/system-packages.txt
@@ -3,6 +3,10 @@
# Python dependency is impossible or unreliable (perhaps due to frequent ABI
# changes in system libraries they depend on, or frequent security updates
# managed by the distribution's security team).
+#
+# Package names that end with "?" are optional, in that link-system-packages
+# will not fail if they are missing; this should be reserved for packages
+# only used by the test suite.
# Used by launchpad-buildd.
apt
@@ -19,7 +23,7 @@ convoy
GeoIP
# lp.testing.html5browser
-gi
+gi?
# lp.services.fields, lp.services.spriteutils
PIL
@@ -28,5 +32,5 @@ PIL
sqlite
_sqlite
-# Optional dependency of bzr-git and bzr-svn.
+# Used by bzr-git and bzr-svn.
tdb
diff --git a/utilities/link-system-packages.py b/utilities/link-system-packages.py
index 07d0f9b..18b863b 100755
--- a/utilities/link-system-packages.py
+++ b/utilities/link-system-packages.py
@@ -14,8 +14,15 @@ import os.path
import re
-def link_module(name, virtualenv_libdir):
- module = importlib.import_module(name)
+def link_module(name, virtualenv_libdir, optional=False):
+ try:
+ module = importlib.import_module(name)
+ except ImportError:
+ if optional:
+ print("Skipping missing optional module %s." % name)
+ return
+ else:
+ raise
path = module.__file__
if os.path.basename(path).startswith("__init__."):
path = os.path.dirname(path)
@@ -40,7 +47,12 @@ def main():
line = re.sub(r"#.*", "", line).strip()
if not line:
continue
- link_module(line, args.virtualenv_libdir)
+ if line.endswith("?"):
+ line = line[:-1]
+ optional = True
+ else:
+ optional = False
+ link_module(line, args.virtualenv_libdir, optional=optional)
if __name__ == "__main__":