classification
Title: Allow multiple setup_hooks
Type: enhancement Stage: resolved
Components: Distutils2 Versions: Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: eric.araujo Nosy List: alexis, eric.araujo, erik.bray, python-dev, tarek
Priority: normal Keywords: patch

Created on 2011-06-02 14:59 by erik.bray, last changed 2011-06-20 19:28 by erik.bray. This issue is now closed.

Files
File name Uploaded Description Edit
python_issue12240.patch erik.bray, 2011-06-06 16:49 review
python_issue12240-2.patch erik.bray, 2011-06-09 16:47 Updated patch--includes test and renames setup_hook to setup_hooks
Messages (9)
msg137479 - (view) Author: Erik Bray (erik.bray) * Date: 2011-06-02 14:59
I have a use case where I have a small library of setup_hook functions for various purposes that are used by multiple projects.  Some projects may want to use more than one of these setup_hooks.

I can certainly create a wrapper hook for each function that calls all the necessary hooks.  But that gets a little tedious and seems unnecessary.  In this use case it would be fine if I could just list a set of setup_hooks to be executed in sequence.

It is, of course, up the developer to be sure that none of these setup_hooks have conflicting actions.

As a temporary workaround I wrote a setup_hook called chain_setup_hooks.  I then looks for an option called "setup_hooks" which behaves as I've described.  This works fine, though I don't see why setup_hook shouldn't allow multiple values to begin with.
msg137528 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-06-03 15:39
I can’t see why not.  Would you like to work on a patch?
msg137605 - (view) Author: Erik Bray (erik.bray) * Date: 2011-06-03 22:34
Great!  I'll add a patch shortly.
msg137751 - (view) Author: Erik Bray (erik.bray) * Date: 2011-06-06 16:49
Adds support for multiple setup_hooks and updates the docs.

For now I left the option name as "setup_hook", though it might make sense to rename it to "setup_hooks" for consistency's sake.
msg138015 - (view) Author: Erik Bray (erik.bray) * Date: 2011-06-09 16:47
Here's an update with tests.  It should be applied after my patch for issue11595.
msg138174 - (view) Author: Roundup Robot (python-dev) Date: 2011-06-11 18:01
New changeset 5f0cd4844061 by Éric Araujo in branch 'default':
Allow multiple setup hooks in packaging’s setup.cfg files (#12240).
http://hg.python.org/cpython/rev/5f0cd4844061
msg138180 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-06-11 18:09
Done.
msg138751 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-06-20 19:26
The tests were failing on builbots with an ASCII locale.  The config files have to be opened with an explicit encoding='utf-8' argument.  Let’s remember it for the future :)
msg138752 - (view) Author: Erik Bray (erik.bray) * Date: 2011-06-20 19:28
Good to know! The majority of my development is still on 2.x so it's easy to forget things like that.
History
Date User Action Args
2011-06-20 19:28:22erik.braysetmessages: + msg138752
2011-06-20 19:26:26eric.araujosetmessages: + msg138751
2011-06-11 18:09:18eric.araujosetstatus: open -> closed
messages: + msg138180

assignee: tarek -> eric.araujo
resolution: fixed
stage: resolved
2011-06-11 18:01:44python-devsetnosy: + python-dev
messages: + msg138174
2011-06-09 16:47:51erik.braysetfiles: + python_issue12240-2.patch

messages: + msg138015
2011-06-06 16:49:43erik.braysetfiles: + python_issue12240.patch
keywords: + patch
messages: + msg137751
2011-06-03 22:34:46erik.braysetmessages: + msg137605
2011-06-03 15:39:41eric.araujosetmessages: + msg137528
versions: + Python 3.3
2011-06-02 14:59:38erik.braycreate