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

Proposed by Jonathan Lange on 2012-03-26
Status: Merged
Approved by: James Westby on 2012-03-26
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
To merge this branch: bzr merge lp:~jml/pkgme/default-maintainer
Reviewer Review Type Date Requested Status
James Westby 2012-03-26 Approve on 2012-03-26
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.
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.

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

1=== modified file 'pkgme/info_elements.py'
2--- pkgme/info_elements.py 2012-02-04 18:29:54 +0000
3+++ pkgme/info_elements.py 2012-03-26 12:00:45 +0000
4@@ -1,5 +1,6 @@
5 import json
6 import re
7+import os
8
9
10 class InvalidInfoError(Exception):
11@@ -104,8 +105,13 @@
12 Name <email>
13
14 """
15+
16 default = "A Person <someone@example.com>"
17
18+ @classmethod
19+ def get_default(cls):
20+ return os.environ.get('DEBEMAIL', cls.default)
21+
22
23 class Homepage(InfoElement):
24
25
26=== modified file 'pkgme/tests/test_info_elements.py'
27--- pkgme/tests/test_info_elements.py 2012-02-04 18:29:54 +0000
28+++ pkgme/tests/test_info_elements.py 2012-03-26 12:00:45 +0000
29@@ -1,5 +1,6 @@
30 import json
31
32+from fixtures import EnvironmentVariableFixture
33 from testtools import TestCase
34
35 from pkgme.info_elements import (
36@@ -10,6 +11,7 @@
37 ExtraFilesFromPaths,
38 InfoElement,
39 InvalidInfoError,
40+ Maintainer,
41 MissingInfoError,
42 PackageName,
43 )
44@@ -265,6 +267,19 @@
45 more information""", cleaned)
46
47
48+class TestMaintainer(TestCase):
49+
50+ def test_unspecified(self):
51+ self.useFixture(EnvironmentVariableFixture('DEBEMAIL', None))
52+ self.assertEqual(
53+ Maintainer.default, Maintainer.get_value(DictInfo({})))
54+
55+ def test_from_environment_variable(self):
56+ debemail = 'Dude <dude@example.com>'
57+ self.useFixture(EnvironmentVariableFixture('DEBEMAIL', debemail))
58+ self.assertEqual(debemail, Maintainer.get_value(DictInfo({})))
59+
60+
61 class TestPackageName(TestCase):
62
63 def test_valid(self):

Subscribers

People subscribed via source and target branches