简体   繁体   English

如何使用python自动更改specman文件?

[英]How to automate specman files changes with python?

I am working on a specman environment (hardware verification language), and I want to automate my tasks.我在 specman 环境(硬件验证语言)上工作,我想自动化我的任务。

In order to do so, I learned Python programming with the target to use the file manipulation abilities.为了做到这一点,我学习了 Python 编程,目标是使用文件操作能力。 The problem is that I know only how to manipulate .txt files, Is there a way to change different kind of files?问题是我只知道如何操作 .txt 文件,有没有办法更改不同类型的文件?

Your question is way too generic.你的问题太笼统了。 It's possible to change *.e files using string matching, maybe in some cases this makes sense as a one-time task, but there couldn't be any rules for that.可以使用字符串匹配来更改 *.e 文件,也许在某些情况下,这作为一次性任务是有意义的,但对此没有任何规则。 Writing e parser in python doesn't sound like a feasible task.在 python 中编写 e 解析器听起来不像是一项可行的任务。

The only reasonable way to analyze e code is to load it and use reflection.分析e代码唯一合理的方法是加载它并使用反射。 But not always you can feed the results to python to let it make any meaningful modifications.但并非总是可以将结果提供给 python 以使其进行任何有意义的修改。

It's totally possible to use python to generate e code based on some formally defined specs, specifically mentioned coverage, generation constraints, etc. It can be efficient and maintainable approach.基于一些正式定义的规范,特别提到的覆盖率、生成约束等,使用 python 生成电子代码是完全可能的。它是一种高效且可维护的方法。 However, there are different facilities for that, including tables.但是,有不同的设施,包括桌子。

Python certainly can be used for all kinds of smart scriptology: define environment, track installations and versions, choose flows, generate stubs, etc. Python 当然可以用于各种智能脚本:定义环境、跟踪安装和版本、选择流程、生成存根等。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM