Re: Python modules not installed correctly with pycentral

2008-01-08 Thread Ben Finney
Vincent Bernat [EMAIL PROTECTED] writes:

 OK. Therefore, if we use pure debhelper :
  - depends on debhelper (= 5.0.44)

That is, Build-Depends: debhelper (= 5.0.44).

  - set debian/compat to 6
  - add a lintian override for this

I get no error from 'lintian' for this. Rather, an error from 'linda':

E: gracie; DH_COMPAT is greater than the major version of debhelper 
depended on.

What should I be doing about this?

  - call first dh_pysupport (or dh_pycentral) then dh_installinit

Thanks for this explanation, it's a very helpful summary of the
discussion.

-- 
 \Good morning, Pooh Bear, said Eeyore gloomily. If it is a |
  `\  good morning, he said. Which I doubt, said he. —A. A. |
_o__) Milne, _Winnie-the-Pooh_ |
Ben Finney


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: Python modules not installed correctly with pycentral

2008-01-08 Thread Vincent Bernat
OoO En cette matinée pluvieuse du mardi 08 janvier 2008, vers 10:34, Ben
Finney [EMAIL PROTECTED] disait:

 - set debian/compat to 6
 - add a lintian override for this

 I get no error from 'lintian' for this.

Try with -vIi.

 Rather, an error from 'linda':

 E: gracie; DH_COMPAT is greater than the major version of debhelper 
 depended on.

 What should I be doing about this?

Isuppose   thatalintian   overrideworks   too.Create
debian/source.lintian-overrides with:
yourpackage source: package-lacks-versioned-build-depends-on-debhelper 6
-- 
Choose variable names that won't be confused.
- The Elements of Programming Style (Kernighan  Plauger)


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: Python modules not installed correctly with pycentral

2008-01-07 Thread Josselin Mouette
Le lundi 07 janvier 2008 à 07:56 +0100, Vincent Bernat a écrit :
 Well, if you can change the order for postinst, you will get wrong order
 in prerm.

debhelper (5.0.44) unstable; urgency=low

  * prerm and postrm scripts are now generated in a reverse order than
preinst and postinst scripts. For example, if a package uses
dh_pysupport before dh_installinit, the prerm will first stop the init
script and then remove the python files.

-- 
 .''`.
