Reputation: 1447
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.
Upvotes: 3
Views: 6094
Reputation: 14863
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
Upvotes: 0
Reputation: 80761
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.
Upvotes: 5