From 48fef01e136cba03dd88eb89e2bb04804b9db768 Mon Sep 17 00:00:00 2001 From: minqiyang Date: Thu, 12 Jul 2018 19:45:45 +0800 Subject: [PATCH] Change python code style to 3.x in setup.py --- paddle/legacy/utils/PythonUtil.cpp | 2 +- paddle/legacy/utils/PythonUtil.h | 2 +- python/setup.py.in | 14 +++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/paddle/legacy/utils/PythonUtil.cpp b/paddle/legacy/utils/PythonUtil.cpp index b7746be848..21ed049c4d 100644 --- a/paddle/legacy/utils/PythonUtil.cpp +++ b/paddle/legacy/utils/PythonUtil.cpp @@ -142,7 +142,7 @@ std::string callPythonFunc(const std::string& moduleName, return std::string(str, (size_t)str_size); #else return std::string(PyString_AsString(obj.get()), PyString_Size(obj.get())); -#endif // PY_MAJOR_VERSION >= 3 +#endif // PY_MAJOR_VERSION >= 3 } PyObjectPtr createPythonClass( diff --git a/paddle/legacy/utils/PythonUtil.h b/paddle/legacy/utils/PythonUtil.h index 2c0471b84c..d5b2dbddde 100644 --- a/paddle/legacy/utils/PythonUtil.h +++ b/paddle/legacy/utils/PythonUtil.h @@ -136,7 +136,7 @@ T castInt(PyObject* obj, bool* ok = nullptr) { return (T)0; } } -#endif // PY_MAJOR_VERSION >= 3 +#endif // PY_MAJOR_VERSION >= 3 /** * Invoke repr of python object. diff --git a/python/setup.py.in b/python/setup.py.in index 3e81ee7b17..fa2bfaa33e 100644 --- a/python/setup.py.in +++ b/python/setup.py.in @@ -17,7 +17,7 @@ def git_commit(): git_commit = subprocess.Popen(cmd, stdout = subprocess.PIPE).communicate()[0].strip() except: git_commit = 'Unknown' - return git_commit + return str(git_commit) def _get_version_detail(idx): assert idx < 3, "vesion info consists of %(major)d.%(minor)d.%(patch)d, \ @@ -67,13 +67,13 @@ with_mkl = '%(with_mkl)s' def show(): if istaged: - print 'full_version:', full_version - print 'major:', major - print 'minor:', minor - print 'patch:', patch - print 'rc:', rc + print('full_version:', full_version) + print('major:', major) + print('minor:', minor) + print('patch:', patch) + print('rc:', rc) else: - print 'commit:', commit + print('commit:', commit) def mkl(): return with_mkl -- GitLab