Skip to content
This repository was archived by the owner on Jan 23, 2024. It is now read-only.

Commit 6a10687

Browse files
xinghuadou-googleXinghua Dou
authored andcommitted
Add support for Python 3 in //devtools/cdbg/e2e/python/gce:e2e_python_gce_test
Unfortunately tools like virtualenv and pyenv won't work with this since they are designed for interactive shells and _vm.RunShellCommand starts a new one every time. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=187532256
1 parent 968c7ec commit 6a10687

3 files changed

Lines changed: 7 additions & 2 deletions

File tree

src/build.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ library_dirs=${ROOT}/build/third_party/lib" > ${ROOT}/setup.cfg
8484

8585
# Build the Python Cloud Debugger agent.
8686
pushd ${ROOT}
87-
python setup.py bdist_egg
87+
# Use custom python command if variable is set
88+
"${PYTHON:-python}" setup.py bdist_egg
8889
popd
8990

src/googleclouddebugger/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,9 @@ def _DebuggerMain():
143143

144144
sys.modules['__main__'] = __main__
145145

146-
exec('execfile(%r)' % app_path, globals, locals) # pylint: disable=exec-used
146+
with open(app_path) as f:
147+
code = compile(f.read(), app_path, 'exec')
148+
exec(code, globals, locals) # pylint: disable=exec-used
147149

148150

149151
# pylint: disable=invalid-name

src/googleclouddebugger/gcp_hub_client.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,8 @@ def _QueryGcpProject(self, resource):
461461
'HTTP error %s %s when querying local metadata service at %s' %
462462
(response['status'], content, url))
463463

464+
if not isinstance(content, str):
465+
content = content.decode()
464466
return content
465467

466468
def _GetDebuggee(self):

0 commit comments

Comments
 (0)