<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Pysproto on KK的博客</title><link>https://spin6lock.github.io/tags/pysproto/</link><description>Recent content in Pysproto on KK的博客</description><generator>Hugo</generator><language>zh-CN</language><lastBuildDate>Sat, 04 Sep 2021 00:00:00 +0800</lastBuildDate><atom:link href="https://spin6lock.github.io/tags/pysproto/feed.xml" rel="self" type="application/rss+xml"/><item><title> 发布 pysproto</title><link>https://spin6lock.github.io/2021/09/04/%E5%8F%91%E5%B8%83pysproto.html</link><pubDate>Sat, 04 Sep 2021 00:00:00 +0800</pubDate><guid>https://spin6lock.github.io/2021/09/04/%E5%8F%91%E5%B8%83pysproto.html</guid><description>&lt;p&gt;今天是个值得纪念的日子，我终于将适用于 Python 3 的 &lt;a href="https://github.com/spin6lock/python-sproto/"&gt;pysproto&lt;/a&gt; 成功上传到 pypi 了，顺便写一篇博客吐槽下 Python 的打包发布系统&lt;/p&gt;&#10;&lt;p&gt;依稀记得之前将 C 文件都放在 src 目录里，结果死活编译不过，于是都散装放在根目录了；然后 Pypi 要先发布测试包，再在网页操作一下，发布成正式包。setup.py 作为包的描述文件，long_description 字段还得用 reStructure Text 的格式写，不然就提交不过。pysproto 这个模块需要头文件，但是屡屡打包都没打进去。感觉打包模块在这里是 broken 的，&lt;a href="https://stackoverflow.com/a/35400299"&gt; 有个 stackoverflow&lt;/a&gt; 的回答精确描述了我的感受 : 在 sources 字段列举头文件会导致无法编译，distutil 不能区分 .h 文件，会试图编译对应的 .o 文件；在 headers 字段列举头文件会被忽略；在 setup 函数的 headers 字段里列举头文件能识别，但是不会被打进包里；在 Extension 函数的 include_dirs 里列举头文件，也不会打进包里。最后还是用了最高赞答案的 MANIFEST.in 文件里写一行 &lt;code&gt;graft 头文件路径 &lt;/code&gt;, 终于解决问题。。。&lt;/p&gt;</description></item></channel></rss>