gpt4 book ai didi

Python 包构建工作正常,但 dist 中的 zip 不包含所有文件

转载 作者:行者123 更新时间:2023-12-01 05:16:11 25 4
gpt4 key购买 nike

我的 daysgrounded 包的构建与命令配合良好

python setup.py sdist bdist_wininst bdist_egg bdist_wheel

在我的 dist 目录中出现这些文件:

daysgrounded-0.0.10.win32.exe
daysgrounded-0.0.10.zip
daysgrounded-0.0.10-py2.7.egg
daysgrounded-0.0.10-py2.py3-none-any.whl

egg 和 whl 在 daysgrounded 目录中包含所有文本文件,但 zip 没有。它只包含源代码py文件。这是setup.py

#!/usr/bin/env python
# -*- coding: latin-1 -*-

from __future__ import (absolute_import, division, print_function,
unicode_literals)

##import sys
from setuptools import setup, find_packages
#import py2exe
##from cx_Freeze import setup, Executable

from daysgrounded.globalcfg import NAME, VERSION, DATA_FILES
from daysgrounded import (DESC, LICENSE, URL, KEYWORDS, CLASSIFIERS, #PACKAGES,
ENTRY_POINTS, PKG_DATA)

AUTHOR = 'Joao Matos'
SCRIPT = NAME + '\\__main__.py'

### cx_Freeze config for bdist_msi
##bdist_msi_options = {
## 'upgrade_code': '{66620F3A-DC3A-11E2-B341-002219E9B01E}',
## 'add_to_path': False,
## 'initial_target_dir': r'[ProgramFilesFolder]\%s\%s' % (AUTHOR, NAME),
## }
##build_exe_options = {'includes': ['atexit', 'PySide.QtNetwork']}
### GUI applications require a different base on Windows
##base = None
##if sys.platform == 'win32':
## base = 'Win32GUI'
##exe = Executable(script=SCRIPT, base=base) #, icon='daysgrounded.ico')

setup(name=NAME,
version=VERSION,
description=DESC,
long_description=open('README.txt').read(),
#long_description=(read('README.txt') + '\n\n' +
# read('CHANGES.txt') + '\n\n' +
# read('AUTHORS.txt')),
license=LICENSE,
url=URL,
author=AUTHOR,
author_email='jcrmatos@gmail.com',

keywords=KEYWORDS,
classifiers=CLASSIFIERS,

packages=find_packages(exclude=['tests*']),
#packages=PACKAGES,

# to create the Scripts exe using bdist_wininst build option
entry_points=ENTRY_POINTS,

install_requires=open('requirements.txt').read(),
#install_requires=open('requirements.txt').read().splitlines(),

include_package_data=True,
package_data=PKG_DATA,

# py2exe config
#console=[SCRIPT],
#data_files=DATA_FILES,

## # cx_Freeze config for bdist_msi
## executables=[exe],
## options={'bdist_msi': bdist_msi_options, 'build_exe': build_exe_options}
)

这是

__init__.py

#!/usr/bin/env python
# -*- coding: latin-1 -*-

"""Manage child(s) grounded days."""

from __future__ import (absolute_import, division, print_function,)
#unicode_literals)
# The above unicode_literals import prevents setup.py from working.
# It seems to be a bug in setuptools.

import sys
from os import path

sys.path.insert(1, path.dirname(__file__)) # add path to PYTHONPATH

__all__ = ['DESC', 'LICENSE', 'URL', 'KEYWORDS', 'CLASSIFIERS', #'PACKAGES',
'ENTRY_POINTS', 'PKG_DATA']

DESC = __doc__.strip()
LICENSE = 'GNU General Public License v2 or later (GPLv2+)'
URL = 'https://github.com/jcrmatos/DaysGrounded'
KEYWORDS = 'days grounded'
CLASSIFIERS = [# Use below to prevent any unwanted publishing
#'Private :: Do Not Upload'
'Development Status :: 4 - Beta',
'Environment :: Console',
'Environment :: Win32 (MS Windows)',
'Intended Audience :: End Users/Desktop',
'Intended Audience :: Developers',
'Natural Language :: English',
'Natural Language :: Portuguese',
'License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.4',
'Topic :: Other/Nonlisted Topic']

#PACKAGES = ['daysgrounded']

ENTRY_POINTS = {
'console_scripts': ['daysgrounded = daysgrounded.__main__:main'],
#'gui_scripts': ['app_gui = daysgrounded.daysgrounded:start']
}

PKG_DATA = {'daysgrounded': ['usage.txt', 'LICENSE.txt', 'banner.txt']}
#PKG_DATA= {'': ['*.txt'], 'daysgrounded': ['*.txt']}

这是 globalcfg.py

#!/usr/bin/env python
# -*- coding: latin-1 -*-

"""Global configuration."""

from __future__ import (absolute_import, division, print_function,)
#unicode_literals)
# ToDo: fix strings to activate above import?

USAGE_FILE = 'usage.txt'
#USAGE_FILE = 'usage_en.txt'
BANNER_FILE = 'banner.txt'
#BANNER_FILE = 'banner_en.txt'
LICENSE_FILE = 'LICENSE.txt'

NAME = 'daysgrounded'
VERSION = '0.0.10'
COPYRIGHT = 'Copyright 2014 Joao Matos'

DATA_FILES = [('', [NAME + '\\' + USAGE_FILE]),
('', [NAME + '\\' + BANNER_FILE]),
('', [NAME + '\\' + LICENSE_FILE])]

有什么想法为什么会发生这种情况吗?

最佳答案

您需要添加一个 MANIFEST.in 文件,告诉 setup 要分发哪些附加文件。 Distributing Python Modules文档的部分描述了如何执行此操作。

关于Python 包构建工作正常,但 dist 中的 zip 不包含所有文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23188833/

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