1 回答
TA贡献1817条经验 获得超6个赞
2to3
或者modernize
应该有帮助。这只是 Python 语法的问题。
2to3
随 Python 一起提供,也可以作为 Python 模块执行:
python -m lib2to3 -w SConstruct
这是建议的补丁2to3
,看起来很小:
RefactoringTool: Refactored SConstruct
--- SConstruct (original)
+++ SConstruct (refactored)
@@ -3,8 +3,8 @@
env = Environment(ENV = os.environ)
try:
env.Tool('config', toolpath = [os.environ.get('CBANG_HOME')])
-except Exception, e:
- raise Exception, 'CBANG_HOME not set?\n' + str(e)
+except Exception as e:
+ raise Exception('CBANG_HOME not set?\n' + str(e))
env.CBLoadTools('packager run_distutils osx fah-client-version')
env.CBAddVariables(
@@ -14,7 +14,7 @@
# Version
try:
version = env.FAHClientVersion()
-except Exception, e:
+except Exception as e:
print(e)
version = '0.0.0'
env.Replace(PACKAGE_VERSION = version)
RefactoringTool: Files that need to be modified:
RefactoringTool: SConstruct
添加回答
举报