Skip to content

Commit fdad88d

Browse files
committed
Merge branch 'master' of github.com:pypa/twine
2 parents 0f7d16b + 6025509 commit fdad88d

4 files changed

Lines changed: 39 additions & 5 deletions

File tree

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ Tom Myers <tom.stephen.myers@gmail.com>
1313
Rodrigue Cloutier <rodcloutier@gmail.com>
1414
Tyrel Souza <tyrelsouza@gmail.com> (https://tyrelsouza.com)
1515
Adam Talsma <adam@talsma.ca>
16+
Jens Diemer <github@jensdiemer.de> (http://jensdiemer.de/)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020

2121
install_requires = [
22-
"pkginfo",
22+
"pkginfo >= 1.0",
2323
"requests >= 2.3.0",
2424
"requests-toolbelt >= 0.4.0",
2525
"setuptools >= 0.7.0",

tests/test_upload.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14+
from __future__ import unicode_literals
15+
16+
import os
17+
import textwrap
18+
1419
import pretend
1520
import pytest
1621

@@ -72,3 +77,26 @@ def test_sign_file_with_identity(monkeypatch):
7277
args = ['gpg', '--detach-sign', '--local-user', 'identity', '-a',
7378
'my_file.tar.gz']
7479
assert replaced_check_call.calls == [pretend.call(args)]
80+
81+
82+
def test_get_config_old_format(tmpdir):
83+
pypirc = os.path.join(str(tmpdir), ".pypirc")
84+
85+
with open(pypirc, "w") as fp:
86+
fp.write(textwrap.dedent("""
87+
[server-login]
88+
username:foo
89+
password:bar
90+
"""))
91+
92+
try:
93+
upload.upload(dists="foo", repository="pypi", sign=None, identity=None,
94+
username=None, password=None, comment=None,
95+
sign_with=None, config_file=pypirc)
96+
except KeyError as err:
97+
assert err.args[0] == (
98+
"Missing 'pypi' section from the configuration file.\n"
99+
"Maybe you have a out-dated '{0}' format?\n"
100+
"more info: "
101+
"https://docs.python.org/distutils/packageindex.html#pypirc\n"
102+
).format(pypirc)

twine/commands/upload.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,16 @@ def upload(dists, repository, sign, identity, username, password, comment,
106106
try:
107107
config = get_config(config_file)[repository]
108108
except KeyError:
109-
raise KeyError(
110-
"Missing '{0}' section from the configuration file".format(
111-
repository,
112-
),
109+
msg = (
110+
"Missing '{repo}' section from the configuration file.\n"
111+
"Maybe you have a out-dated '{cfg}' format?\n"
112+
"more info: "
113+
"https://docs.python.org/distutils/packageindex.html#pypirc\n"
114+
).format(
115+
repo=repository,
116+
cfg=config_file
113117
)
118+
raise KeyError(msg)
114119

115120
parsed = urlparse(config["repository"])
116121
if parsed.netloc in ["pypi.python.org", "testpypi.python.org"]:

0 commit comments

Comments
 (0)