Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Where to put what when installing a python program?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Off the Wall
View previous topic :: View next topic  
Author Message
ichbinsisyphos
Guru
Guru


Joined: 08 Dec 2006
Posts: 547

PostPosted: Thu Nov 29, 2012 2:15 pm    Post subject: Where to put what when installing a python program? Reply with quote

I'd like to professionalize my own programs a little, with make files at least for install and uninstall, maybe ebuilds and a local portage tree instead of running them all from a folder in $home.

But how is that done best? Create a folder in /usr/local/lib/<program-name> and put all modules there? What about icons, artwork for buttons and stuff? /usr/share? Doesn't sound like a good idea, but the best I can come up with.

There are ways to put artwork into binaries, but what do you do with scripts? There are ways to include them in the scripts too, but they are hackish at best.
Back to top
View user's profile Send private message
Dr.Willy
Guru
Guru


Joined: 15 Jul 2007
Posts: 343
Location: NRW, Germany

PostPosted: Thu Nov 29, 2012 2:53 pm    Post subject: Reply with quote

Just look at other packages and see how they do it :P

for instance:
Code:
~ # cave contents picard
/usr
/usr/lib64
/usr/lib64/python2.7
/usr/lib64/python2.7/site-packages
/usr/lib64/python2.7/site-packages/picard
/usr/lib64/python2.7/site-packages/picard/resources.py
/usr/lib64/python2.7/site-packages/picard/puidmanager.py
/usr/lib64/python2.7/site-packages/picard/webservice.py
/usr/lib64/python2.7/site-packages/picard/log.py
/usr/lib64/python2.7/site-packages/picard/__init__.py
/usr/lib64/python2.7/site-packages/picard/similarity.py
/usr/lib64/python2.7/site-packages/picard/script.py
/usr/lib64/python2.7/site-packages/picard/artist.py
/usr/lib64/python2.7/site-packages/picard/tagger.py
/usr/lib64/python2.7/site-packages/picard/const.py
/usr/lib64/python2.7/site-packages/picard/dataobj.py
/usr/lib64/python2.7/site-packages/picard/acoustidmanager.py
/usr/lib64/python2.7/site-packages/picard/cluster.py
/usr/lib64/python2.7/site-packages/picard/mbxml.py
/usr/lib64/python2.7/site-packages/picard/metadata.py
/usr/lib64/python2.7/site-packages/picard/album.py
/usr/lib64/python2.7/site-packages/picard/disc.py
/usr/lib64/python2.7/site-packages/picard/file.py
/usr/lib64/python2.7/site-packages/picard/plugin.py
/usr/lib64/python2.7/site-packages/picard/parsefilename.py
/usr/lib64/python2.7/site-packages/picard/acoustid.py
/usr/lib64/python2.7/site-packages/picard/config.py
/usr/lib64/python2.7/site-packages/picard/track.py
/usr/lib64/python2.7/site-packages/picard/browser
/usr/lib64/python2.7/site-packages/picard/browser/__init__.py
/usr/lib64/python2.7/site-packages/picard/browser/browser.py
/usr/lib64/python2.7/site-packages/picard/browser/filelookup.py
/usr/lib64/python2.7/site-packages/picard/ui
/usr/lib64/python2.7/site-packages/picard/ui/ui_options_cover.py
/usr/lib64/python2.7/site-packages/picard/ui/options
/usr/lib64/python2.7/site-packages/picard/ui/options/matching.py
/usr/lib64/python2.7/site-packages/picard/ui/options/__init__.py
/usr/lib64/python2.7/site-packages/picard/ui/options/fingerprinting.py
/usr/lib64/python2.7/site-packages/picard/ui/options/renaming.py
/usr/lib64/python2.7/site-packages/picard/ui/options/folksonomy.py
/usr/lib64/python2.7/site-packages/picard/ui/options/advanced.py
/usr/lib64/python2.7/site-packages/picard/ui/options/scripting.py
/usr/lib64/python2.7/site-packages/picard/ui/options/tags.py
/usr/lib64/python2.7/site-packages/picard/ui/options/cdlookup.py
/usr/lib64/python2.7/site-packages/picard/ui/options/interface.py
/usr/lib64/python2.7/site-packages/picard/ui/options/ratings.py
/usr/lib64/python2.7/site-packages/picard/ui/options/dialog.py
/usr/lib64/python2.7/site-packages/picard/ui/options/general.py
/usr/lib64/python2.7/site-packages/picard/ui/options/releases.py
/usr/lib64/python2.7/site-packages/picard/ui/options/about.py
/usr/lib64/python2.7/site-packages/picard/ui/options/metadata.py
/usr/lib64/python2.7/site-packages/picard/ui/options/cover.py
/usr/lib64/python2.7/site-packages/picard/ui/options/proxy.py
/usr/lib64/python2.7/site-packages/picard/ui/options/plugins.py
/usr/lib64/python2.7/site-packages/picard/ui/ui_options_general.py
/usr/lib64/python2.7/site-packages/picard/ui/ui_options_interface.py
/usr/lib64/python2.7/site-packages/picard/ui/__init__.py
/usr/lib64/python2.7/site-packages/picard/ui/ui_options_releases.py
/usr/lib64/python2.7/site-packages/picard/ui/ui_options_cdlookup_select.py
/usr/lib64/python2.7/site-packages/picard/ui/ui_passworddialog.py
/usr/lib64/python2.7/site-packages/picard/ui/infodialog.py
/usr/lib64/python2.7/site-packages/picard/ui/ui_puidsubmit.py
/usr/lib64/python2.7/site-packages/picard/ui/ui_options_about.py
/usr/lib64/python2.7/site-packages/picard/ui/passworddialog.py
/usr/lib64/python2.7/site-packages/picard/ui/ui_tagsfromfilenames.py
/usr/lib64/python2.7/site-packages/picard/ui/ui_options_script.py
/usr/lib64/python2.7/site-packages/picard/ui/coverartbox.py
/usr/lib64/python2.7/site-packages/picard/ui/util.py
/usr/lib64/python2.7/site-packages/picard/ui/ui_options_folksonomy.py
/usr/lib64/python2.7/site-packages/picard/ui/ui_infodialog.py
/usr/lib64/python2.7/site-packages/picard/ui/filebrowser.py
/usr/lib64/python2.7/site-packages/picard/ui/ui_options_proxy.py
/usr/lib64/python2.7/site-packages/picard/ui/item.py
/usr/lib64/python2.7/site-packages/picard/ui/ui_options_plugins.py
/usr/lib64/python2.7/site-packages/picard/ui/ui_edittagdialog.py
/usr/lib64/python2.7/site-packages/picard/ui/ui_cdlookup.py
/usr/lib64/python2.7/site-packages/picard/ui/edittagdialog.py
/usr/lib64/python2.7/site-packages/picard/ui/ui_options_fingerprinting.py
/usr/lib64/python2.7/site-packages/picard/ui/cdlookup.py
/usr/lib64/python2.7/site-packages/picard/ui/logview.py
/usr/lib64/python2.7/site-packages/picard/ui/ui_options_cdlookup.py
/usr/lib64/python2.7/site-packages/picard/ui/ui_options_renaming.py
/usr/lib64/python2.7/site-packages/picard/ui/ui_options_metadata.py
/usr/lib64/python2.7/site-packages/picard/ui/metadatabox.py
/usr/lib64/python2.7/site-packages/picard/ui/mainwindow.py
/usr/lib64/python2.7/site-packages/picard/ui/tagsfromfilenames.py
/usr/lib64/python2.7/site-packages/picard/ui/ui_options_ratings.py
/usr/lib64/python2.7/site-packages/picard/ui/ui_options_tags.py
/usr/lib64/python2.7/site-packages/picard/ui/itemviews.py
/usr/lib64/python2.7/site-packages/picard/ui/ui_options.py
/usr/lib64/python2.7/site-packages/picard/ui/ui_options_matching.py
/usr/lib64/python2.7/site-packages/picard/ui/ratingwidget.py
/usr/lib64/python2.7/site-packages/picard/ui/puidsubmit.py
/usr/lib64/python2.7/site-packages/picard/util
/usr/lib64/python2.7/site-packages/picard/util/astrcmp.so
/usr/lib64/python2.7/site-packages/picard/util/queue.py
/usr/lib64/python2.7/site-packages/picard/util/__init__.py
/usr/lib64/python2.7/site-packages/picard/util/icontheme.py
/usr/lib64/python2.7/site-packages/picard/util/tags.py
/usr/lib64/python2.7/site-packages/picard/util/thread.py
/usr/lib64/python2.7/site-packages/picard/util/mimetype.py
/usr/lib64/python2.7/site-packages/picard/util/cdrom.py
/usr/lib64/python2.7/site-packages/picard/util/webbrowser2.py
/usr/lib64/python2.7/site-packages/picard/formats
/usr/lib64/python2.7/site-packages/picard/formats/mutagenext
/usr/lib64/python2.7/site-packages/picard/formats/mutagenext/__init__.py
/usr/lib64/python2.7/site-packages/picard/formats/mutagenext/tak.py
/usr/lib64/python2.7/site-packages/picard/formats/mutagenext/compatid3.py
/usr/lib64/python2.7/site-packages/picard/formats/asf.py
/usr/lib64/python2.7/site-packages/picard/formats/__init__.py
/usr/lib64/python2.7/site-packages/picard/formats/mp4.py
/usr/lib64/python2.7/site-packages/picard/formats/wav.py
/usr/lib64/python2.7/site-packages/picard/formats/vorbis.py
/usr/lib64/python2.7/site-packages/picard/formats/id3.py
/usr/lib64/python2.7/site-packages/picard/formats/apev2.py
/usr/lib64/python2.7/site-packages/picard/musicdns
/usr/lib64/python2.7/site-packages/picard/musicdns/avcodec.so
/usr/lib64/python2.7/site-packages/picard/musicdns/ofa.so
/usr/lib64/python2.7/site-packages/picard/musicdns/__init__.py
/usr/lib64/python2.7/site-packages/picard/plugins
/usr/lib64/python2.7/site-packages/picard/plugins/__init__.py
/usr/lib64/python2.7/site-packages/picard-1.0-py2.7.egg-info
/usr/bin
/usr/bin/picard
/usr/bin/picard-2.7
/usr/share
/usr/share/doc
/usr/share/doc/picard-1.0/AUTHORS.txt
/usr/share/doc/picard-1.0/NEWS.txt
/usr/share/doc/picard-1.0
/usr/share/pixmaps
/usr/share/pixmaps/picard.ico
/usr/share/applications
/usr/share/applications/picard.desktop
/usr/share/icons
/usr/share/icons/hicolor
/usr/share/icons/hicolor/48x48
/usr/share/icons/hicolor/48x48/apps
/usr/share/icons/hicolor/48x48/apps/picard.png
/usr/share/icons/hicolor/32x32
/usr/share/icons/hicolor/32x32/apps
/usr/share/icons/hicolor/32x32/apps/picard.png
/usr/share/icons/hicolor/256x256
/usr/share/icons/hicolor/256x256/apps
/usr/share/icons/hicolor/256x256/apps/picard.png
/usr/share/icons/hicolor/128x128
/usr/share/icons/hicolor/128x128/apps
/usr/share/icons/hicolor/128x128/apps/picard.png
/usr/share/icons/hicolor/16x16
/usr/share/icons/hicolor/16x16/apps
/usr/share/icons/hicolor/16x16/apps/picard.png
/usr/share/icons/hicolor/24x24
/usr/share/icons/hicolor/24x24/apps
/usr/share/icons/hicolor/24x24/apps/picard.png
/usr/share/locale
/usr/share/locale/et
/usr/share/locale/et/LC_MESSAGES
/usr/share/locale/et/LC_MESSAGES/picard.mo
/usr/share/locale/en
/usr/share/locale/en/LC_MESSAGES
/usr/share/locale/en/LC_MESSAGES/picard.mo
/usr/share/locale/de
/usr/share/locale/de/LC_MESSAGES
/usr/share/locale/de/LC_MESSAGES/picard.mo
/usr/share/locale/nl
/usr/share/locale/nl/LC_MESSAGES
/usr/share/locale/nl/LC_MESSAGES/picard.mo
/usr/share/locale/it
/usr/share/locale/it/LC_MESSAGES
/usr/share/locale/it/LC_MESSAGES/picard.mo
/usr/share/locale/pl
/usr/share/locale/pl/LC_MESSAGES
/usr/share/locale/pl/LC_MESSAGES/picard.mo
/usr/share/locale/pt_BR
/usr/share/locale/pt_BR/LC_MESSAGES
/usr/share/locale/pt_BR/LC_MESSAGES/picard.mo
/usr/share/locale/es
/usr/share/locale/es/LC_MESSAGES
/usr/share/locale/es/LC_MESSAGES/picard.mo
/usr/share/locale/fi
/usr/share/locale/fi/LC_MESSAGES
/usr/share/locale/fi/LC_MESSAGES/picard.mo
/usr/share/locale/fr
/usr/share/locale/fr/LC_MESSAGES
/usr/share/locale/fr/LC_MESSAGES/picard.mo
/usr/share/locale/en_GB
/usr/share/locale/en_GB/LC_MESSAGES
/usr/share/locale/en_GB/LC_MESSAGES/picard.mo
/usr/share/locale/sv
/usr/share/locale/sv/LC_MESSAGES
/usr/share/locale/sv/LC_MESSAGES/picard.mo
/usr/share/locale/en_CA
/usr/share/locale/en_CA/LC_MESSAGES
/usr/share/locale/en_CA/LC_MESSAGES/picard.mo


