首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >用欢乐汤更新InstallShield .ism (MSI)文件并维护其格式

用欢乐汤更新InstallShield .ism (MSI)文件并维护其格式
EN

Stack Overflow用户
提问于 2013-07-25 06:29:57
回答 1查看 738关注 0票数 0

我正在尝试用当前构建版本更新我的.ism文件。查找和替换构建字符串没有问题。但是,我很难让我的.ism文件在被漂亮的汤处理后保持它的格式。下面是我尝试使用漂亮汤查找和更新构建版本字符串的尝试:

代码语言:javascript
复制
def upVerIsm(origFile,newFile):
    openIsm = origFile
    outputIsm = newFile
    soup = BeautifulSoup(openIsm)

    tblProp = soup.find("table", {"name":"Property"})
    rows = tblProp.find_all("row")
    for row in rows:
        firstCell = row.contents[0].get_text()
        if firstCell == "ProductVersion":
        tmpProdVer = row.contents[1].string.replace_with(updVerStr) 

    if(flgMstrVer):
        tblReg = soup.find("table", {"name":"Registry"})
        # get all rows within registry table
        rows = tblReg.find_all("row")
        for row in rows:
            td4 = row.contents[3].get_text()
            if td4 == "MasterVersion":
               td5 = row.contents[4].get_text()
               tmpMstrStr = re.split('_',unicode(td5))
               newBuildStr = tmpMstrStr[0] + "_" + tmpMstrStr[1] + "_" + tmpMstrStr[2] + "_B" + version_num
              row.contents[4].string.replace_with(str(newBuildStr)) 
              print row

     # tmpIsm = soup.encode("ascii","ignore")
     # updatedIsm = soup.prettify(formatter=None) # if i do this i get the ascii code error: (UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in position 666845: ordinal not in range(128))
    updatedIsm = str(soup) # this alters the content of the .ism file and breaks the build
    outputIsm.write(updatedIsm)   

    return outputIsm,openIsm # new,original files respectively

我被困住了,想要一些指点,谢谢你的阅读!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-07-25 14:17:42

您不需要更新ISM,只需将构建版本(和许多其他内容)传递到编译器。如果您真的想更新ISM,那么InstallShield提供了一个自动化接口。打开项目,更新属性,然后保存和关闭项目。

而且,尽管我非常喜欢InstallShield,但ISM仅仅是底层MSI表数据的DTD XML转换。如果代码表达能力真的是您的首要任务,那么基于WiX的XSD是最好的选择。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17850620

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档