Question

So I have made a small application that I typically want to package and share it with the world. I read the tutorials for packaging my app using setuptools. It was going well until I got stuck at one place.

My directory structure is something like this:

- MyApp
  - setup.py
  - README.md
  - LICENSE.txt
  - MANIFEST.in
  - myapp
    - __init__.py
    - index.py
    - utils
      - __init__.py
      - helper.py
      - some_dump.pickle
      - images
        - folder_1
          - image_1.jpg
          - image_2.jpg
        - folder_2
          - another_image_1.jpg
          - another_image_2.jpg
      - sounds
        - sound_1.wav
        - sound_2.wav

Given this directory structure, I have created the setup.py file with the packages option as the list containing myapp and myapp.utils. I have also created a MANIFEST.in file that will have all the files that I want to package but which are not included by default. Here is the content of the manifest file:

include README.md
include LICENSE.txt
include myapp/utils/*.pickle
include myapp/utils/sounds/*.wav
include myapp/utils/images/folder_1/*.jpg
include myapp/utils/images/folder_2/*.jpg

The problem is that all these files are created as required in the distribution package (.zip), but when I try to use the distribution package to try the install the package myself, I don't see the images, sounds or the pickle file. i.e. when I run python setup.py install, I don't see these files in the build/lib folder. I am not sure what the reason is. Could anyone help me out with this?

Thanks

Was it helpful?

Solution

The manifest is about distribution, not about installation. You need to specify in setup.py what to install and WHERE:

setup(...,
  data_files=[(whereto1, [file1, file2]),
              (whereto2, [file3])]
 )

See http://docs.python.org/3/distutils/setupscript.html#installing-additional-files

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top