gpt4 book ai didi

python - `setup.py sdist` 是如何工作的?

转载 作者:太空狗 更新时间:2023-10-29 18:28:26 27 4
gpt4 key购买 nike

我正在尝试使用 setup.py sdist 对我的项目进行源代码分发。我已经有了可以安装的正常运行的 setup.py。但是当我执行 sdist 时,我得到的只是 my_project 文件夹中的另一个 my_project 文件夹,一个 MANIFEST 文件我对包含两个文本文件的 zip 文件不感兴趣,而不是我的项目。

我做错了什么? 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 在 this article 中解释了这一点以及相关的软件打包工具。 (已损坏 original link)称为用 Python 编写程序包。

基本上,它通过以下方式创建一个简单的包创建一个发布树,其中复制运行包所需的一切。然后将这棵树归档在一个或多个归档文件中(通常,它只创建一个 tar 包)。存档基本上是源代码树的副本。

关于python - `setup.py sdist` 是如何工作的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1614086/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com