Skip to content

Commit

Permalink
fix pypa#116
Browse files Browse the repository at this point in the history
  • Loading branch information
mhils committed Aug 7, 2015
1 parent d852113 commit 760f5f8
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions twine/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals

import os
import os.path
import functools
import getpass
Expand Down Expand Up @@ -113,6 +114,13 @@ def get_userpass_value(cli_value, config, key, prompt_strategy):
else:
return prompt_strategy()

def password_prompt(prompt_text): # Always expects unicode for our own sanity
prompt = prompt_text
# Workaround for https://github.com/pypa/twine/issues/116
if os.name == 'nt' and sys.version_info < (3, 0):
prompt = prompt_text.encode('utf8')
return functools.partial(getpass.getpass, prompt=prompt)

get_username = functools.partial(
get_userpass_value,
key='username',
Expand All @@ -121,7 +129,5 @@ def get_userpass_value(cli_value, config, key, prompt_strategy):
get_password = functools.partial(
get_userpass_value,
key='password',
prompt_strategy=functools.partial(
getpass.getpass, 'Enter your password: ',
),
prompt_strategy=password_prompt('Enter your password: '),
)

0 comments on commit 760f5f8

Please sign in to comment.