Reply
Thread Tools
Posts: 402 | Thanked: 229 times | Joined on Nov 2009 @ Missouri, USA
#1
I'm trying to figure out the proper way to package my aptly for distribution. Following the Py2deb wiki article, I came up with the following src structure:
Code:

/usr/bin/aptly
/usr/lib/aptly/
/usr/lib/aptly/aptly.py
/usr/lib/aptly/aptly-curses.py
/usr/share/doc/aptly
/usr/share/doc/aptly/README
/usr/share/doc/aptly/COPYING
It then dawned on me that aptly.py can be imported as a module in order to add a GUI to it (the strategy I'm using with aptly-curses.py), so it would need to be accessible by other python scripts. As such, I changed the above to the following:
Code:
/usr/lib/python2.5/site-packages/aptly.py
/usr/share/doc/aptly
/usr/share/doc/aptly/CHANGES
/usr/share/doc/aptly/README
/usr/bin/aptly
This leaves me with a few questions:
  1. To invoke the curses (or any GUI for that matter, should a) I place the appropriate script (for example aptly-curses.py) in /usr/bin as a python script or should I b) add that script to site-packages/aptly and write a script that calls it into /usr/bin?
  2. To call the command line variant, would I just make the /usr/bin/aptly script a bash script that calls the module passing it all arguments?
  3. Should the license and other documentation remain in /usr/share/doc/aptly, or should everything be moved (including aptly.py) to a directory named aptly under site-packagres instead?
Until I figure this out, I'm placing everything in site-packages except for aptly-curses
__________________
aspidites | blog | aspidites@inbox.com
 

The Following 2 Users Say Thank You to aspidites For This Useful Post:
Jaffa's Avatar
Posts: 2,535 | Thanked: 6,681 times | Joined on Mar 2008 @ UK
#2
Your basic structure looks fine.

Your /usr/bin "launchers" can either be shell scripts which launch Python appropriately; Python scripts (without a trailing .py), or symlinks to wherever you want.

I've typically used the former. Remember, as a Python app, anything you put in /usr/lib/python2.5 will automatically be put outside of the rootfs, but anything else will be inside it - and so you'll want to minimise the disk usage.
__________________
Andrew Flegg -- mailto:andrew@bleb.org | http://www.bleb.org
 

The Following 2 Users Say Thank You to Jaffa For This Useful Post:
Posts: 402 | Thanked: 229 times | Joined on Nov 2009 @ Missouri, USA
#3
Ok. So I've decided to put everything except for a shell script that calls aptly inside site-packages like so:
Code:
/usr/lib/python2.5/site-packages/aptly
/usr/lib/python2.5/site-packages/aptly/aptly.py
/usr/lib/python2.5/site-packages/aptly/COPYING
/usr/lib/python2.5/site-packages/aptly/CHANGES

/usr/bin/aptly
/usr/bin/aptly contains the following:
Code:
!#/bin/bash

exec /usr/lib/python2.5/site-packages/aptly/aptly.py $@
__________________
aspidites | blog | aspidites@inbox.com
 
Posts: 3,428 | Thanked: 2,856 times | Joined on Jul 2008
#4
I don't know about the N900... but usually it's recommended in shell scripts to use #!/bin/sh ... for compatibility purposes with systems that either don't have bash, or have it in a different location.

At least.. that's what I've been told before..

(assuming you don't use bash-specific calls)
__________________
If I've helped you or you use any of my packages feel free to help me out.
-----------------------------------------------------------------------------------
Maintaining:
pyRadio - Pandora Radio on your N900, N810 or N800!
 

The Following User Says Thank You to fatalsaint For This Useful Post:
Posts: 486 | Thanked: 251 times | Joined on Oct 2009
#5
Originally Posted by fatalsaint View Post
I don't know about the N900... but usually it's recommended in shell scripts to use #!/bin/sh ... for compatibility purposes with systems that either don't have bash, or have it in a different location.

At least.. that's what I've been told before..

(assuming you don't use bash-specific calls)
Also, bash is not installed by default on the n900.
 

The Following User Says Thank You to j.s For This Useful Post:
Posts: 3,428 | Thanked: 2,856 times | Joined on Jul 2008
#6
That is definitely a handy piece of information...
__________________
If I've helped you or you use any of my packages feel free to help me out.
-----------------------------------------------------------------------------------
Maintaining:
pyRadio - Pandora Radio on your N900, N810 or N800!
 
Posts: 402 | Thanked: 229 times | Joined on Nov 2009 @ Missouri, USA
#7
Doh! can you tell i don't write shell scripts?

Thanks again, third time's a charm
__________________
aspidites | blog | aspidites@inbox.com
 
Jaffa's Avatar
Posts: 2,535 | Thanked: 6,681 times | Joined on Mar 2008 @ UK
#8
Originally Posted by aspidites View Post
/usr/bin/aptly contains the following:
Code:
!#/bin/bash

exec /usr/lib/python2.5/site-packages/aptly/aptly.py $@
You want this to be:

Code:
#!/bin/sh

exec /usr/lib/python2.5/site-packages/aptly/aptly.py "$@"
  1. Note "#!" rather than "!#"
  2. bash vs. sh already mentioned
  3. "$@" will ensure that any parameters containing spaces will be quoted properly.
__________________
Andrew Flegg -- mailto:andrew@bleb.org | http://www.bleb.org
 

The Following 3 Users Say Thank You to Jaffa For This Useful Post:
Posts: 402 | Thanked: 229 times | Joined on Nov 2009 @ Missouri, USA
#9
i had the # before ! in the actual code. it was a typo. good point about the qoutes though
__________________
aspidites | blog | aspidites@inbox.com
 
Reply


 
Forum Jump


All times are GMT. The time now is 06:53.