change eden cli to run with python 3

Summary: Update eden/fs/cli directory to run with Python 3.

Reviewed By: simpkins

Differential Revision: D3479252

fbshipit-source-id: 3e3dc023fc54e99b7839a1a4dc8605dd7ef2d8a3
This commit is contained in:
Caren Thomas 2016-06-27 11:58:55 -07:00 committed by Facebook Github Bot 6
parent 7d0cfe494e
commit 35add0f007
5 changed files with 9 additions and 16 deletions

3
DEFS
View File

@ -58,13 +58,12 @@ def cpp_unittest(
original_python_binary = python_binary
def python_binary(
name,
py_version=None,
srcs=None,
gen_srcs=None,
main_module=None,
deps=None,
):
# TODO: Handle py_version and gen_srcs.
# TODO: Handle gen_srcs.
original_python_binary(
name=name,
srcs=srcs,

View File

@ -2,7 +2,6 @@ include_defs('//eden/DEFS')
python_binary(
name = 'cli',
py_version = "<3",
srcs = glob(['*.py']),
main_module = 'eden/fs/cli/main',
deps = [

View File

@ -1,3 +1,5 @@
#!/usr/bin/env python3
#
# Copyright (c) 2016, Facebook, Inc.
# All rights reserved.
#
@ -5,9 +7,6 @@
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
from __future__ import (absolute_import, division,
print_function, unicode_literals)
import collections
import errno
import json

View File

@ -1,3 +1,5 @@
#!/usr/bin/env python3
#
# Copyright (c) 2016, Facebook, Inc.
# All rights reserved.
#
@ -5,9 +7,6 @@
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
from __future__ import (absolute_import, division,
print_function, unicode_literals)
import argparse
from eden.thrift import EdenNotRunningError
import errno
@ -99,7 +98,7 @@ def _get_git_dir(path):
def _get_git_commit(git_dir):
cmd = ['git', '--git-dir', git_dir, 'rev-parse', 'HEAD']
out = subprocess.check_output(cmd)
return out.strip()
return out.strip().decode('utf-8', errors='surrogateescape')
def _get_hg_repo(path):
@ -135,7 +134,7 @@ def _get_hg_commit(repo):
env['HGPLAIN'] = '1'
cmd = ['hg', '--cwd', repo, 'log', '-T{node}\\n', '-r.']
out = subprocess.check_output(cmd, env=env)
return out.strip()
return out.strip().decode('utf-8', errors='surrogateescape')
def do_health(args):

View File

@ -1,3 +1,5 @@
#!/usr/bin/env python3
#
# Copyright (c) 2016, Facebook, Inc.
# All rights reserved.
#
@ -5,11 +7,6 @@
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import time