~ubuntu-branches/ubuntu/trusty/dput-ng/trusty-proposed

« back to all changes in this revision

Viewing changes to dput/configs/dputng.py

  • Committer: Package Import Robot
  • Author(s): Arno Töll, Arno Töll, Luca Falavigna, Paul Tagliamonte, Bernhard R. Link, Sandro Tosi
  • Date: 2013-01-29 21:50:13 UTC
  • Revision ID: package-import@ubuntu.com-20130129215013-zk9tpfqajoflht5v
Tags: 1.4
[ Arno Töll ]
* Really fix #696659 by making sure the command line tool uses the most recent
  version of the library.
* Mark several fields to be required in profiles (incoming, method)
* Fix broken tests.
* Do not run the check-debs hook in our mentors.d.n profile
* Fix "[dcut] dm bombed out" by using the profile key only when defined
  (Closes: #698232)
* Parse the gecos field to obtain the user name / email address from the local
  system when DEBFULLNAME and DEBEMAIL are not set.
* Fix "dcut reschedule sends "None-day" to ftp-master if the delay is
  not specified" by forcing the corresponding parameter (Closes: #698719)

[ Luca Falavigna ]
* Implement default_keyid option. This is particularly useful with multiple
  GPG keys, so dcut is aware of which one to use.
* Make scp uploader aware of "port" configuration option.

[ Paul Tagliamonte ]
* Hack around Launchpad's SFTP implementation. We musn't stat *anything*.
  "Be vewy vewy quiet, I'm hunting wabbits" (Closes: #696558).
* Rewrote the test suite to actually test the majority of the codepaths we
  take during an upload. Back up to 60%.
* Added a README for the twitter hook, Thanks to Sandro Tosi for the bug,
  and Gergely Nagy for poking me about it. (Closes: #697768).
* Added a doc for helping folks install hooks into dput-ng (Closes: #697862).
* Properly remove DEFAULT from loadable config blocks. (Closes: #698157).
* Allow upload of more then one file. Thanks to Iain Lane for the
  suggestion. (Closes: #698855).

[ Bernhard R. Link ]
* allow empty incoming dir to upload directly to the home directory

[ Sandro Tosi ]
* Install example hooks (Closes: #697767).

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
dput-ng native configuration file implementation.
22
22
"""
23
23
 
 
24
import sys
 
25
 
24
26
from dput.util import load_config, get_configs
25
27
from dput.core import logger
26
28
from dput.config import AbstractConfig
34
36
    return get_configs('profiles')
35
37
 
36
38
 
 
39
if sys.version_info[0] >= 3:
 
40
    _basestr_type = str
 
41
else:
 
42
    _basestr_type = basestring
 
43
 
 
44
 
37
45
class DputProfileConfig(AbstractConfig):
38
46
    """
39
47
    dput-ng native config file implementation. Subclass of a
73
81
        See :meth:`dput.config.AbstractConfig.get_config`
74
82
        """
75
83
        kwargs = {
76
 
            "default": {},
77
 
            "schema": "config"
 
84
            "default": {}
78
85
        }
 
86
 
79
87
        configs = self.configs
80
88
        if configs is not None:
81
89
            kwargs['configs'] = configs
91
99
        repls = self.replacements
92
100
        for thing in profile:
93
101
            val = profile[thing]
94
 
            if not isinstance(val, basestring):
 
102
            if not isinstance(val, _basestr_type):
95
103
                continue
96
104
            for repl in repls:
97
105
                if repl in val:
98
106
                    val = val.replace("%%(%s)s" % (repl), repls[repl])
99
107
            profile[thing] = val
 
108
 
100
109
        ret = {}
101
110
        ret.update(profile)
102
111
        ret['name'] = name
103
112
 
104
113
        for key in ret:
105
114
            val = ret[key]
106
 
            if isinstance(val, basestring):
 
115
            if isinstance(val, _basestr_type):
107
116
                if "%(" in val and ")s" in val:
108
117
                    raise DputConfigurationError(
109
118
                        "Half-converted block: %s --> %s" % (
111
120
                            val
112
121
                        )
113
122
                    )
114
 
 
115
123
        return ret