setuptools删除二进制文件,但将它们保存在tar中

时间:2013-04-17 07:57:40

标签: python python-2.7

当我做的时候

  

python setup.py bdist

我的python项目文件夹。我发现它创建了dist,build文件夹但是在创建egg / tar之后它删除了二进制文件。 我如何保留二进制文件?我可以看到它最后删除了build文件夹。

running bdist
running bdist_dumb
running build
running build_py
creating build
creating build/lib
creating build/lib/my_project_folder
copying my_project_folder/__init__.py -> build/lib/my_project_folder
copying my_project_folder/my_script.py -> build/lib/my_project_folder
installing to build/bdist.linux-x86_64/dumb
running install
running install_lib
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/dumb
creating build/bdist.linux-x86_64/dumb/usr
creating build/bdist.linux-x86_64/dumb/usr/lib
creating build/bdist.linux-x86_64/dumb/usr/lib/python2.6
creating build/bdist.linux-x86_64/dumb/usr/lib/python2.6/site-packages
creating build/bdist.linux-x86_64/dumb/usr/lib/python2.6/site-packages/my_project_folder
copying build/lib/my_project_folder/__init__.py -> build/bdist.linux-x86_64/dumb/usr/lib/python2.6/site-packages/my_project_folder
copying build/lib/my_project_folder/my_script.py -> build/bdist.linux-
byte-compiling build/bdist.linux-x86_64/dumb/usr/lib/python2.6/site-packages/my_project_folder/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/dumb/usr/lib/python2.6/site-packages/my_project_folder/my_script.py to my_script.pyc
running install_egg_info
running egg_info
creating my_project_folder.egg-info
writing requirements to my_project_folder.egg-info/requires.txt
writing my_project_folder.egg-info/PKG-INFO
writing top-level names to my_project_folder.egg-info/top_level.txt
writing dependency_links to my_project_folder.egg-info/dependency_links.txt
writing requirements to my_project_folder.egg-info/requires.txt
writing my_project_folder.egg-info/PKG-INFO
writing top-level names to my_project_folder.egg-info/top_level.txt
writing dependency_links to my_project_folder.egg-info/dependency_links.txt
writing manifest file 'my_project_folder.egg-info/SOURCES.txt'
reading manifest file 'my_project_folder.egg-info/SOURCES.txt'
writing manifest file 'my_project_folder.egg-info/SOURCES.txt'
Copying my_project_folder.egg-info to build/bdist.linux-x86_64/dumb/usr/lib/python2.6/site-packages/my_project_folder-1.0.0_SNAPSHOT-py2.6.egg-info
running install_scripts
creating /root/workspace/my_project-rpm/my_project-v1/target/my_project-v1-1.0.0-SNAPSHOT/dist
tar -cf /root/workspace/my_project-rpm/my_project-v1/target/my_project-v1-1.0.0-SNAPSHOT/dist/my_project-v1-1.0.0-SNAPSHOT.linux-x86_64.tar .
gzip -f9 /root/workspace/my_project-rpm/my_project-v1/target/my_project-v1-1.0.0-SNAPSHOT/dist/my_project-v1-1.0.0-SNAPSHOT.linux-x86_64.tar
tar -cf /root/workspace/my_project-rpm/my_project-v1/target/my_project-v1-1.0.0-SNAPSHOT/dist/my_project-v1-1.0.0-SNAPSHOT.linux-x86_64.tar .
gzip -f9 /root/workspace/my_project-rpm/my_project-v1/target/my_project-v1-1.0.0-SNAPSHOT/dist/my_project-v1-1.0.0-SNAPSHOT.linux-x86_64.tar
removing 'build/bdist.linux-x86_64/dumb' (and everything under it)

我想解决的问题是创建一个只包含二进制文件的tar文件。 截至目前我能够使用* .py和* .pyc文件创建tar文件(这默认带有bdist命令)我明白这是bdist命令的功能。 但是我不想在最后的tar中使用.py文件。

只要我可以访问* .pyc文件,我就可以自己创建tar但是setuptools不允许我保留它。

1 个答案:

答案 0 :(得分:0)

做到这两点。

python setup.py bdist build

python setup.py bdist
python setup.py build