Discussion:
Frustrated trying to build beecrypt & rpm on a Debian system whereI'm not root
Johri, Mayank (GTI)
2007-11-25 11:31:00 UTC
Permalink
Paul,

It should be

import os, .... Instead of import (os,...

Thanks and Regards,
Mayank Johri
Merrill Lynch & Co.
Ph: 212.647.3076



-----Original Message-----
From: rpm-list-***@redhat.com [mailto:rpm-list-***@redhat.com]
On Behalf Of Paul Johnson
Sent: Saturday, November 24, 2007 1:23 PM
To: RPM Package Manager
Subject: Frustrated trying to build beecrypt & rpm on a Debian system
whereI'm not root


I have a user account on Dreamhost.com. I've been making RPMs for
Scientific Linux and posting them here

http://pj.freefaculty.org/ScientificLinux/5

A guy says "create a repository there" and I've been fighting with the
problem of building, installing, and using Python modules in a place
that is NOT /usr/lib/python2.4.

I'm using the configure option --prefix=/home/pauljohn32/packages when
I build everything. TO make RPM's configure find the Beecrypt I
have to force in a CFLAG -I/home/pauljohn32/packages/include

and I set the environment variable

PYTHONPATH=/home/pauljohn32/packages/lib/python2.4:/usr/lib/python2.4

One problem is that the Beecrypt source from the Fedora 8 distribution
is hardcoded to put the python modules in that system place, and it
ignores the install prefix. I can hand edit the Makefile so they go
into /home/pauljohn32/packages/lib/python2.4. I've built rpm several
times and installed it, thinking I had tricked it into installing
modules into my user home directory, only to have runtime failures in
the createrepo scripts. Those are hardcoded to go into /usr/, but i
can revise that. Still, I get crashes because python components are
not found.


$ createrepo /home/pauljohn32/freefaculty.org/ScientificLinux/5/i386/
'import site' failed; use -v for traceback
Traceback (most recent call last):
File "/home/pauljohn32/packages/share/createrepo/genpkgmetadata.py",
line 23, in ?
import os
File "/usr/lib/python2.4/os.py", line 133
from os.path import (curdir, pardir, sep, pathsep, defpath, extsep,
altsep,
^
SyntaxError: invalid syntax


I'm a Perl programmer, and I am sorry to say I find Python docs not as
helpful for non-root users! Please throw me a bone (for the holiday
spirit).

PJ
--
Paul E. Johnson
Professor, Political Science
1541 Lilac Lane, Room 504
University of Kansas

_______________________________________________
Rpm-list mailing list
Rpm-***@redhat.com
https://www.redhat.com/mailman/listinfo/rpm-list
--------------------------------------------------------

This message w/attachments (message) may be privileged, confidential or proprietary, and if you are not an intended recipient, please notify the sender, do not use or share it and delete it. Unless specifically indicated, this message is not an offer to sell or a solicitation of any investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Merrill Lynch. Subject to applicable law, Merrill Lynch may monitor, review and retain e-communications (EC) traveling through its networks/systems. The laws of the country of each sender/recipient may impact the handling of EC, and EC may be archived, supervised and produced in countries other than the country in which you are located. This message cannot be guaranteed to be secure or error-free. This message is subject to terms available at the following link: http://www.ml.com/e-communications_terms/. By messaging with Merrill Lynch you consent to the foregoing.
--------------------------------------------------------
Johri, Mayank (GTI)
2007-11-25 11:31:58 UTC
Permalink
Paul,

It should be
from os.path import curdir,... Instead of from os.path import (curdir,

Thanks and Regards,
Mayank Johri
Merrill Lynch & Co.
Ph: 212.647.3076



-----Original Message-----
From: rpm-list-***@redhat.com [mailto:rpm-list-***@redhat.com]
On Behalf Of Paul Johnson
Sent: Saturday, November 24, 2007 1:23 PM
To: RPM Package Manager
Subject: Frustrated trying to build beecrypt & rpm on a Debian system
whereI'm not root


I have a user account on Dreamhost.com. I've been making RPMs for
Scientific Linux and posting them here

http://pj.freefaculty.org/ScientificLinux/5

A guy says "create a repository there" and I've been fighting with the
problem of building, installing, and using Python modules in a place
that is NOT /usr/lib/python2.4.

I'm using the configure option --prefix=/home/pauljohn32/packages when
I build everything. TO make RPM's configure find the Beecrypt I
have to force in a CFLAG -I/home/pauljohn32/packages/include

and I set the environment variable

PYTHONPATH=/home/pauljohn32/packages/lib/python2.4:/usr/lib/python2.4

One problem is that the Beecrypt source from the Fedora 8 distribution
is hardcoded to put the python modules in that system place, and it
ignores the install prefix. I can hand edit the Makefile so they go
into /home/pauljohn32/packages/lib/python2.4. I've built rpm several
times and installed it, thinking I had tricked it into installing
modules into my user home directory, only to have runtime failures in
the createrepo scripts. Those are hardcoded to go into /usr/, but i
can revise that. Still, I get crashes because python components are
not found.


$ createrepo /home/pauljohn32/freefaculty.org/ScientificLinux/5/i386/
'import site' failed; use -v for traceback
Traceback (most recent call last):
File "/home/pauljohn32/packages/share/createrepo/genpkgmetadata.py",
line 23, in ?
import os
File "/usr/lib/python2.4/os.py", line 133
from os.path import (curdir, pardir, sep, pathsep, defpath, extsep,
altsep,
^
SyntaxError: invalid syntax


I'm a Perl programmer, and I am sorry to say I find Python docs not as
helpful for non-root users! Please throw me a bone (for the holiday
spirit).

PJ
--
Paul E. Johnson
Professor, Political Science
1541 Lilac Lane, Room 504
University of Kansas

_______________________________________________
Rpm-list mailing list
Rpm-***@redhat.com
https://www.redhat.com/mailman/listinfo/rpm-list
--------------------------------------------------------

This message w/attachments (message) may be privileged, confidential or proprietary, and if you are not an intended recipient, please notify the sender, do not use or share it and delete it. Unless specifically indicated, this message is not an offer to sell or a solicitation of any investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Merrill Lynch. Subject to applicable law, Merrill Lynch may monitor, review and retain e-communications (EC) traveling through its networks/systems. The laws of the country of each sender/recipient may impact the handling of EC, and EC may be archived, supervised and produced in countries other than the country in which you are located. This message cannot be guaranteed to be secure or error-free. This message is subject to terms available at the following link: http://www.ml.com/e-communications_terms/. By messaging with Merrill Lynch you consent to the foregoing.
--------------------------------------------------------
Mike Meyer
2007-11-25 17:41:21 UTC
Permalink
Post by Johri, Mayank (GTI)
Paul,
It should be
from os.path import curdir,... Instead of from os.path import (curdir,
The "(curdir, ..." is from python 2.5, and causes the next line to be
a continuation line (standard python parsing: an open paren always
does that). That is, it probably said something like:

from os.path import (curdir, pardir, sep, pathsep, defpath, extsep,
altsep, join)

and you'll want to change it to

from os.path import curdir, pardir, sep, pathsep, defpath, extsep, altsep, join

or

from os.path import curdir, pardir, sep, pathsep, defpath, extsep, \
altsep, join

Of course, that this is in their sources means they haven't tested
against 2.4, so you may encounter more such problems. In this case,
the "What's new in 2.5" (http://docs.python.org/whatsnew/whatsnew25.html)
is probably worth reading.

<mike
Post by Johri, Mayank (GTI)
Thanks and Regards,
Mayank Johri
Merrill Lynch & Co.
Ph: 212.647.3076
-----Original Message-----
On Behalf Of Paul Johnson
Sent: Saturday, November 24, 2007 1:23 PM
To: RPM Package Manager
Subject: Frustrated trying to build beecrypt & rpm on a Debian system
whereI'm not root
I have a user account on Dreamhost.com. I've been making RPMs for
Scientific Linux and posting them here
http://pj.freefaculty.org/ScientificLinux/5
A guy says "create a repository there" and I've been fighting with the
problem of building, installing, and using Python modules in a place
that is NOT /usr/lib/python2.4.
I'm using the configure option --prefix=/home/pauljohn32/packages when
I build everything. TO make RPM's configure find the Beecrypt I
have to force in a CFLAG -I/home/pauljohn32/packages/include
and I set the environment variable
PYTHONPATH=/home/pauljohn32/packages/lib/python2.4:/usr/lib/python2.4
One problem is that the Beecrypt source from the Fedora 8 distribution
is hardcoded to put the python modules in that system place, and it
ignores the install prefix. I can hand edit the Makefile so they go
into /home/pauljohn32/packages/lib/python2.4. I've built rpm several
times and installed it, thinking I had tricked it into installing
modules into my user home directory, only to have runtime failures in
the createrepo scripts. Those are hardcoded to go into /usr/, but i
can revise that. Still, I get crashes because python components are
not found.
$ createrepo /home/pauljohn32/freefaculty.org/ScientificLinux/5/i386/
'import site' failed; use -v for traceback
File "/home/pauljohn32/packages/share/createrepo/genpkgmetadata.py",
line 23, in ?
import os
File "/usr/lib/python2.4/os.py", line 133
from os.path import (curdir, pardir, sep, pathsep, defpath, extsep,
altsep,
^
SyntaxError: invalid syntax
I'm a Perl programmer, and I am sorry to say I find Python docs not as
helpful for non-root users! Please throw me a bone (for the holiday
spirit).
PJ
--
Paul E. Johnson
Professor, Political Science
1541 Lilac Lane, Room 504
University of Kansas
_______________________________________________
Rpm-list mailing list
https://www.redhat.com/mailman/listinfo/rpm-list
--------------------------------------------------------
This message w/attachments (message) may be privileged, confidential or proprietary, and if you are not an intended recipient, please notify the sender, do not use or share it and delete it. Unless specifically indicated, this message is not an offer to sell or a solicitation of any investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Merrill Lynch. Subject to applicable law, Merrill Lynch may monitor, review and retain e-communications (EC) traveling through its networks/systems. The laws of the country of each sender/recipient may impact the handling of EC, and EC may be archived, supervised and produced in countries other than the country in which you are located. This message cannot be guaranteed to be sec
ure or error-free. This message is subject to terms available at the following link: http://www.ml.com/e-communications_terms/. By messaging with Merrill Lynch you consent to the foregoing.
Post by Johri, Mayank (GTI)
--------------------------------------------------------
_______________________________________________
Rpm-list mailing list
https://www.redhat.com/mailman/listinfo/rpm-list
--
Mike Meyer <***@mired.org> http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.
Paul Johnson
2007-11-25 21:21:25 UTC
Permalink
Post by Mike Meyer
Post by Johri, Mayank (GTI)
Paul,
It should be
from os.path import curdir,... Instead of from os.path import (curdir,
The "(curdir, ..." is from python 2.5, and causes the next line to be
a continuation line (standard python parsing: an open paren always
from os.path import (curdir, pardir, sep, pathsep, defpath, extsep,
altsep, join)
and you'll want to change it to
from os.path import curdir, pardir, sep, pathsep, defpath, extsep, altsep, join
or
from os.path import curdir, pardir, sep, pathsep, defpath, extsep, \
altsep, join
Of course, that this is in their sources means they haven't tested
against 2.4, so you may encounter more such problems. In this case,
the "What's new in 2.5" (http://docs.python.org/whatsnew/whatsnew25.html)
is probably worth reading.
<mike
Wait a minute. The error is not in my python code. It is in the python
Post by Mike Meyer
From /usr/lib/python2.4/os.py
sys.modules['os.path'] = path
from os.path import (curdir, pardir, sep, pathsep, defpath, extsep, altsep,
devnull)

If RPM did compile against python2.4, then why is this cropping up now?

pj
--
Paul E. Johnson
Professor, Political Science
1541 Lilac Lane, Room 504
University of Kansas
Mike Meyer
2007-11-25 22:41:02 UTC
Permalink
Post by Paul Johnson
Post by Mike Meyer
Post by Johri, Mayank (GTI)
Paul,
It should be
from os.path import curdir,... Instead of from os.path import (curdir,
Of course, that this is in their sources means they haven't tested
against 2.4, so you may encounter more such problems. In this case,
the "What's new in 2.5" (http://docs.python.org/whatsnew/whatsnew25.html)
is probably worth reading.
Wait a minute. The error is not in my python code. It is in the python
Post by Mike Meyer
From /usr/lib/python2.4/os.py
sys.modules['os.path'] = path
from os.path import (curdir, pardir, sep, pathsep, defpath, extsep, altsep,
devnull)
Arg. In that case, Both Mayank and I are off base. The change must
have been in 2.4, not 2.5. And the syntax error he identified
shouldn't be a syntax error. In fact, that code loads fine on my
RHEL4u4 using the system python (2.4.3).

Can you make sure that createrepo is using the Python you think it
should? That's the only explanation I can think of for the error you
quoted earlier.

Where can I find a copy of creatrepo (assuming it's python)?
Post by Paul Johnson
If RPM did compile against python2.4, then why is this cropping up now?
Catching errors at run time instead of compile time is a common
behavior for dynamic languages.

<mike
--
Mike Meyer <***@mired.org> http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.
Paul Johnson
2007-11-26 16:30:34 UTC
Permalink
Post by Mike Meyer
Can you make sure that createrepo is using the Python you think it
should? That's the only explanation I can think of for the error you
quoted earlier.
YES! That's it. createrepo is just this:

#!/bin/sh
exec /usr/share/createrepo/genpkgmetadata.py "$@"

But the programs called by createrepo had the /usr/bin/python hard
coded in, so it was accessing 2.3's executable but it was trying to
use libs for 2.4.

After fixing that, now I'm back full circle to the original problem.
I build & install the rpm python modues under
$HOME/packages/lib/python2.4, but even though I add that directory to
$PYTHONPATH, then the run of create repo fails because it cannot find
the module "rpm".
Post by Mike Meyer
Where can I find a copy of creatrepo (assuming it's python)?
I got the createrepo stuff from an RPM in Scientific Linux 5

createrepo-0.4.4-2.fc6.noarch

from the SRPM file in their server is just the one from fedora core 6,
ftp://linux.fnal.gov/linux/scientific/50/SRPMS/vendor/createrepo-0.4.4-2.fc6.src.rpm

But you can get the newer one here.

http://mirror.cogentco.com/pub/linux/fedora/linux/releases/8/Everything/source/SRPMS/createrepo-0.4.10-1.fc8.src.rpm

In case you just want a quick glance at one of their programs, I'm
attaching an original, unchanged version of genpkgmetadata.py for your
convenience.

pj
Post by Mike Meyer
--
Independent Network/Unix/Perforce consultant, email for more information.
--
Paul E. Johnson
Professor, Political Science
1541 Lilac Lane, Room 504
University of Kansas
Mike Meyer
2007-11-26 23:40:00 UTC
Permalink
Post by Paul Johnson
Post by Mike Meyer
Can you make sure that createrepo is using the Python you think it
should? That's the only explanation I can think of for the error you
quoted earlier.
#!/bin/sh
But the programs called by createrepo had the /usr/bin/python hard
coded in, so it was accessing 2.3's executable but it was trying to
use libs for 2.4.
After fixing that, now I'm back full circle to the original problem.
I build & install the rpm python modues under
$HOME/packages/lib/python2.4, but even though I add that directory to
$PYTHONPATH, then the run of create repo fails because it cannot find
the module "rpm".
That's probably because the rpm module is a Red Hat thing, not a
Python thing. An RPM of Python 2.4 for a system with Python 2.3 on it
probably doesn't include the rpm module because it's not generally
needed outside the RH utilities, which all pretty much require that
you use the version of python installed with the system (if for no
other reason than that you get the non-standard modules that are
installed with it).

Not sure which way to advise you to go from here....

<mike
--
Mike Meyer <***@mired.org> http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.
Paul Johnson
2007-11-27 19:20:12 UTC
Permalink
Post by Mike Meyer
That's probably because the rpm module is a Red Hat thing, not a
Python thing. An RPM of Python 2.4 for a system with Python 2.3 on it
probably doesn't include the rpm module because it's not generally
needed outside the RH utilities, which all pretty much require that
you use the version of python installed with the system (if for no
other reason than that you get the non-standard modules that are
installed with it).
Not sure which way to advise you to go from here....
Thanks for your attention. I appreciate it. I keep feeling like I'm
'this close' to fixing the problem and that my difficulty is so
fundamental/simple/ignorant that Python folks can't see what I'm
asking.

Let me try to ask this one more time.

In Perl, users can install modules in their home directories. The
make command changes by adding PREFIX=$HOME/user_perl

or some such thing and then when you want to run a Perl program that
uses both modules from the /usr/lib/perl5 set and the user's set, you
can add a use lib command in the Perl program so it goes to look in
$HOME/user_perl when it can't find it in /usr/lib/perl5. I think
there is also an environment way to set that path, but I don't
generally do it.

On This Debian system that has python installed (it has versions 2.2,
2.3, and 2.4), I want to take the same approach of building Python
modules for beecrypt and rpm and installing them in $HOME/packages and
then when I run the Python program, i want it to behave like Perl and
get modules from either place.

So far, I am able, I think, to force my beecrypt and rpm to build
against the python2.4 that is installed on the system. I can install
them in $HOME/packages/lib/python2.4.

But I do not know the magical incantation that will allow a python
2.4 program to run and use modules stored in $HOME. From my reading,
I though that if I did this:

export PYTHONPATH=$HOME/packages/lib/python2.4:$PYTHONPATH

it would be sufficient. But it seems not to be because a python2.4
program that runs does not look for modules in
$HOME/packages/lib/python2.4.

I'm surprised this doesn't come up more often. In Perl, it gets
discussed all the time.

pj
--
Paul E. Johnson
Professor, Political Science
1541 Lilac Lane, Room 504
University of Kansas
Valery Reznic
2007-11-27 21:25:19 UTC
Permalink
Post by Mike Meyer
Post by Mike Meyer
That's probably because the rpm module is a Red
Hat thing, not a
Post by Mike Meyer
Python thing. An RPM of Python 2.4 for a system
with Python 2.3 on it
Post by Mike Meyer
probably doesn't include the rpm module because
it's not generally
Post by Mike Meyer
needed outside the RH utilities, which all pretty
much require that
Post by Mike Meyer
you use the version of python installed with the
system (if for no
Post by Mike Meyer
other reason than that you get the non-standard
modules that are
Post by Mike Meyer
installed with it).
Not sure which way to advise you to go from
here....
Thanks for your attention. I appreciate it. I keep
feeling like I'm
'this close' to fixing the problem and that my
difficulty is so
fundamental/simple/ignorant that Python folks can't
see what I'm
asking.
Let me try to ask this one more time.
In Perl, users can install modules in their home
directories. The
make command changes by adding
PREFIX=$HOME/user_perl
or some such thing and then when you want to run a
Perl program that
uses both modules from the /usr/lib/perl5 set and
the user's set, you
can add a use lib command in the Perl program so it
goes to look in
$HOME/user_perl when it can't find it in
/usr/lib/perl5. I think
there is also an environment way to set that path,
but I don't
generally do it.
On This Debian system that has python installed (it
has versions 2.2,
2.3, and 2.4), I want to take the same approach of
building Python
modules for beecrypt and rpm and installing them in
$HOME/packages and
then when I run the Python program, i want it to
behave like Perl and
get modules from either place.
So far, I am able, I think, to force my beecrypt and
rpm to build
against the python2.4 that is installed on the
system. I can install
them in $HOME/packages/lib/python2.4.
But I do not know the magical incantation that will
allow a python
2.4 program to run and use modules stored in $HOME.
From my reading,
export
PYTHONPATH=$HOME/packages/lib/python2.4:$PYTHONPATH
it would be sufficient. But it seems not to be
because a python2.4
program that runs does not look for modules in
$HOME/packages/lib/python2.4.
May be you need use PYTHONHOME ?
If it's doesn't help you can try to run your program
under strace, and see where python tried to open
files.

Valery
Post by Mike Meyer
I'm surprised this doesn't come up more often. In
Perl, it gets
discussed all the time.
pj
--
Paul E. Johnson
Professor, Political Science
1541 Lilac Lane, Room 504
University of Kansas
_______________________________________________
Rpm-list mailing list
https://www.redhat.com/mailman/listinfo/rpm-list
____________________________________________________________________________________
Get easy, one-click access to your favorites.
Make Yahoo! your homepage.
http://www.yahoo.com/r/hs
Mike Meyer
2007-11-27 22:38:02 UTC
Permalink
Post by Valery Reznic
Post by Paul Johnson
it would be sufficient. But it seems not to be
because a python2.4
program that runs does not look for modules in
$HOME/packages/lib/python2.4.
May be you need use PYTHONHOME ?
Don't. Please, for gru's sake, don't do that!

PYTHONHOME points to the libraries and etc. that come with
python. Normally, Python finds that stuff by itself, and you set
PYTHONHOME when you want to run a python binary and have it use a
different set of python libraries than the ones it's installed and/or
built with. Setting this on a system with multiple python
installations is a quick way to go crazy.
Post by Valery Reznic
If it's doesn't help you can try to run your program
under strace, and see where python tried to open
files.
It's easier to ask pyhon:


bhuda% echo $PYTHONPATH
/home/mwm/lib/python
bhuda% python
Python 2.5.1 (r251:54863, Aug 11 2007, 18:08:18)
[GCC 3.4.6 [FreeBSD] 20060305] on freebsd6
Type "help", "copyright", "credits" or "license" for more information.
Post by Valery Reznic
Post by Paul Johnson
from sys import path
from pprint import pprint
pprint(path)
['',
'/usr/opt/lib/python2.5/site-packages/setuptools-0.6c5-py2.5.egg',
'/usr/opt/lib/python2.5/site-packages/Cheetah-2.0rc7-py2.5-freebsd-6.2-STABLE-amd64.egg',
'/usr/opt/lib/python2.5/site-packages/lxml-1.3.2-py2.5-freebsd-6.2-STABLE-amd64.egg',
'/home/mwm/lib/python',
'/usr/opt/lib/python25.zip',
'/usr/opt/lib/python2.5',
'/usr/opt/lib/python2.5/plat-freebsd6',
'/usr/opt/lib/python2.5/lib-tk',
'/usr/opt/lib/python2.5/lib-dynload',
'/usr/opt/lib/python2.5/site-packages',
'/usr/opt/lib/python2.5/site-packages/Numeric',
'/usr/opt/lib/python2.5/site-packages/gtk-2.0',
'/usr/opt/lib/python2.5/site-packages']
<mike
--
Mike Meyer <***@mired.org> http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.
Loading...