Closed Bug 894227 Opened 7 years ago Closed 7 years ago

Add configobj Python package to the tree

Categories

(Firefox Build System :: General, defect)

defect
Not set

Tracking

(Not tracked)

RESOLVED FIXED
mozilla25

People

(Reporter: gps, Assigned: gps)

References

Details

Attachments

(1 file)

https://pypi.python.org/pypi/configobj/ is a nifty ini file roundtripper. I'd like to use it for mach config files and for things like programmatic editing of Mercurial hgrc files for optimal environment setup.
I'm just looking for a rubber stamp. This isn't too important. You can
hold off until there is code that uses it if you want.

License is BSD, so there should be no issues on that front.
Attachment #776202 - Flags: review?(mh+mozilla)
Assignee: nobody → gps
What does it do that you can't do with ConfigParser?
It can round trip config files, preserving comments. Although, perhaps ConfigParser in Python 3 (http://docs.python.org/3/library/configparser.html) (which is on PyPI and can run on Python 2.7) can do this as well. If so, we should use that because standard library.
configparser from Python 3 does not appear to support roundtripping comments. Since I wish to edit user-supplied config files (like ~/.hgrc), I'm afraid this is a showstopper.

http://wiki.python.org/moin/ConfigParserShootout has more info. There are other config parsers that do roundtripping. But I kind of like configobj's popularity. It shows up at the top of PyPI searches for "config parser" and is used by some big projects. That's got to count for something.
Comment on attachment 776202 [details] [diff] [review]
Add configobj Python package

Review of attachment 776202 [details] [diff] [review]:
-----------------------------------------------------------------

rs=me

::: build/mach_bootstrap.py
@@ +28,5 @@
>      'python/mach',
>      'python/mozboot',
>      'python/mozbuild',
>      'python/blessings',
> +    'python/configobj',

I wonder if it wouldn't make sense to make mach_bootstrap read packages.txt at some point.
Attachment #776202 - Flags: review?(mh+mozilla) → review+
(In reply to Mike Hommey [:glandium] from comment #5)
> I wonder if it wouldn't make sense to make mach_bootstrap read packages.txt
> at some point.

Indeed. We could also likely have it execfile() the activate_this.py from the already-installed virtualenv. It's a giant chicken or egg problem though. We'll tackle it eventually...
https://hg.mozilla.org/integration/mozilla-inbound/rev/b9fe5a05edd9
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla25
I would (cannot understate) *LOVE* to consolidate on a set of python packages we actually want to use.  If we're going with configobj over ConfigParser and it is available, there is much code that can and should be changed
(In reply to Jeff Hammel [:jhammel] from comment #8)
> I would (cannot understate) *LOVE* to consolidate on a set of python
> packages we actually want to use.  If we're going with configobj over
> ConfigParser and it is available, there is much code that can and should be
> changed

Honestly, I don't care so much if others use ConfigParser. I want configobj for mach configs and mach commands (like configuring mercurial) because I'm asserting people won't like if our automatic config rewriting removes comments, ordering, etc. I think I'll still default to ConfigParser for scenarios that don't need to write files back out.
https://hg.mozilla.org/mozilla-central/rev/b9fe5a05edd9
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.