当我产生使用tar cfz cl.tar.gz Sources
相比蟒蛇shutil.make_archive ("py", "gztar", "Sources")
为tar.gz文件,我得到不同的结果:命令行tar和shutil.make_archive之间的区别?
$ tar -tf cl.tar.gz | head -3
algorithm/
aligned_storage.hpp
algorithm/cxx11/
$ tar -tf py.tar.gz | head -3
./algorithm/
./aligned_storage.hpp
./algorithm/cxx11/
这其中大部分都没有区别的时间;但如果您在解除阻塞时通过--strip-components
,那么这两个档案的行为会有所不同。
我真的很想从我从shell脚本中得到的python代码中获得相同的结构,但我不太清楚该怎么做。我在Mac OS 10.8.1上使用Python 2.7.3,如果这有所作为。
在Ubuntu上,我得到了两种方法的相同格式(即用'。/')。你究竟如何创建tarball? – Hamish