Merge lp:~camptocamp/anybox.recipe.openerp/fix-addons-path-1189402 into lp:anybox.recipe.openerp

Proposed by Guewen Baconnier @ Camptocamp
Status: Merged
Merged at revision: 333
Proposed branch: lp:~camptocamp/anybox.recipe.openerp/fix-addons-path-1189402
Merge into: lp:anybox.recipe.openerp
Diff against target: 37 lines (+8/-1)
2 files modified
anybox/recipe/openerp/base.py (+5/-1)
setup.py (+3/-0)
To merge this branch: bzr merge lp:~camptocamp/anybox.recipe.openerp/fix-addons-path-1189402
Reviewer Review Type Date Requested Status
Joël Grand-Guillaume @ camptocamp (community) code review, no test Approve
Nicolas Bessi - Camptocamp (community) Needs Information
Anybox Pending
Review via email: mp+168392@code.launchpad.net

Commit message

Use an OrderedDict to store the sources of the branches in order to keep the order defined in the buildout configuration file when the addons-path is generated.

Description of the change

Fix for lp:1189402

Use an OrderedDict so the insertion order of the keys is kept and the addons-path keep the order defined in the buildout configuration file.

It includes a drop-in recipe for the OrderedDict to keep compatibility with Python < 2.7
This is a copy of the recipe [0] proposed by the Python documentation [1].

[0] http://code.activestate.com/recipes/576693/
[1] http://docs.python.org/2/library/collections.html#collections.OrderedDict

To post a comment you must log in.
Revision history for this message
Nicolas Bessi - Camptocamp (nbessi-c2c-deactivatedaccount) wrote :

Hello,

Shouldn't we use ordereddict pip package as a python 2.6 dependency instead ?
It uses the same base code:
https://pypi.python.org/pypi/ordereddict

review: Needs Information
334. By Guewen Baconnier @ Camptocamp

Replaced the included OrderedDict by the python library ordereddict when python 2.6 is used

Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

> Hello,
>
> Shouldn't we use ordereddict pip package as a python 2.6 dependency instead ?
> It uses the same base code:
> https://pypi.python.org/pypi/ordereddict

Changed. Thanks for the pointer.

Revision history for this message
Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c) wrote :

LGTM, thanks you

review: Approve (code review, no test)
Revision history for this message
Georges Racinet (gracinet) wrote :

Hi, thanks for the report and contribution !

that looks nice, and indeed I wasn't aware that this ordering could matter to some people.
I'll merge tomorrow or wednesday.

As a side note, this could be easily tested in tests/test_server.py.

We usually run the recipe tests with nose in a virtualenv, like this:
http://buildbot.anybox.fr/builders/anybox.recipe.openerp/builds/419/steps/nosetests/logs/stdio

In case you'd wonder about the context in which this example is run, check the previous steps stdio output. They can be reached from here:
http://buildbot.anybox.fr/builders/anybox.recipe.openerp/builds/419

Revision history for this message
Georges Racinet (gracinet) wrote :
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

Thanks for the test and the merge!
Next time I will think about the test

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'anybox/recipe/openerp/base.py'
2--- anybox/recipe/openerp/base.py 2013-05-20 19:16:53 +0000
3+++ anybox/recipe/openerp/base.py 2013-06-10 11:51:33 +0000
4@@ -11,6 +11,10 @@
5 import shutil
6 import ConfigParser
7 import distutils.core
8+try:
9+ from collections import OrderedDict
10+except ImportError:
11+ from ordereddict import OrderedDict # Python < 2.7
12 from zc.buildout.easy_install import MissingDistribution
13 from zc.buildout import UserError
14 import zc.recipe.egg
15@@ -132,7 +136,7 @@
16 logger.info('Created %s/ directory' % basename(d))
17 os.mkdir(d)
18
19- self.sources = {}
20+ self.sources = OrderedDict()
21 self.parse_addons(options)
22 self.parse_version()
23 self.parse_revisions(options)
24
25=== modified file 'setup.py'
26--- setup.py 2013-06-07 00:12:47 +0000
27+++ setup.py 2013-06-10 11:51:33 +0000
28@@ -11,6 +11,9 @@
29
30 requires = ['setuptools', 'zc.recipe.egg', 'zc.buildout']
31
32+if sys.version_info < (2, 7):
33+ requires.append('ordereddict')
34+
35 setup(
36 name="anybox.recipe.openerp",
37 version=version,

Subscribers

People subscribed via source and target branches