3

I'm trying to build my program on the OBS. Could you please tell me what the setup.py should look like to create a folder structure, for example if I have this:

../MyProgram
COPYING
README
mainscript.pyw
/applications
    /app1
        /icons
            pic1.png
        app1.py
    /app2
        /icons
            pic2.png
        /scripts
            script1.py
            script2.py
        app2.py

etc.

I read the Python Docs, played with 'package_dir', 'packages' but the OBS still gives me errors it can't find the icon files. I guess the setup script doesn't create them. And when I tried to build an rpm locally, it gave me the same error. When I looked in the BUILD folder, there was no folder 'applications' created and nothing below it.

Will really appreciate your help. Please provide an example. Thank you.

2 Answers 2

5

You can try to add in your MANIFEST.in the following line :

recursive-include applications *.png

to include all the icons.

To embed your python files, try to explicitly declare your packages like this :

setup(
   packages=[
      "applications",
      "applications.app1",
      "applications.app2",
      "applications.app2.scripts",
   ],
   data_files=[    # declare the list of  data_files (destination directory, (data files))
      ("applications/app1/icons", ("applications/app1/icons/pic1.png",)),
      ("applications/app2/icons", ("applications/app2/icons/pic2.png",)),
   ]
   .... # your other setup options (name, version...)
)

but you'll have to put __init__.py files under each directory to allow python to take them as packages.

Sign up to request clarification or add additional context in comments.

1 Comment

why not use graft?
0

I found help here: https://wiki.python.org/moin/Distutils/Tutorial

You create a Manifest.in file for the files you like to include:

recursive-include applications/app1/icons *.png
recursive-include applications/app2/icons *.png

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.