setuptools 在构建中包含 dist/ 文件夹

发布于 2024-09-25 10:52:55 字数 1346 浏览 10 评论 0原文

我正在使用 setuptools 创建 sdist 包并将其上传到 PyPI。

但是每次我运行 python setup.py sdist 时,它都会包含 dist/ 文件夹及其内容,这是我不想要的。当我使用 distutils 时,这种行为不会发生。

这是我的文件结构:

/
-myModule/
--__init_.py,
-- ...
-docs/
-examples/
-dist/
setup.py

这也是我的 svn 主干根目录。这是我的 setup.py

import ez_setup
ez_setup.use_setuptools()

from setuptools import setup, find_packages
setup(name='mymodule',
    version='1.0',
    license='gpl',
    description='blahn',
    author='me',
    author_email='myemail',
    url='http://code.google.com/p/mymodule/',
    packages= find_packages(),
    install_requires = [
        'numpy>=1.3.0',
        'scipy>=0.7.1',
        'matplotlib>=1.0.0'
        ],
    )

当看到这个输出时,这表明了问题

python setup.py sdist
...
making hard links in mwavepy-1.0...
hard linking MANIFEST.in -> mwavepy-1.0
hard linking ez_setup.py -> mwavepy-1.0
hard linking setup.py -> mwavepy-1.0
hard linking dist/mwavepy-1.0.tar.gz -> mwavepy-1.0/dist
hard linking dist/mwavepy-1.0.win32.exe -> mwavepy-1.0/dist
hard linking dist/mwavepy-1.0.zip -> mwavepy-1.0/dist
hard linking doc/generate_docs.py -> mwavepy-1.0/doc
hard linking doc/mwavepy.calibration.html -> mwavepy-1.0/doc
hard linking doc/mwavepy.calibrationAlgorithms.html -> mwavep
...

i am using setuptools to create and upload a sdist package to PyPI.

however everytime i run python setup.py sdist, it includes the dist/ folder and its contents, which i dont want . this behavoir does NOT happen when i use distutils.

here is my file structure:

/
-myModule/
--__init_.py,
-- ...
-docs/
-examples/
-dist/
setup.py

this is also my svn trunk root. here is my setup.py

import ez_setup
ez_setup.use_setuptools()

from setuptools import setup, find_packages
setup(name='mymodule',
    version='1.0',
    license='gpl',
    description='blahn',
    author='me',
    author_email='myemail',
    url='http://code.google.com/p/mymodule/',
    packages= find_packages(),
    install_requires = [
        'numpy>=1.3.0',
        'scipy>=0.7.1',
        'matplotlib>=1.0.0'
        ],
    )

when see this output, which indicates the problem

python setup.py sdist
...
making hard links in mwavepy-1.0...
hard linking MANIFEST.in -> mwavepy-1.0
hard linking ez_setup.py -> mwavepy-1.0
hard linking setup.py -> mwavepy-1.0
hard linking dist/mwavepy-1.0.tar.gz -> mwavepy-1.0/dist
hard linking dist/mwavepy-1.0.win32.exe -> mwavepy-1.0/dist
hard linking dist/mwavepy-1.0.zip -> mwavepy-1.0/dist
hard linking doc/generate_docs.py -> mwavepy-1.0/doc
hard linking doc/mwavepy.calibration.html -> mwavepy-1.0/doc
hard linking doc/mwavepy.calibrationAlgorithms.html -> mwavep
...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

困倦 2024-10-02 10:52:55

尝试删除 find_packages() 语句并将其替换为

setup(
    ...
    packages = ['myModule'],
    package_dir = {'myModule' : 'myModule_path'},
    ...)

Try to remove find_packages() statement and replace it with

setup(
    ...
    packages = ['myModule'],
    package_dir = {'myModule' : 'myModule_path'},
    ...)
时光瘦了 2024-10-02 10:52:55

您也可以将参数传递给 find_packages()

setup(
    #...
    packages= find_packages(exclude='dist'),
    # ...
)

You could alternatively pass an argument to find_packages():

setup(
    #...
    packages= find_packages(exclude='dist'),
    # ...
)
霓裳挽歌倾城醉 2024-10-02 10:52:55

这发生在我身上,直到我运行 svn rm dist/foo.tar.gz ,然后它不再是硬链接,并且不在生成的 tarball 中。 setuptools 的文档确实提到了基于是否文件受 CVS 或 SVN 控制:

包含包数据

如果设置为 True,这会告诉 setuptools 自动包含任何
它在包目录中找到的数据文件,它们是
在 CVS 或 Subversion 控制下,或者由您指定
MANIFEST.in 文件。

This happened for me, until I ran svn rm dist/foo.tar.gz, and then it wasn't hard-linked anymore, and wasn't in the resulting tarball. The documentation for setuptools does mention different behavior based on whether a file is under CVS or SVN control:

include_package_data

If set to True, this tells setuptools to automatically include any
data files it finds inside your package directories, that are either
under CVS or Subversion control, or which are specified by your
MANIFEST.in file.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文