【发布时间】:2013-06-18 06:38:41
【问题描述】:
我有一个使用 py2app 的 setup.py,我想在构建应用程序之前运行 2to3 将 python 脚本转换为 Python 3 兼容。我使用了选项setup(use_2to3=True),但它没有调用2to3。所以现在我使用Makefile 来解决这个问题。任何pythonic解决方案? setup.py 如下。请帮忙。
import sys
from setuptools import setup
from plistlib import Plist
plist = Plist.fromFile('Info.plist')
OPTIONS = {
'iconfile': 'python.icns',
'plist': plist
}
if sys.version_info.major < 3:
app = "PyInterpreter.py"
else:
app = "build/PyInterpreter.py"
setup(
name="PyInterpreter",
app=[app],
data_files=["English.lproj"],
options={'py2app': OPTIONS},
setup_requires=["py2app"],
use_2to3=True,
)
谢谢。
【问题讨论】:
标签: python-3.x py2app python-2to3