Last edited by Dr.Willy on Thu Nov 29, 2012 2:56 pm; edited 1 time in total
Back to top
View user's profile Send private message
MustrumR
n00b
n00b


Joined: 15 Nov 2011
Posts: 55
Location: Right here

PostPosted: Thu Nov 29, 2012 2:54 pm    Post subject: Reply with quote

Data usually goes into /usr/[local/]share. For python, take a look at distutils. http://docs.python.org/3/distutils/index.html
Gentoo has a distutils eclass so a simple ebuild can look like this:
Code:

EAPI=5
SUPPORT_PYTHON_ABIS=1
inherit distutils

DESCRIPTION="..."
HOMEPAGE="..."
SRC_URI="..."

SLOT="0"
KEYWORDS="..."
IUSE=""
DEPEND=""
Back to top
View user's profile Send private message
ichbinsisyphos
Guru
Guru


Joined: 08 Dec 2006
Posts: 547

PostPosted: Thu Nov 29, 2012 3:31 pm    Post subject: Reply with quote

/usr/share sucks, you are supposed to show me a better way :P

distutils looks interesting, will take some time to chew through that though.
Back to top
View user's profile Send private message
MustrumR
n00b
n00b


Joined: 15 Nov 2011
Posts: 55
Location: Right here

PostPosted: Thu Nov 29, 2012 3:40 pm    Post subject: Reply with quote

