← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~codersquid/python-oops-datedir-repo/optional-prune-dependencies into lp:python-oops-datedir-repo

 

Sheila Miguez has proposed merging lp:~codersquid/python-oops-datedir-repo/optional-prune-dependencies into lp:python-oops-datedir-repo.

Commit message:
makes launchpadlib an optional dependency for prune

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #948857 in Python OOPS Date-dir repository: "Depends on launchpadlib for oops-pruning support"
  https://bugs.launchpad.net/python-oops-datedir-repo/+bug/948857

For more details, see:
https://code.launchpad.net/~codersquid/python-oops-datedir-repo/optional-prune-dependencies/+merge/327978

This change makes launchpadlib an optional dependency.

from a command line prompt, one can type

    pip install -e .\[prune\]

To install this with all of the dependencies required by prune, or

    pip install -e .

To go without.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~codersquid/python-oops-datedir-repo/optional-prune-dependencies into lp:python-oops-datedir-repo.
=== modified file 'buildout.cfg'
--- buildout.cfg	2011-11-11 04:21:05 +0000
+++ buildout.cfg	2017-07-24 16:38:12 +0000
@@ -31,7 +31,7 @@
 
 [scripts]
 recipe = z3c.recipe.scripts
-eggs = oops_datedir_repo [test]
+eggs = oops_datedir_repo [test][prune]
 include-site-packages = true
 allowed-eggs-from-site-packages = 
     subunit

=== modified file 'oops_datedir_repo/prune.py'
--- oops_datedir_repo/prune.py	2012-09-26 06:57:23 +0000
+++ oops_datedir_repo/prune.py	2017-07-24 16:38:12 +0000
@@ -27,8 +27,14 @@
 from textwrap import dedent
 import sys
 
-from launchpadlib.launchpad import Launchpad
-from launchpadlib.uris import lookup_service_root
+try:
+    from launchpadlib.launchpad import Launchpad
+    from launchpadlib.uris import lookup_service_root
+except ImportError:
+    print("Missing launchpadlib dependency. Did you install "
+          "oops_datedir_repo without 'prune'?")
+    pass
+
 from pytz import utc
 
 import oops_datedir_repo

=== modified file 'setup.py'
--- setup.py	2015-12-01 15:20:19 +0000
+++ setup.py	2017-07-24 16:38:12 +0000
@@ -40,7 +40,6 @@
       install_requires = [
           'bson',
           'iso8601',
-          'launchpadlib', # Needed for pruning - perhaps should be optional.
           'oops>=0.0.11',
           'pytz',
           ],
@@ -48,11 +47,14 @@
           test=[
               'fixtures',
               'testtools',
-              ]
+              ],
+          prune=[
+              'launchpadlib',
+              ],
           ),
         entry_points=dict(
             console_scripts=[ # `console_scripts` is a magic name to setuptools
                 'bsondump = oops_datedir_repo.bsondump:main',
-                'prune = oops_datedir_repo.prune:main',
+                'prune = oops_datedir_repo.prune:main [prune]',
                 ]),
       )


Follow ups