Frage

The build of my daysgrounded package works fine with the command

python setup.py sdist bdist_wininst bdist_egg bdist_wheel

in my dist dir appear these files:

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

The egg and whl have all the text files inside the daysgrounded dir, but the zip does not. It only contains the source code py files. This is the 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}
     )

this is the

__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']}

and this is the 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])]

Any ideas why this happens?

War es hilfreich?

Lösung

You need to add a MANIFEST.in file that tells setup which additional files to distribute. The Distributing Python Modules section of the documentation describes how to do this.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top