: :' :  We are debian.org. Lower your prices, surrender your code.
`. `'   We will add your hardware and software distinctiveness to
  `-our own. Resistance is futile.


signature.asc
Description: Ceci est une partie de message	numériquement signée


Re: Python modules not installed correctly with pycentral

2008-01-07 Thread Vincent Bernat
OoO  Pendant le  temps de  midi du  lundi 07  janvier 2008,  vers 12:50,
Pierre Habouzit [EMAIL PROTECTED] disait:

  Le lundi 07 janvier 2008 à 07:56 +0100, Vincent Bernat a écrit :
  Well, if you can change the order for postinst, you will get wrong order
  in prerm.
  
  debhelper (5.0.44) unstable; urgency=low
  
* prerm and postrm scripts are now generated in a reverse order than
  preinst and postinst scripts. For example, if a package uses
  dh_pysupport before dh_installinit, the prerm will first stop the
 init
  script and then remove the python files.
 
 Good news. I will check that it works and propose to close the bug I cited
 in another message.

   It does work.

I  have just  tested and  #386970 is  still present  with  py_support at
least. In postinst, I have  first the snippet by dh_installinit and then
the snippet by dh_pysupport. In prerm, I have exactly the same thing.

I have tested on a dummy package with just debhelper and I have the same
bug.

You can check the attached tar.gz. Here is the postinst I get:

8--
#!/bin/sh 
set -e
# Automatically added by dh_installinit
if [ -x /etc/init.d/test-debhelper ]; then
update-rc.d test-debhelper defaults /dev/null
if [ -x `which invoke-rc.d 2/dev/null` ]; then
invoke-rc.d test-debhelper start || exit $?
else
/etc/init.d/test-debhelper start || exit $?
fi
fi
# End automatically added section
# Automatically added by dh_pysupport
if which update-python-modules /dev/null 21; then
update-python-modules  test-debhelper.dirs
fi
# End automatically added section
8--

And the prerm:

8--
#!/bin/sh
set -e
# Automatically added by dh_installinit
if [ -x /etc/init.d/test-debhelper ]; then
if [ -x `which invoke-rc.d 2/dev/null` ]; then
invoke-rc.d test-debhelper stop || exit $?
else
/etc/init.d/test-debhelper stop || exit $?
fi
fi
# End automatically added section
# Automatically added by dh_pysupport
if which update-python-modules /dev/null 21; then
update-python-modules -c  test-debhelper.dirs
fi
# End automatically added section
8--

+++-==-==-
ii  debhelper  5.0.63 helper programs for debian/rules



pgptL7VcpILb8.pgp
Description: PGP signature


debhelper-python.tar.gz
Description: Binary data
-- 
I WILL NOT PLEDGE ALLEGIANCE TO BART
I WILL NOT PLEDGE ALLEGIANCE TO BART
I WILL NOT PLEDGE ALLEGIANCE TO BART
-+- Bart Simpson on chalkboard in episode 7F09


Re: Python modules not installed correctly with pycentral

2008-01-07 Thread Vincent Bernat
OoO Lors de la soirée naissante du lundi 07 janvier 2008, vers 18:52, je
disais:

 I  have just  tested and  #386970 is  still present  with  py_support at
 least. In postinst, I have  first the snippet by dh_installinit and then
 the snippet by dh_pysupport. In prerm, I have exactly the same thing.

 I have tested on a dummy package with just debhelper and I have the same
 bug.

From the source  of debhelper, I see that the inversion  is done only at
compat level 6  or more. Putting 6 in debian/compat  makes the trick. Is
it the correct way of handling this since debhelper 0.6 does not exist?

Joey, for your reference, the thread starts here:
 http://lists.debian.org/debian-python/2008/01/msg00022.html

We discuss of this changelog entry:
 http://lists.debian.org/debian-python/2008/01/msg00029.html

If you can sched some light on me about this issue... ;-)
-- 
Don't compare floating point numbers just for equality.
- The Elements of Programming Style (Kernighan  Plauger)


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: Python modules not installed correctly with pycentral

2008-01-07 Thread Pierre Habouzit
On Mon, Jan 07, 2008 at 05:52:52PM +, Vincent Bernat wrote:
 OoO  Pendant le  temps de  midi du  lundi 07  janvier 2008,  vers 12:50,
 Pierre Habouzit [EMAIL PROTECTED] disait:
 
   Le lundi 07 janvier 2008 à 07:56 +0100, Vincent Bernat a écrit :
   Well, if you can change the order for postinst, you will get wrong order
   in prerm.
   
   debhelper (5.0.44) unstable; urgency=low
   
 * prerm and postrm scripts are now generated in a reverse order than
   preinst and postinst scripts. For example, if a package uses
   dh_pysupport before dh_installinit, the prerm will first stop the
  init
   script and then remove the python files.
  
  Good news. I will check that it works and propose to close the bug I cited
  in another message.
 
It does work.
 
 I  have just  tested and  #386970 is  still present  with  py_support at
 least. In postinst, I have  first the snippet by dh_installinit and then
 the snippet by dh_pysupport. In prerm, I have exactly the same thing.

  you need to use compat level 6 for that.

-- 
·O·  Pierre Habouzit
··O[EMAIL PROTECTED]
OOOhttp://www.madism.org


pgpL7wFn8jyko.pgp
Description: PGP signature


Re: Python modules not installed correctly with pycentral

2008-01-07 Thread Vincent Bernat
OoO En cette  soirée bien amorcée du lundi 07  janvier 2008, vers 22:12,
Pierre Habouzit [EMAIL PROTECTED] disait:

   debhelper (5.0.44) unstable; urgency=low
   
 * prerm  and postrm  scripts are  now generated  in  a reverse
   order than  preinst and postinst scripts. For  example, if a
   package uses  dh_pysupport before dh_installinit,  the prerm
   will first stop  the init script and then  remove the python
   files.
  
  Good news. I will check that it works and propose to close the bug I cited
  in another message.
 
It does work.
 
 I  have just  tested and  #386970 is  still present  with  py_support at
 least. In postinst, I have  first the snippet by dh_installinit and then
 the snippet by dh_pysupport. In prerm, I have exactly the same thing.

   you need to use compat level 6 for that.

OK. Therefore, if we use pure debhelper :
 - depends on debhelper (= 5.0.44)
 - set debian/compat to 6
 - add a lintian override for this
 - call first dh_pysupport (or dh_pycentral) then dh_installinit

And we use cdbs :
 - depends on debhelper (= 5.0.44)
 - set debian/compat to 6
 - add a lintian override for this
 - add this  in debian/rules to disallow first  run of dh_installinit to
   modify postinst/prerm/postrm scripts:
  DEB_DH_INSTALLINIT_ARGS := -n
 - add or modify binary-install/package target:
  binary-install/yourbinarypackage::
dh_installinit -p$(cdbs_curpkg)
   or (not tested):
  $(patsubst %,binary-install/%,$(DEB_PACKAGES)) :: binary-install/%:
dh_installinit -p$(cdbs_curpkg)

I don't know if make would allow to append something at the beginning of
an existing target to avoid such a silly work-around.

Thanks for your help.
-- 
BOFH excuse #238:
You did wha... oh _dear_


pgpbSESwSNm20.pgp
Description: PGP signature


Re: Python modules not installed correctly with pycentral

2008-01-07 Thread Vincent Bernat
OoO En cette  soirée bien amorcée du lundi 07  janvier 2008, vers 22:38,
je disais:

 And we use cdbs :
  - depends on debhelper (= 5.0.44)
  - set debian/compat to 6
  - add a lintian override for this
  - add this  in debian/rules to disallow first  run of dh_installinit to
modify postinst/prerm/postrm scripts:
   DEB_DH_INSTALLINIT_ARGS := -n
  - add or modify binary-install/package target:
   binary-install/yourbinarypackage::
   dh_installinit -p$(cdbs_curpkg)
or (not tested):
   $(patsubst %,binary-install/%,$(DEB_PACKAGES)) :: binary-install/%:
   dh_installinit -p$(cdbs_curpkg)

 I don't know if make would allow to append something at the beginning of
 an existing target to avoid such a silly work-around.

Or another  way to fix  this into cdbs  could be to  have a way  to tell
debhelper   that  we  want   postinst  built   in  reverse   order,  not
postrm/prerm. Some kind of  REVERSE environment variable that would tell
which  files  should  be  built  in  reverse  order  and  defaulting  to
prerm,postrm.
-- 
panic(floppy: Port bolixed.);
2.2.16 /usr/src/linux/include/asm-sparc/floppy.h


pgpnSPkdtseu1.pgp
Description: PGP signature


Re: Python modules not installed correctly with pycentral

2008-01-06 Thread Christopher Schmidt
On Mon, Jan 07, 2008 at 11:15:53AM +1100, Ben Finney wrote:
 The problem apparent when installing that .deb is that after
 installation the modules *only* exist in that pycentral path; they are
 never installed to the Python site-packages directory, and so the
 Python package can't be found by programs that try to import it.
 
 $ dpkg --install gracie_0.2.6-1_all.deb
 Selecting previously deselected package gracie.
 (Reading database ... 31561 files and directories currently installed.)
 Unpacking gracie (from .../gracie_0.2.6-1_all.deb) ...
 Setting up gracie (0.2.6-1) ...
 Starting Gracie OpenID provider:Traceback (most recent call last):
   File /usr/bin/gracied, line 18, in ?
 from gracie.server import become_daemon
 ImportError: No module named gracie.server
 invoke-rc.d: initscript gracie, action start failed.
 dpkg: error processing gracie (--install):
  subprocess post-installation script returned error exit status 1
 Errors were encountered while processing:
  gracie
 
 $ find /usr -name 'server.py' | grep gracie
 /usr/share/pycentral/gracie/site-packages/gracie/server.py
 
 
 What am I missing? I was under the impression that it was pycentral's
 task, at install time, to install the modules from
 '/usr/share/pycentral/gracie/' to the appropriate place for Python to
 import them. That's not happening though.

I don't have bzr installed at the moment, so I don't have a way to pull
your source and check, but it sounds to me like something is missing
from your rules scripts: I would typically expect that you would have
some dh_foo rule that would generate a postinst which is called as part
of your package, and that that postinst would do the installing.

Since it appears you have a *different* postinst, it's possible that you
need something like a #DEBHELPER# snippet in your existing postinst to
allow debhelper to actually put the files in the right place: when I was
missing this in the past, I got similar behavior (where the postinst in
my package was run, but the python-support postinst wasn't).

These are just hints -- I only started using python-support about two
weeks ago, and I've never used pycentral. I'm sure others on the list
can contribute more effectively. However, I think that it would probably
be worthwhile to look into whether the postinst in your package is what
you expect it to be -- and that expectation should probably include an
expectation that there is some pycentral related task run in postinst. 

Good luck,
-- 
Christopher Schmidt
MetaCarta


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Python modules not installed correctly with pycentral

2008-01-06 Thread Ben Finney
Howdy all,

In the thread Message-ID: [EMAIL PROTECTED], I
attempted to learn more about packaging software such that it conforms
both to Python conventions and Debian Python policy. I got some
helpful responses, but there seem to be fundamental problems that
weren't addressed. I'm asking again now, to try to fix them.

The package I'm creating is Gracie:

URL:http://cheeseshop.python.org/pypi/gracie/
URL:http://pypi.python.org/packages/source/g/gracie/gracie-0.2.6.tar.gz

When I create the Python package independently, with './setup.py
bdist_egg', the resulting egg file contains all the modules and
programs for the package. The program '/usr/bin/gracied' is able to
import the 'gracie' package modules, and it runs successfully. So far
so good.


I'm packaging it for Debian, and am trying to learn how this is best
done. My Bazaar branch for the Debian package can be obtained, and a
Debian binary package built:

$ bzr branch http://vcs.whitetree.org/bzr/public/gracie/gracie.debian/
$ cd gracie.debian/
$ fakeroot ./debian/rules binary

The resulting package contains the program and modules; the modules
are in '/usr/share/pycentral/gracie/site-packages/gracie/'.

$ cd ../
$ dpkg-deb --contents gracie_0.2.6-1_all.deb
[...]
drwxr-xr-x root/root 0 2008-01-07 10:59 ./usr/share/pycentral/
drwxr-xr-x root/root 0 2008-01-07 10:59 
./usr/share/pycentral/gracie/
drwxr-xr-x root/root 0 2008-01-07 10:59 
./usr/share/pycentral/gracie/site-packages/
drwxr-xr-x root/root 0 2008-01-07 10:59 
./usr/share/pycentral/gracie/site-packages/gracie/
-rw-r--r-- root/root  1020 2008-01-07 10:58 
./usr/share/pycentral/gracie/site-packages/gracie/__init__.py
-rw-r--r-- root/root  1290 2008-01-07 10:58 
./usr/share/pycentral/gracie/site-packages/gracie/authorisation.py
-rw-r--r-- root/root  4814 2008-01-07 10:58 
./usr/share/pycentral/gracie/site-packages/gracie/authservice.py
-rw-r--r-- root/root 19956 2008-01-07 10:58 
./usr/share/pycentral/gracie/site-packages/gracie/httprequest.py
-rw-r--r-- root/root  1610 2008-01-07 10:58 
./usr/share/pycentral/gracie/site-packages/gracie/httpresponse.py
-rw-r--r-- root/root  2871 2008-01-07 10:58 
./usr/share/pycentral/gracie/site-packages/gracie/httpserver.py
-rw-r--r-- root/root  9740 2008-01-07 10:58 
./usr/share/pycentral/gracie/site-packages/gracie/pagetemplate.py
-rw-r--r-- root/root  3235 2008-01-07 10:58 
./usr/share/pycentral/gracie/site-packages/gracie/server.py
-rw-r--r-- root/root  1793 2008-01-07 10:58 
./usr/share/pycentral/gracie/site-packages/gracie/session.py
drwxr-xr-x root/root 0 2008-01-07 10:59 
./usr/share/pycentral/gracie/site-packages/gracie.egg-info/
[...]

The problem apparent when installing that .deb is that after
installation the modules *only* exist in that pycentral path; they are
never installed to the Python site-packages directory, and so the
Python package can't be found by programs that try to import it.

$ dpkg --install gracie_0.2.6-1_all.deb
Selecting previously deselected package gracie.
(Reading database ... 31561 files and directories currently installed.)
Unpacking gracie (from .../gracie_0.2.6-1_all.deb) ...
Setting up gracie (0.2.6-1) ...
Starting Gracie OpenID provider:Traceback (most recent call last):
  File /usr/bin/gracied, line 18, in ?
from gracie.server import become_daemon
ImportError: No module named gracie.server
invoke-rc.d: initscript gracie, action start failed.
dpkg: error processing gracie (--install):
 subprocess post-installation script returned error exit status 1
Errors were encountered while processing:
 gracie

$ find /usr -name 'server.py' | grep gracie
/usr/share/pycentral/gracie/site-packages/gracie/server.py


What am I missing? I was under the impression that it was pycentral's
task, at install time, to install the modules from
'/usr/share/pycentral/gracie/' to the appropriate place for Python to
import them. That's not happening though.

-- 
 \For fast acting relief, try slowing down.  -- Jane Wagner, |
  `\   via Lily Tomlin |
