我正在使用 distutilsbdist_msi
命令创建一个 msi 安装程序。在我的安装文件中,我想在 msi 安装软件包后运行代码,请帮助..
from distutils.core import setup
from distutils.command.bdist_msi import bdist_msi
import os
import shutil
STARTMENU = "C:/ProgramData/Microsoft/Windows/Start Menu/Programs/ShotExplorer"
STARTUP = "C:/ProgramData/Microsoft/Windows/Start Menu/Programs/Startup"
LINK = r"C:\Python27\Lib\site-packages\shotexplorer\ShotExplorer.lnk"
class MyCommand(bdist_msi):
def run(self):
bdist_msi.run(self)
print "Creating Start Menu Entries"
if not os.path.exists(STARTMENU):
os.makedirs(STARTMENU)
shutil.copy(LINK, STARTMENU)
shutil.copy(LINK, STARTUP)
setup(
name = "shotexplorer",
version = "1.0",
description = "Tool to explore shots on isilon",
author = "abhishek.garg",
author_email = "abhishekgarg12@yahoo.com",
packages = ["shotexplorer", "shotexplorer.pyHook"],
package_data = {"":["explorer.ico","quicktime.png","ShotExplorer.lnk","pyHook/_cpyHook.pyd"]},
include_package_data = True,
cmdclass = {'bdist_msi':MyCommand}
)