mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-03-03 04:49:41 +00:00
Port to Python 3.
This commit is contained in:
parent
c98d90bf74
commit
250ca3170d
@ -1,6 +1,15 @@
|
|||||||
|
"""
|
||||||
|
Ported to Python 3.
|
||||||
|
"""
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
from __future__ import absolute_import
|
||||||
|
from __future__ import division
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
from past.builtins import unicode
|
from future.utils import PY2
|
||||||
|
if PY2:
|
||||||
|
from future.builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, list, object, range, str, max, min # noqa: F401
|
||||||
|
|
||||||
from six import ensure_binary
|
from six import ensure_binary
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -25,9 +34,9 @@ def print_keypair(options):
|
|||||||
from allmydata.crypto import ed25519
|
from allmydata.crypto import ed25519
|
||||||
out = options.stdout
|
out = options.stdout
|
||||||
private_key, public_key = ed25519.create_signing_keypair()
|
private_key, public_key = ed25519.create_signing_keypair()
|
||||||
print("private:", unicode(ed25519.string_from_signing_key(private_key), "ascii"),
|
print("private:", str(ed25519.string_from_signing_key(private_key), "ascii"),
|
||||||
file=out)
|
file=out)
|
||||||
print("public:", unicode(ed25519.string_from_verifying_key(public_key), "ascii"),
|
print("public:", str(ed25519.string_from_verifying_key(public_key), "ascii"),
|
||||||
file=out)
|
file=out)
|
||||||
|
|
||||||
class DerivePubkeyOptions(BaseOptions):
|
class DerivePubkeyOptions(BaseOptions):
|
||||||
@ -52,8 +61,8 @@ def derive_pubkey(options):
|
|||||||
privkey_vs = options.privkey
|
privkey_vs = options.privkey
|
||||||
privkey_vs = ensure_binary(privkey_vs)
|
privkey_vs = ensure_binary(privkey_vs)
|
||||||
private_key, public_key = ed25519.signing_keypair_from_string(privkey_vs)
|
private_key, public_key = ed25519.signing_keypair_from_string(privkey_vs)
|
||||||
print("private:", unicode(ed25519.string_from_signing_key(private_key), "ascii"), file=out)
|
print("private:", str(ed25519.string_from_signing_key(private_key), "ascii"), file=out)
|
||||||
print("public:", unicode(ed25519.string_from_verifying_key(public_key), "ascii"), file=out)
|
print("public:", str(ed25519.string_from_verifying_key(public_key), "ascii"), file=out)
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
class AdminCommand(BaseOptions):
|
class AdminCommand(BaseOptions):
|
||||||
|
@ -88,6 +88,7 @@ PORTED_MODULES = [
|
|||||||
"allmydata.node",
|
"allmydata.node",
|
||||||
"allmydata.nodemaker",
|
"allmydata.nodemaker",
|
||||||
"allmydata.scripts",
|
"allmydata.scripts",
|
||||||
|
"allmydata.scripts.admin",
|
||||||
"allmydata.scripts.create_node",
|
"allmydata.scripts.create_node",
|
||||||
"allmydata.scripts.runner",
|
"allmydata.scripts.runner",
|
||||||
"allmydata.scripts.types_",
|
"allmydata.scripts.types_",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user