简体   繁体   English

以编程方式写入.pypirc文件

[英]Write .pypirc file programmatically

Is there some library available to write a ~/.pypirc file programmatically? 是否有一些库可用于以编程方式编写~/.pypirc文件?

Also, what is the formal spec of its format? 另外,其格式的正式规范是什么? All I've found is this section of the docs: 我所发现的只是文档的这一部分:

https://docs.python.org/3.3/distutils/packageindex.html#pypirc https://docs.python.org/3.3/distutils/packageindex.html#pypirc

That leaves out details like what kinds of whitespace are allowable, whether = and : are equivalent or not, and so on. 遗漏了一些细节,例如允许哪些类型的空格, =:是否相等,等等。

The file is read by distutils/config.py using RawConfigParser . distutils/config.py使用RawConfigParser读取文件。

So if you want to write it use the same RawConfigParser . 因此,如果要编写,请使用相同的RawConfigParser The docs you pointed are the only docs. 您指向的文档是唯一的文档。 The rest could be deduced from the code. 其余的可以从代码中推断出来。

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

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