Re: howto pack python programs
for more information you might refer to http://www.debian.org/doc/packaging-manuals/python-policy/ which is Debian Python Policy Abstract This document describes the packaging of Python within the Debian GNU/Linux distribution and the policy requirements for packaged Python programs and modules. -- .-. =-- /v\ = Keep in touch// \\ (yoh@|www.)onerussian.com Yaroslav Halchenko /( )\ ICQ#: 60653192 Linux User^^-^^[17] -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: howto pack python programs
On Sun, Mar 26, 2006 at 07:15:12PM +0200, Volker Grabsch wrote: > setup(name='MyProgs tools', > version='1.0', > description='cool progs', > author='Bastian Venthur', > author_email='[EMAIL PROTECTED]', > url='http://my-cool.progs.invalid/', > > packages=['myprog'], > Sorry, I forgot: scripts=['ex1.py', 'ex2.py', ...], > ) Greets, Volker -- Volker Grabsch ---<<(())>>--- Administrator NotJustHosting GbR -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: howto pack python programs
On Sun, Mar 26, 2006 at 04:33:37PM +0200, Bastian Venthur wrote: > Is the location /usr/share/$PACKAGE OK? Should I create the symlinks > without the py-extension, like: > /usr/bin/ex1 -> /u/s/ex1.py I think this is the better solution. A "/usr/bin/ex1.py" would take away some freedom. Maybe you decide later to use a wrapper script /usr/bin/ex1 (shell script or python script). However, there's even a more portable, generic, better solution I'll try to explain. > Next problem, lintian is complaining (W) about non-executable scripts in > /usr/share/$PACKAGE -- can I ignore this? You shouldn't. I don't believe that your Python code really belongs there. You should consider providing a setup.py script, and use this to install your code. But I'm not sure whether this is in the spirit of the Debian Python policy. setup.py would install your python code into: ...usr/lib/python2.3/site-packages/ To avoid cluttering the "site-packages/" you may consider using a "python package", i.e. a sub directory containing your *.py files. I suggest you to layout your source directory like this: myprog/foo.py myprog/baz.py myprog/ex1.py myprog/ex2.py myprog/ex3.py setup.py ex1.py ex2.py ex3.py Where ex*.py are executable and myprog/ex*.py aren't. The ex*.py are wrappers that look like this: #!/usr/bin/env python import myprog.ex3 or like this, depending on your code: #!/usr/bin/env python import myprog.ex3 myprog.ex3.main() These wrappers may be able to run from the source directory as well as from /usr/bin/ (provided that your myprog/ package is installed to .../site-packages/) However, if your myprog/ex*.py file *are* currently just wrappers to the functionality of foo.py, baz.py, etc., then just put them directly into your source package an install them to /usr/bin, i.e. myprog/foo.py myprog/baz.py setup.py ex1.py ex2.py ex3.py Everything I described until here has nothing to do with Debian, it's just to provide a source package for general use. Maybe there are better recommendations in the net, "best practices". If you find some, please let me know, I didn't find any. :-) For Debian, put the ex*.py files to /usr/bin/ex* (without ".py") and the rest to whatever setup.py recommends, i.e. just do: ./setup.py install --prefix="debian/tmp/usr" If your setup.py looks like this: #!/usr/bin/env python from distutils.core import setup setup(name='MyProgs tools', version='1.0', description='cool progs', author='Bastian Venthur', author_email='[EMAIL PROTECTED]', url='http://my-cool.progs.invalid/', packages=['myprog'], ) ... then it will install your modules to .../site-packages/myprog/* and your ex*.py files to .../usr/bin/. Distutils will also adjust the sh'bang line of your ex*.py to the current interpreter location. However, it won't rename your ex*.py to ex*, so you'd have to do this in your "debian/myprog.install" with something like this: usr/lib/python* usr/bin/ex1.py usr/bin/ex1 (maybe ... I'm not sure) see also: http://docs.python.org/inst/ http://docs.python.org/dist/ Whatever you do, I'm very interested in your result. I'll have a similar challenge to master when I find more time. My current recommendations on a similar problem can be found at: http://wiki.python.de/Pfade_f%C3%BCr_Dateien (how to deal with non-python files, where to put them, etc. in a platform independent manner) It's currently only in german, but I'd translate this if someone is interested. Greets, Volker -- Volker Grabsch ---<<(())>>--- Administrator NotJustHosting GbR -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: howto pack python programs
On Sun, Mar 26, 2006 at 04:33:37PM +0200, Bastian Venthur wrote: > Hi Mentors, > > I'm currently working on a program written in python. The source-tree > looks like this: > > foo.py > bar.py > baz.py > ex1.py > ex2.py > ex3.py > > where ex*.py are executables and the others not. My question is, where > to put all these files and what should I do with the executables? > > My current idea is: > - copy all *.py into /usr/share/$PACKAGE/ > - create symlinks like > /u/s/p/ex1.py <- /usr/bin/ex1.py > /u/s/p/ex2.py <- /usr/bin/ex2.py > /u/s/p/ex3.py <- /usr/bin/ex3.py > > Is the location /usr/share/$PACKAGE OK? Looks good to me. > Should I create the symlinks > without the py-extension, like: > /usr/bin/ex1 -> /u/s/ex1.py The suggestion is that stuff in /usr/bin/ shouldn't have an extension on it, in case the implementation (but not the interface or behavior) changes. So /usr/bin/foo.sh might get rewritten as /usr/bin/foo.pl, which is a pain for people who hardcoded foo.sh into their scripts (whether they're scripts for Debian or not). /usr/bin/foo is preferred. > Next problem, lintian is complaining (W) about non-executable scripts in > /usr/share/$PACKAGE -- can I ignore this? If it is meant to be run directly, then it should be executable; otherwise, it should not. http://lists.debian.org/debian-mentors/2004/03/msg00077.html Justin -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: howto pack python programs
Bastian Venthur wrote: > Hi Mentors, > > I'm currently working on a program written in python. The source-tree > looks like this: > > foo.py > bar.py > baz.py > ex1.py > ex2.py > ex3.py > > where ex*.py are executables and the others not. My question is, where > to put all these files and what should I do with the executables? > > My current idea is: > - copy all *.py into /usr/share/$PACKAGE/ > - create symlinks like > /u/s/p/ex1.py <- /usr/bin/ex1.py > /u/s/p/ex2.py <- /usr/bin/ex2.py > /u/s/p/ex3.py <- /usr/bin/ex3.py > > Is the location /usr/share/$PACKAGE OK? Should I create the symlinks > without the py-extension, like: > /usr/bin/ex1 -> /u/s/ex1.py > > Next problem, lintian is complaining (W) about non-executable scripts in > /usr/share/$PACKAGE -- can I ignore this? > > BTW: I already know and use dh_python. > > > Kind regards > > Bastian > > Take a look at my releaseforge packages (in Etch/Sid). You might even be able to rip off the debian/ directory from my package and modify it to fit your needs. -Roberto -- Roberto C. Sanchez http://familiasanchez.net/~roberto signature.asc Description: OpenPGP digital signature
howto pack python programs
Hi Mentors, I'm currently working on a program written in python. The source-tree looks like this: foo.py bar.py baz.py ex1.py ex2.py ex3.py where ex*.py are executables and the others not. My question is, where to put all these files and what should I do with the executables? My current idea is: - copy all *.py into /usr/share/$PACKAGE/ - create symlinks like /u/s/p/ex1.py <- /usr/bin/ex1.py /u/s/p/ex2.py <- /usr/bin/ex2.py /u/s/p/ex3.py <- /usr/bin/ex3.py Is the location /usr/share/$PACKAGE OK? Should I create the symlinks without the py-extension, like: /usr/bin/ex1 -> /u/s/ex1.py Next problem, lintian is complaining (W) about non-executable scripts in /usr/share/$PACKAGE -- can I ignore this? BTW: I already know and use dh_python. Kind regards Bastian -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]