/usr/share is intended to be used for putting data like icons/artwork. Why should it suck?
Back to top
View user's profile Send private message
ichbinsisyphos
Guru
Guru


Joined: 08 Dec 2006
Posts: 547

PostPosted: Thu Nov 29, 2012 3:44 pm    Post subject: Reply with quote

/usr/share/ is for documentation and other weird, optional stuff. The idea that the program reads images to put on buttons from there each startup makes my stomach turn over.
Back to top
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 16112
Location: Colorado

PostPosted: Thu Nov 29, 2012 4:43 pm    Post subject: Reply with quote

GNOME has been putting it there for as long as I recall. What makes you think it shouldn't be there? That is, why is it not "other weird stuff"?
_________________
lolgov. 'cause where we're going, you don't have civil liberties.

In Loving Memory
1787 - 2008
Back to top
View user's profile Send private message
Dr.Willy
Guru
Guru


Joined: 15 Jul 2007
Posts: 343
Location: NRW, Germany

PostPosted: Thu Nov 29, 2012 5:26 pm    Post subject: Reply with quote

ichbinsisyphos wrote:
/usr/share/ is for documentation and other weird, optional stuff. The idea that the program reads images to put on buttons from there each startup makes my stomach turn over.

The idea that the program reads images to put on buttons makes my stomach turn over.
Back to top
View user's profile Send private message
Prenj
n00b
n00b


