3

Right now I have some example files included in the setup.py file, but what do I do if I want to add the entire directory to DATA_FILES? And my script creates files aswell, so they have to be accessible and be stored together with the others. (I have just started with python so I am sorry if there is a very obvious solution to this!)

"""
This is a setup.py script generated by py2applet

Usage:
    python setup.py py2app
"""

from setuptools import setup

APP = ['KeyPass.py']
DATA_FILES = ['kristoffer.txt', 'appicon.png', 'application.png','background-2.png', 'editimg.png', 'resultater.png', 'user.png']
OPTIONS = {
    'iconfile':'appicon.icns',
}

setup(
    app=APP,
    data_files=DATA_FILES,
    options={'py2app': OPTIONS},
    setup_requires=['py2app'],
)
kriwet
  • 43
  • 3

1 Answers1

1

I'm not sure if your data_files=DATA_FILES, line works, but data_files does take a list, and it can include 2-element tuples, one of which can be something like:

DATA_FILES = [('examples', glob.glob('examples/*.*')),]

The first element is a directory name, and the second is a list of files to grab. This should allow you to add a directory to your setup.py. The glob module allows wildcard access.

GaryMBloom
  • 5,350
  • 1
  • 24
  • 32