_o__)  |
Ben Finney


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: Python modules not installed correctly with pycentral

2008-01-06 Thread Ben Finney
Christopher Schmidt [EMAIL PROTECTED] writes:

 Since it appears you have a *different* postinst, it's possible that
 you need something like a #DEBHELPER# snippet in your existing
 postinst to allow debhelper to actually put the files in the right
 place: when I was missing this in the past, I got similar behavior
 (where the postinst in my package was run, but the python-support
 postinst wasn't).

The postinst is created automatically by debhelper programs:

= /var/lib/dpkg/info/gracie.postinst
#!/bin/sh
set -e
# Automatically added by dh_installinit
if [ -x /etc/init.d/gracie ]; then
update-rc.d gracie defaults /dev/null
if [ -x `which invoke-rc.d 2/dev/null` ]; then
invoke-rc.d gracie start || exit $?
else
/etc/init.d/gracie start || exit $?
fi
fi
# End automatically added section
# Automatically added by dh_pycentral
if which pycentral /dev/null 21; then
pycentral pkginstall gracie
fi
# End automatically added section
=

Thanks for pointing me to this file. It explains why the 'gracied'
invocation fails during installation: the postinst is trying to start
the program *before* running pycentral to install the modules. That
fails, so the postinst can't continue.


So, with that knowledge, I can look at the 'debian/rules' to see why
it's going in the wrong order. The comments in the postinst are
helpful for this.

The current 'debian/rules' invokes them in this order:

= debian/rules
# ...

.PHONY: install
install: build
dh_testdir
dh_testroot
dh_installdirs
dh_installinit
dh_installpam

python${PYVER} #...

.PHONY: binary-arch
binary-arch: build install
dh_testdir
dh_testroot
dh_installchangelogs
dh_installdocs
dh_installexamples
dh_installman
dh_pycentral
dh_link
# ...
=

With those dependencies, the 'dh_installinit' will run before
'dh_pycentral'.


The only way I can see to fix this is to move one of those commands so
the corrent ordering is achieved in the postinst. Where should I be
moving the rules around to? Should 'dh_installinit' move to the
'binary-arch' rule?

The ordering of commands in that 'debian/rules' is largely unchanged
from what 'dh_make' set up. Should the default placement of
'dh_pycentral' be changed so that 'pycentral' is run early enough for
programs in the package that depend on the installed modules?

-- 
 \  Anyone who believes exponential growth can go on forever in a |
  `\ finite world is either a madman or an economist.  -- Kenneth |
_o__) Boulding |
Ben Finney


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: Python modules not installed correctly with pycentral

2008-01-06 Thread Vincent Bernat
OoO En cette nuit striée d'éclairs du lundi 07 janvier 2008, vers 02:06,
Ben Finney [EMAIL PROTECTED] disait:

 The only way I can see to fix this is to move one of those commands so
 the corrent ordering is achieved in the postinst. Where should I be
 moving the rules around to? Should 'dh_installinit' move to the
 'binary-arch' rule?

 The ordering of commands in that 'debian/rules' is largely unchanged
 from what 'dh_make' set up. Should the default placement of
 'dh_pycentral' be changed so that 'pycentral' is run early enough for
 programs in the package that depend on the installed modules?

Well, if you can change the order for postinst, you will get wrong order
in prerm.

See:
 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=386970
 http://lists.debian.org/debian-release/2006/10/msg00073.html

This is not specific to cdbs in fact, so it applies to you too.
-- 
 /*
  *   Should be panic but... (Why are BSD people panic obsessed ??)
  */
2.0.38 /usr/src/linux/net/ipv4/ip_fw.c


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



debhelper for python-central, problems with prerm/postinst (was: Python modules not installed correctly with pycentral)

2008-01-06 Thread Ben Finney
(Vincent, please don't send me copies of messages sent to this list.
This is spelled out on the mailing-list code of conduct
URL:http://www.debian.org/MailingLists/#codeofconduct.)

Vincent Bernat [EMAIL PROTECTED] writes:

 OoO En cette nuit striée d'éclairs du lundi 07 janvier 2008, vers 02:06,
 Ben Finney [EMAIL PROTECTED] disait:
 
  Should the default placement of 'dh_pycentral' be changed so that
  'pycentral' is run early enough for programs in the package that
  depend on the installed modules?
 
 Well, if you can change the order for postinst, you will get wrong order
 in prerm.
 
 See:
  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=386970
  http://lists.debian.org/debian-release/2006/10/msg00073.html
 
 This is not specific to cdbs in fact, so it applies to you too.

Hmm, that's a wrinkle I hadn't thought of. Thank you for showing me
that discussion.

So, how do Python-language packagers work around this bug currently?

-- 
 \ If nature has made any one thing less susceptible than all |
  `\others of exclusive property, it is the action of the thinking |
_o__)  power called an idea —Thomas Jefferson |
Ben Finney


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: debhelper for python-central, problems with prerm/postinst (was: Python modules not installed correctly with pycentral)

2008-01-06 Thread Vincent Bernat

On Mon, 07 Jan 2008 18:17:34 +1100, Ben Finney
[EMAIL PROTECTED] wrote:
 (Vincent, please don't send me copies of messages sent to this list.
 This is spelled out on the mailing-list code of conduct
 URL:http://www.debian.org/MailingLists/#codeofconduct.)

Sorry for that.

 See:
  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=386970
  http://lists.debian.org/debian-release/2006/10/msg00073.html

 This is not specific to cdbs in fact, so it applies to you too.
 
 Hmm, that's a wrinkle I hadn't thought of. Thank you for showing me
 that discussion.
 
 So, how do Python-language packagers work around this bug currently?

I don't use dh_installinit and I put the correct snippet in postinst/prerm
by hand, waiting for the bug to be fixed.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]