setup.py sdist如何工作? [英] How does `setup.py sdist` work?
问题描述
我正在尝试使用 setup.py sdist
进行项目的源代码分发。我已经有一个可以运行的 setup.py
功能。但是当我执行 sdist
时,我得到的只是我的 my_project <中的另一个
my_project
文件夹/ code>文件夹,一个我不感兴趣的 MANIFEST
文件以及一个包含两个文本文件的zip文件,而不是我的项目。
I'm trying to make a source distribution of my project with setup.py sdist
. I already have a functioning setup.py
that I can install with. But when I do the sdist
, all I get is another my_project
folder inside my my_project
folder, a MANIFEST
file I have no interest in, and a zip file which contains two text files, and not my project.
我在做什么错? sdist
的文档在哪里?
What am I doing wrong? Where is the documentation on sdist
?
更新:
这是我的 setup.py
:
#!/usr/bin/env python
import os
from distutils.core import setup
import distutils
from general_misc import package_finder
try:
distutils.dir_util.remove_tree('build', verbose=True)
except:
pass
my_long_description = \
'''\
GarlicSim is a platform for writing, running and analyzing simulations. It can
handle any kind of simulation: Physics, game theory, epidemic spread,
electronics, etc.
'''
my_packages = package_finder.get_packages('', include_self=True,
recursive=True)
setup(
name='GarlicSim',
version='0.1',
description='A Pythonic framework for working with simulations',
author='Ram Rachum',
author_email='cool-rr@cool-rr.com',
url='http://garlicsim.org',
packages=my_packages,
package_dir={'': '..'},
license= "LGPL 2.1 License",
long_description = my_long_description,
)
try:
distutils.dir_util.remove_tree('build', verbose=True)
except:
pass
推荐答案
Tarek Ziade在本文调用ed用Python编写程序包。
Tarek Ziade explained this, and related software packaging tools, in this article called Writing a Package in Python.
基本上,它通过
创建一个简单的程序包,并创建一个释放树,在其中复制运行程序包所需的所有内容。然后将此树归档到一个或多个归档文件中(通常,它仅创建一个tar球)。归档文件基本上是源代码树的副本。
Basically, it creates a simple package by creating a release tree where everything needed to run the package is copied. This tree is then archived in one or many archived files (often, it just creates one tar ball). The archive is basically a copy of the source tree.
这篇关于setup.py sdist如何工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!