简体   繁体   English

从文件上传setup.py

[英]setup.py upload from a file

To upload to PyPI, you run python setup.py register sdist upload . 要上传到PyPI,请运行python setup.py register sdist upload But this requires regenerating the source distribution. 但这需要重新生成源分发。 As part of my release process, I want to be able to generate the source distribution separately from the uploading. 在发布过程中,我希望能够与上载分开生成源分发。 Is there a way to upload from a file, ie, something like python setup.py upload dists/mypackage.tar.gz ? 有没有一种方法可以从文件中上传文件,例如python setup.py upload dists/mypackage.tar.gz

upload will only push files that are products of a command run from the same command line, eg “sdist upload”. 上载将仅推送来自同一命令行的命令产品,例如“ sdist上载”。 If you run “sdist”, check the result, and then do “sdist upload”, the second sdist should be exactly the same, unless your setup.py is buggy, you made changes to your files or you have a computer problem. 如果您运行“ sdist”,检查结果,然后执行“ sdist upload”,则第二个sdist应该完全相同,除非您的setup.py有错误,对文件进行了更改或计算机出现问题。 (I agree that's a lot of unless). (我同意,除非有很多例外)。 So for distutils, having to run “sdist upload” is not inefficient, and makes you be explicit about the files you want to push, which is IMO good. 因此,对于distutils,必须运行“ sdist upload”并非没有效率,并且可以使您清楚地知道要推送的文件,这对IMO来说很好。

(from http://bugs.python.org/issue12944#msg144382 ) (来自http://bugs.python.org/issue12944#msg144382

The issue mentioned by Éric Araujo mentions this trick: ÉricAraujo提到的问题提到了这个技巧:

"A trick can be used to avoid the second sdist to redo all its work: Fist you run “python setup.py sdist --keep-temp”, then you check the sdist, and to upload you call “python setup.py sdist --dry-run upload”. I'm not in favor of adding that trick to the doc, as for normal usage, running sdist twice is okay." “可以使用一种技巧来避免第二个sdist重做所有工作:首先运行“ python setup.py sdist --keep-temp”,然后检查sdist,然后上传并称为“ python setup.py sdist --dry-run upload”。我不赞成将该技巧添加到文档中,因为通常的用法是,两次运行sdist都可以。

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

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