用于解析/更新 UNIX 配置文件的 API
Unix 配置文件有各种形式。我知道 Webmin 有一个 Perl API,可以轻松地以编程方式解析和修改最常见的配置,同时保留可能手动进行的更改。
是否有任何其他库具有类似的功能,也许适用于其他语言(Python、Ruby、C、C++ 等)?
Unix configuration files come in all shapes and forms. I know that Webmin has a Perl API that makes it easy to parse and modify most common configuration programmatically, while preserving changes that might have been made by hand.
Are there any other libraries that has similar functionality, perhaps for other languages (Python, Ruby, C, C++, etc)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
至少对于 Python 来说,有许多旨在简化解析的库。最简单的之一可能是 picoparse (http://github.com/brehaut/picoparse),它是构造为提供直接的解析,而不需要正则表达式。
另一个值得一看的可能是 funcparselib (http://code.google.com/p/funcparserlib/ )也适用于Python。
如果您打算使用 C,构建解析器的最常用工具是 Yacc 和 Flex。这些工具比较复杂,使用门槛也比较高。
At least for Python there are numerous libraries that intends to simplify parsing. One of the simplest might be picoparse (http://github.com/brehaut/picoparse) which is constructed to provide straight forward parsing without the need of regexps.
Another one worth a look might be funcparselib (http://code.google.com/p/funcparserlib/) also for python.
If you intend to use C the most common tools for building parsers are Yacc and Flex. These tools are rather complex and has a rather high threshold before being usable.
Ajenti,用 Python 编写的 Webmin 的替代方案,使用 重新配置。
它不像 Webmin 及其 API 那样成熟和完整,但重新配置看起来是我能找到的这个问题的最好答案。
Ajenti, an alternative for Webmin written in Python uses reconfigure.
It is not as mature and complete as Webmin and it's API, but reconfigure looks like as good an answer to this question as I am able to find.