如何设置。py sdist的工作吗?

时间:2022-09-12 07:30:17

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.

我正试图用设置来为我的项目做一个源分配。py sdist。我已经设置好了。可以安装的py。但是当我执行sdist时,我得到的是my_project文件夹中的另一个my_project文件夹,一个我不感兴趣的清单文件,一个包含两个文本文件的zip文件,而不是我的项目。

What am I doing wrong? Where is the documentation on sdist?

我做错了什么?sdist的文档在哪里?

Update:

更新:

Here's my setup.py:

这是我的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

2 个解决方案

#1


6  

Tarek Ziade explained this, and related software packaging tools, in this article called Writing a Package in Python.

Tarek Ziade在本文中解释了这一点,以及相关的软件打包工具。

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.

基本上,它通过创建一个发布树来创建一个简单的包,在这个发布树中,运行包所需的所有内容都被复制。然后将该树归档到一个或多个归档文件中(通常,它只创建一个tar球)。存档基本上是源树的一个副本。

#2


4  

the "sdist" command is for creating a "source" distribution of a package. Usually, one would combine this command with the "upload" command to distribute the package through Pypi (for example).

“sdist”命令用于创建包的“源”分发版。通常,可以将该命令与“upload”命令组合在一起,通过Pypi(例如)分发包。

#1


6  

Tarek Ziade explained this, and related software packaging tools, in this article called Writing a Package in Python.

Tarek Ziade在本文中解释了这一点,以及相关的软件打包工具。

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.

基本上,它通过创建一个发布树来创建一个简单的包,在这个发布树中,运行包所需的所有内容都被复制。然后将该树归档到一个或多个归档文件中(通常,它只创建一个tar球)。存档基本上是源树的一个副本。

#2


4  

the "sdist" command is for creating a "source" distribution of a package. Usually, one would combine this command with the "upload" command to distribute the package through Pypi (for example).

“sdist”命令用于创建包的“源”分发版。通常,可以将该命令与“upload”命令组合在一起,通过Pypi(例如)分发包。