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

Proposed by Sheila Miguez
Status: Needs review
Proposed branch: lp:~codersquid/python-oops-datedir-repo/optional-prune-dependencies
Merge into: lp:python-oops-datedir-repo
Diff against target: 62 lines (+14/-6)
3 files modified
buildout.cfg (+1/-1)
oops_datedir_repo/prune.py (+8/-2)
setup.py (+5/-3)
To merge this branch: bzr merge lp:~codersquid/python-oops-datedir-repo/optional-prune-dependencies
Reviewer Review Type Date Requested Status
Colin Watson Needs Fixing
Review via email: mp+327978@code.launchpad.net

Commit message

makes launchpadlib an optional dependency for prune

Description of the change

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.

To post a comment you must log in.
Revision history for this message
Sheila Miguez (codersquid) wrote :

I was unable to run the unit tests and need help.

I created and activated a virtualenv, ran boostrap.py, and installed testrepository.

`testr run` suggested `testr init`. After doing the init step, `testr run` still failed due to bin/py not existing. I've missed a step somewhere.

Revision history for this message
Sheila Miguez (codersquid) wrote :

Using run-of-the-mill unittest, trunk has a failure, if I have time I'll take a look at it to get things clean before proceeding with work on this branch.

virtualenv venv
. venv/bin/activate
pip install -e .\[test\]
venv/bin/python -m unittest discover -v

======================================================================
ERROR: test_read_detect_rfc822 (oops_datedir_repo.tests.test_serializer.TestParsing)
oops_datedir_repo.tests.test_serializer.TestParsing.test_read_detect_rfc822
----------------------------------------------------------------------
_StringException: Traceback (most recent call last):
  File "oops_datedir_repo/tests/test_serializer.py", line 63, in test_read_detect_rfc822
    self.assertEqual(self.expected_dict, read(source_file))
  File "oops_datedir_repo/serializer.py", line 61, in read
    return serializer_bson.read(StringIO(content))
  File "oops_datedir_repo/serializer_bson.py", line 57, in read
    report = bson.loads(fp.read())
  File "/home/codersquid/work/hexr/python-oops-datedir-repo/venv/local/lib/python2.7/site-packages/bson/__init__.py", line 47, in loads
    return decode_document(data, 0)[1]
  File "/home/codersquid/work/hexr/python-oops-datedir-repo/venv/local/lib/python2.7/site-packages/bson/codec.py", line 269, in decode_document
    if data[end_point - 1] not in ('\0', 0):
IndexError: string index out of range

Revision history for this message
Colin Watson (cjwatson) wrote :
review: Needs Fixing
57. By Sheila Miguez on 2019-07-09

merge forward from trunk r57

Revision history for this message
Sheila Miguez (codersquid) wrote :

I've updated my branch from trunk. The tests work now!

Unmerged revisions

57. By Sheila Miguez on 2019-07-09

merge forward from trunk r57

56. By Sheila Miguez on 2017-07-24

make prune dependencies optional

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'buildout.cfg'
2--- buildout.cfg 2011-11-11 04:21:05 +0000
3+++ buildout.cfg 2019-07-09 13:42:14 +0000
4@@ -31,7 +31,7 @@
5
6 [scripts]
7 recipe = z3c.recipe.scripts
8-eggs = oops_datedir_repo [test]
9+eggs = oops_datedir_repo [test][prune]
10 include-site-packages = true
11 allowed-eggs-from-site-packages =
12 subunit
13
14=== modified file 'oops_datedir_repo/prune.py'
15--- oops_datedir_repo/prune.py 2018-03-12 12:06:11 +0000
16+++ oops_datedir_repo/prune.py 2019-07-09 13:42:14 +0000
17@@ -29,8 +29,14 @@
18 from textwrap import dedent
19 import sys
20
21-from launchpadlib.launchpad import Launchpad
22-from launchpadlib.uris import lookup_service_root
23+try:
24+ from launchpadlib.launchpad import Launchpad
25+ from launchpadlib.uris import lookup_service_root
26+except ImportError:
27+ print("Missing launchpadlib dependency. Did you install "
28+ "oops_datedir_repo without 'prune'?")
29+ pass
30+
31 from pytz import utc
32
33 import oops_datedir_repo
34
35=== modified file 'setup.py'
36--- setup.py 2018-03-12 12:06:11 +0000
37+++ setup.py 2019-07-09 13:42:14 +0000
38@@ -43,7 +43,6 @@
39 install_requires = [
40 'bson',
41 'iso8601',
42- 'launchpadlib', # Needed for pruning - perhaps should be optional.
43 'oops>=0.0.11',
44 'pytz',
45 'six',
46@@ -52,11 +51,14 @@
47 test=[
48 'fixtures',
49 'testtools',
50- ]
51+ ],
52+ prune=[
53+ 'launchpadlib',
54+ ],
55 ),
56 entry_points=dict(
57 console_scripts=[ # `console_scripts` is a magic name to setuptools
58 'bsondump = oops_datedir_repo.bsondump:main',
59- 'prune = oops_datedir_repo.prune:main',
60+ 'prune = oops_datedir_repo.prune:main [prune]',
61 ]),
62 )

Subscribers

People subscribed via source and target branches

to all changes: