Make use of entry_poins for creating the binary for the module (#10)

This commit is contained in:
Cosmin Malutan 2014-07-03 17:36:17 +03:00
Родитель 865ff9c197
Коммит 8fbe72371e
2 изменённых файлов: 11 добавлений и 4 удалений

Просмотреть файл

@ -2,8 +2,8 @@
import os, urlparse, argparse # argparse requires py2.7/py3.2
import time
from fxa_client import fxa_crypto
from fxa_client.fxa_crypto import (
import fxa_crypto
from fxa_crypto import (
FXA_GET, printhex, binary_type, FXA_POST, resendForgotPassword,
stretch, verifyForgotPassword, HKDF, KW, split,
HAWK_POST, getRestmailVerifyUrl, RESTMAILURL,
@ -182,7 +182,7 @@ parser.add_argument("-l", "--lang", help="accept-language header value")
parser.add_argument("command", help="one of: repl, create, login[-with-keys], destroy, change-password, forgotpw-send, forgotpw-resend, forgotpw-submit, verify, get-token-code")
parser.add_argument("args", nargs=argparse.REMAINDER)
if __name__ == '__main__':
def main():
args = parser.parse_args()
emailUTF8 = args.email or "fxa-%s@restmail.net" % os.urandom(6).encode("hex")
passwordUTF8 = args.password or os.urandom(2).encode("hex")
@ -216,6 +216,10 @@ if __name__ == '__main__':
else:
command(args)
if __name__ == '__main__':
main()
# exercised:
# account/create
# NO: account/devices (might not even be implemented)

Просмотреть файл

@ -18,7 +18,6 @@ setup(
"six",
],
packages = ["fxa_client"],
scripts = ["bin/fxa-client"],
classifiers=[
"Programming Language :: Python",
"Programming Language :: Python :: 2",
@ -28,4 +27,8 @@ setup(
"Programming Language :: Python :: 3.2",
"Programming Language :: Python :: 3.3",
],
entry_points = """
[console_scripts]
fxa-client = fxa_client.fxa_client:main
"""
)