Hi,

On 28 January 2013 09:01, Nicholas H.Tollervey <nt...@ntoll.org> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi,
>
> I need to build an RPM of ujson for RHEL5 targeting Python2.6. This
> will be deployed on "front end" boxes that do not have a compiler
> installed (hence I can't just pip install the damn thing).
>
> All the RHEL5 machines have Python 2.4, 2.5 and 2.6 installed with the
> default being 2.4 (what you get from /usr/bin/python).
>
> If I run setup in the root of the ujson project like this:
>
> $ python2.6 setup.py bdist_rpm
>
> I notice from the output from GCC that the script has the -fPIC flag
> reference /usr/include/python2.4
>
> :-(
>
> Obviously, compilation is being done against the wrong version of Python.
>
> Anyone know how to pass in or force the version to Python 2.6?
>

Two possibilities occur to me:

1. You can build your rpm on some other version of Linux running python 2.6
(I build our payroll rpms on Debian, they run OK on RHEL and SUSE).

2. On most systems, 'python' lives in /usr/bin and is a symbolic link to
the actual version of python, eg python2.6. So in usr/bin you may find
'python2.4', 'python2.5', 'python 2.6' and even 'python3.3', with 'python'
being linked to the default.

So by changing the link, you change the version. You could for example

ln -s /usr/bin/python2.6 /usr/local/bin/python

which, provided that /usr/.local/bin is in the search path before /usr/bin,
cause invocations of 'python' to run python2.6. However, python
programs/modules which have a hashbang line #!/usr/bin/env python will run
with 2.6 OK whereas those which have #!/usr/bin/python will continue to use
the old default, which is possibly the cause of your problem anyway.

So, running as root:

cd /usr/bin
rm python
ln -s python2.6 python

should enable you to build your rpm for python 2.6

BUT could affect other users adversely, so you would need to do your work
while the system is quiescent and reverse the change afterwards.

Using these old 'enterprise' systems is like working with your hands tied
behind your back : in the Red Hat world, you may be better off developing
on Fedora while targetting RHEL, but not as well off as changing (and
getting your customer to change) to Debian, although I guess that that is a
lost cause for any customer who has chosen an 'enterprise' system in the
first place.

Best wishes,

John
--

>
> Many thanks,
>
> Nicholas.
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.11 (GNU/Linux)
>
_______________________________________________
python-uk mailing list
python-uk@python.org
http://mail.python.org/mailman/listinfo/python-uk

Reply via email to