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
=== modified file 'anybox/recipe/openerp/base.py'
--- anybox/recipe/openerp/base.py 2013-05-20 19:16:53 +0000
+++ anybox/recipe/openerp/base.py 2013-06-10 11:51:33 +0000
@@ -11,6 +11,10 @@
11import shutil11import shutil
12import ConfigParser12import ConfigParser
13import distutils.core13import distutils.core
14try:
15 from collections import OrderedDict
16except ImportError:
17 from ordereddict import OrderedDict # Python < 2.7
14from zc.buildout.easy_install import MissingDistribution18from zc.buildout.easy_install import MissingDistribution
15from zc.buildout import UserError19from zc.buildout import UserError
16import zc.recipe.egg20import zc.recipe.egg
@@ -132,7 +136,7 @@
132 logger.info('Created %s/ directory' % basename(d))136 logger.info('Created %s/ directory' % basename(d))
133 os.mkdir(d)137 os.mkdir(d)
134138
135 self.sources = {}139 self.sources = OrderedDict()
136 self.parse_addons(options)140 self.parse_addons(options)
137 self.parse_version()141 self.parse_version()
138 self.parse_revisions(options)142 self.parse_revisions(options)
139143
=== modified file 'setup.py'
--- setup.py 2013-06-07 00:12:47 +0000
+++ setup.py 2013-06-10 11:51:33 +0000
@@ -11,6 +11,9 @@
1111
12requires = ['setuptools', 'zc.recipe.egg', 'zc.buildout']12requires = ['setuptools', 'zc.recipe.egg', 'zc.buildout']
1313
14if sys.version_info < (2, 7):
15 requires.append('ordereddict')
16
14setup(17setup(
15 name="anybox.recipe.openerp",18 name="anybox.recipe.openerp",
16 version=version,19 version=version,

Subscribers

People subscribed via source and target branches