Joined: 20 Nov 2011
Posts: 13

PostPosted: Thu Nov 29, 2012 5:33 pm    Post subject: Reply with quote

if you are installing in /usr space, it's binaries in /usr/bin and libs in /usr/lib/python-version/package-name/
or if you want separation from whatever it is on a machine, you can go old-school way and put it in /opt/package/bin and lib, respectively
Back to top
View user's profile Send private message
ichbinsisyphos
Guru
Guru


Joined: 08 Dec 2006
Posts: 547

PostPosted: Thu Nov 29, 2012 5:40 pm    Post subject: Reply with quote

Dr.Willy wrote:
ichbinsisyphos wrote:
/usr/share/ is for documentation and other weird, optional stuff. The idea that the program reads images to put on buttons from there each startup makes my stomach turn over.

The idea that the program reads images to put on buttons makes my stomach turn over.
Do you like text written on buttons or are the buttons the problem?

I just tried some fun stuff. __init__.py was new to me ... directories containing such a file can be threatened like modules. If I rename the main executable to __main__.py, the whole directory can be passed to the interpreter. Zipped up and concatenated with "#!/usr/bin/env python" the zip archive, containing the whole directory structure, modules and whatever it needs, can be executed directly.
Back to top
View user's profile Send private message
Dr.Willy
Guru
Guru


Joined: 15 Jul 2007
Posts: 343
Location: NRW, Germany

PostPosted: Thu Nov 29, 2012 6:06 pm    Post subject: Reply with quote

ichbinsisyphos wrote:
Dr.Willy wrote:
ichbinsisyphos wrote:
/usr/share/ is for documentation and other weird, optional stuff. The idea that the program reads images to put on buttons from there each startup makes my stomach turn over.

The idea that the program reads images to put on buttons makes my stomach turn over.
Do you like text written on buttons or are the buttons the problem?

Yeah, its the buttons.
I generally prefer shell programs. If thats not feasable, whats wrong with good old hotkeys?
Back to top
View user's profile Send private message
notageek
Tux's lil' helper
Tux's lil' helper


Joined: 05 Jun 2008
Posts: 120
Location: Bangalore, India

PostPosted: Thu Nov 29, 2012 6:08 pm    Post subject: Reply with quote

You needn't worry, a python program knows where to put itself.
_________________
The problem is not the problem. The problem is your attitude about the problem. Do you understand? --Capt Jack Sparrow.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Off the Wall All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum