我建立一个Tkinter的应用程序,并将其分配给两个的CentOS和Win7如何使用bdist_rpm像bdist_wininst?
而包装WIN7
python setup.py bdist_wininst --install-script script_to_create_shortcut.py
工作出色罚款在两个一个启动开始菜单和桌面
但CentOS的
python setup.py bdist_rpm --install-script script_to_create_shortcut_for_linux.py
悲惨的失败了
虽然后来我意识到转速要求SH文件来执行,所以我用一个安装后脚本
python setup.py bdist_rpm --post-install=script_to_create_shortcut_for_linux.py
失败,因为它也是存储在一个SH文件
现在Python代码,我写了一个SH文件运行python -c "from module import post_install_script"
,但同样未能在安装后脚本无法找到合适的函数名
setup.py
setup=(..
scripts=[os.path.join('tickets','complaints.py'),
os.path.join('tickets','shortcut_linux.py'),
os.path.join('tickets','tickets.svg')],
...)
快捷的创建者或安装后python脚本
file_created(os.path.join(sys.prefix,'bin','complaints.py'))
desktop=get_special_folder_path("CSIDL_COMMON_DESKTOPDIRECTORY")
startmenu=get_special_folder_path("CSIDL_COMMON_STARTMENU")
create_shortcut(os.path.join(sys.prefix,'bin','complaints.py'),
"Complaints Register",
os.path.join(desktop,'complaints.desktop'),
'','',
os.path.join(sys.prefix,'bin','tickets.svg'))
file_created(os.path.join(desktop,'complaints.desktop'))
create_shortcut(os.path.join(sys.prefix,'bin','complaints.py'),
"Complaints Register",
os.path.join(startmenu,'complaints.desktop'),
'','',
os.path.join(sys.prefix,'bin','tickets.svg'))
它失败file_created没有定义错误全球名称...
为什么转并不那么简单,因为wininst该做的一切非常简单地
我花了太多的时间在这之后...任何帮助将不胜感激 谢谢
注意:为wininst的shortcutfile了不同的路径,例如:它不力有“本”
凡'file_created'从何而来?哪个模块具有该功能? –
iam在此之后,它是安装后脚本的文档 https://docs.python.org/2/distutils/builtdist.html?highlight=create_shortcut#create_shortcut –
您还发现'CSIDL_ *'是仅限Windows的路径, 对? 'file_created'似乎也是一个仅限Windows的bdist函数。你不能只运行你的for-Windows脚本,并期望它能够产生一个rpm。你需要在适当的配置下使用'bdist_rpm'。 –