Merge lp:~jml/pkgme/default-maintainer into lp:pkgme

Proposed by Jonathan Lange
Status: Merged
Approved by: James Westby
Approved revision: 100
Merged at revision: 101
Proposed branch: lp:~jml/pkgme/default-maintainer
Merge into: lp:pkgme
Diff against target: 63 lines (+21/-0)
2 files modified
pkgme/info_elements.py (+6/-0)
pkgme/tests/test_info_elements.py (+15/-0)
To merge this branch: bzr merge lp:~jml/pkgme/default-maintainer
Reviewer Review Type Date Requested Status
James Westby Approve
Review via email: mp+99299@code.launchpad.net

Commit message

Use DEBEMAIL environment variable to set the package maintainer.

Description of the change

This changes the Maintainer field to use the DEBEMAIL environment variable if it's set. Otherwise, uses the dummy "A Person" email address that pkgme currently uses.

The goal of this change is to allow pkgme-service to specify the maintainer for the packages that it builds.

To post a comment you must log in.
Revision history for this message
Jonathan Lange (jml) wrote :

Note that the python_debian on my precise system seems to have a get_maintainer() function that we could & probably should use, but that this function is not available in my pkgme virtualenv.

Revision history for this message
James Westby (james-w) wrote :

The algorithm for DEBEMAIL and friends is more complex than this, but I think
this is an ok start. Using the get_maintainer() function at a later date would
be good.

Thanks,

James

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'pkgme/info_elements.py'
--- pkgme/info_elements.py 2012-02-04 18:29:54 +0000
+++ pkgme/info_elements.py 2012-03-26 12:00:45 +0000
@@ -1,5 +1,6 @@
1import json1import json
2import re2import re
3import os
34
45
5class InvalidInfoError(Exception):6class InvalidInfoError(Exception):
@@ -104,8 +105,13 @@
104 Name <email>105 Name <email>
105106
106 """107 """
108
107 default = "A Person <someone@example.com>"109 default = "A Person <someone@example.com>"
108110
111 @classmethod
112 def get_default(cls):
113 return os.environ.get('DEBEMAIL', cls.default)
114
109115
110class Homepage(InfoElement):116class Homepage(InfoElement):
111117
112118
=== modified file 'pkgme/tests/test_info_elements.py'
--- pkgme/tests/test_info_elements.py 2012-02-04 18:29:54 +0000
+++ pkgme/tests/test_info_elements.py 2012-03-26 12:00:45 +0000
@@ -1,5 +1,6 @@
1import json1import json
22
3from fixtures import EnvironmentVariableFixture
3from testtools import TestCase4from testtools import TestCase
45
5from pkgme.info_elements import (6from pkgme.info_elements import (
@@ -10,6 +11,7 @@
10 ExtraFilesFromPaths,11 ExtraFilesFromPaths,
11 InfoElement,12 InfoElement,
12 InvalidInfoError,13 InvalidInfoError,
14 Maintainer,
13 MissingInfoError,15 MissingInfoError,
14 PackageName,16 PackageName,
15 )17 )
@@ -265,6 +267,19 @@
265 more information""", cleaned)267 more information""", cleaned)
266268
267269
270class TestMaintainer(TestCase):
271
272 def test_unspecified(self):
273 self.useFixture(EnvironmentVariableFixture('DEBEMAIL', None))
274 self.assertEqual(
275 Maintainer.default, Maintainer.get_value(DictInfo({})))
276
277 def test_from_environment_variable(self):
278 debemail = 'Dude <dude@example.com>'
279 self.useFixture(EnvironmentVariableFixture('DEBEMAIL', debemail))
280 self.assertEqual(debemail, Maintainer.get_value(DictInfo({})))
281
282
268class TestPackageName(TestCase):283class TestPackageName(TestCase):
269284
270 def test_valid(self):285 def test_valid(self):

Subscribers

People subscribed via source and target branches