Re: [Tutor] Building Python 2.7.3 on RHEL 5.8 x86_64 -- Syntax Error

2013-03-27 Thread Amit Saha
On Wed, Mar 27, 2013 at 11:05 PM, Sean Carolan  wrote:
>
>> But, where did you get the idea that you could build Python RPMs using
>> $python setup.py bdist_rpm ? I thought that was only limited to
>> building RPMs for python packages (including extensions), but not the
>> Python interpreter itself. Please correct me if i am wrong.
>
>
> Ok, so it's only for module distributions?  I assumed it could package
> Python itself as well, because it creates a *.spec file that reads like
> this:
>
> %define name Python
> %define version 2.7.3
> %define unmangled_version 2.7.3
> %define release 1
>
> Summary: A high-level object-oriented programming language

Hmm. Let's see, it was a guess on my part as well.

>
>>
>> Okay, here is something for you to try in the meantime. Download the
>> Python 2.7 SRPM (source RPM) from
>> http://koji.fedoraproject.org/koji/packageinfo?packageID=130. May be
>> the F17 version.
>> Extract it to get the source files, patches and the SPEC file.
>
>
> Thank you, I will try this today.  In the meantime I have started a thread
> on the "distutils" mailing list, so as not to spam "Tutor" with my build
> woes.

I will follow the thread there and see what comes out of it. This is
interesting!

FWIW, I tried to get the SRPM and build Python 2.7 on RHEL 5. Quickly
realized that it lacks, yum-builddep, yumdownloader, etc :-/

So, just left it there for then. I will have to try again the manual way.


-Amit.

-- 
http://amitsaha.github.com/
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Building Python 2.7.3 on RHEL 5.8 x86_64 -- Syntax Error

2013-03-27 Thread Sean Carolan
> But, where did you get the idea that you could build Python RPMs using
> $python setup.py bdist_rpm ? I thought that was only limited to
> building RPMs for python packages (including extensions), but not the
> Python interpreter itself. Please correct me if i am wrong.
>

Ok, so it's only for module distributions?  I assumed it could package
Python itself as well, because it creates a *.spec file that reads like
this:

%define name Python
%define version 2.7.3
%define unmangled_version 2.7.3
%define release 1

Summary: A high-level object-oriented programming language


> Okay, here is something for you to try in the meantime. Download the
> Python 2.7 SRPM (source RPM) from
> http://koji.fedoraproject.org/koji/packageinfo?packageID=130. May be
> the F17 version.
> Extract it to get the source files, patches and the SPEC file.
>

Thank you, I will try this today.  In the meantime I have started a thread
on the "distutils" mailing list, so as not to spam "Tutor" with my build
woes.

regards,

Sean
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Building Python 2.7.3 on RHEL 5.8 x86_64 -- Syntax Error

2013-03-26 Thread Amit Saha
On Wed, Mar 27, 2013 at 7:32 AM, Sean Carolan  wrote:
>
>> Given that most folks on this list are only learning Python its pretty
>> unlikely that they are building bespoke RPMs...
>>
>> You might find more experience of RPM building on the general Python
>> mailing list/newsgroup.
>
>
> Sorry 'bout that.  I'll follow up with the bug report and possibly the
> general list as well.


FWIW, I tried the same thing with Python 3 sources on Fedora 18, and
got the same error as you.

But, where did you get the idea that you could build Python RPMs using
$python setup.py bdist_rpm ? I thought that was only limited to
building RPMs for python packages (including extensions), but not the
Python interpreter itself. Please correct me if i am wrong.

Okay, here is something for you to try in the meantime. Download the
Python 2.7 SRPM (source RPM) from
http://koji.fedoraproject.org/koji/packageinfo?packageID=130. May be
the F17 version.
Extract it to get the source files, patches and the SPEC file.

If you are familiar with building RPM packages by hand, please try
building it like any other package. That is, by copying the .spec file
to SPECS and the .patch, .xz and other files in SOURCES and then doing
rpmbuild -ba python.spec from the SPECS directory. Oh yes, please
install the dependencies for building the package first by doing,
yum-builddep  before doing the build.

It seems like it built the RPMs alright on my laptop. See if that helps.

Best,
Amit.



-- 
http://amitsaha.github.com/
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Building Python 2.7.3 on RHEL 5.8 x86_64 -- Syntax Error

2013-03-26 Thread Amit Saha
On Wed, Mar 27, 2013 at 7:32 AM, Sean Carolan  wrote:
>
>> Given that most folks on this list are only learning Python its pretty
>> unlikely that they are building bespoke RPMs...
>>
>> You might find more experience of RPM building on the general Python
>> mailing list/newsgroup.
>
>
> Sorry 'bout that.  I'll follow up with the bug report and possibly the
> general list as well.

I am going to try doing this sometime today. I shall let you know if I
find a solution or my observations.


Best,
Amit.

-- 
http://amitsaha.github.com/
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Building Python 2.7.3 on RHEL 5.8 x86_64 -- Syntax Error

2013-03-26 Thread Prasad, Ramit
Sean Carolan wrote:
> [Alan Gauld wrote:]
> > Given that most folks on this list are only learning Python its pretty 
> > unlikely that they are building
> > bespoke RPMs...
> > 
> > You might find more experience of RPM building on the general Python 
> > mailing list/newsgroup.
> 
> Sorry 'bout that.  I'll follow up with the bug report and possibly the 
> general list as well.

Please post your solution back (if you find one), for archive completeness. 
And my curiosity. :)


~Ramit


This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Building Python 2.7.3 on RHEL 5.8 x86_64 -- Syntax Error

2013-03-26 Thread Sean Carolan
> Given that most folks on this list are only learning Python its pretty
> unlikely that they are building bespoke RPMs...
>
> You might find more experience of RPM building on the general Python
> mailing list/newsgroup.


Sorry 'bout that.  I'll follow up with the bug report and possibly the
general list as well.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Building Python 2.7.3 on RHEL 5.8 x86_64 -- Syntax Error

2013-03-26 Thread Alan Gauld

On 26/03/13 19:04, Sean Carolan wrote:


Has anyone on this list successfully built a python 2.7 RPM using this
command?
python2.7 setup.py bdist_rpm


Given that most folks on this list are only learning Python its pretty 
unlikely that they are building bespoke RPMs...


You might find more experience of RPM building on the general Python 
mailing list/newsgroup.


--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Building Python 2.7.3 on RHEL 5.8 x86_64 -- Syntax Error

2013-03-26 Thread Sean Carolan
> If so, what was your secret?
>
>
I tried running this again with strace, and it looks like it's finding the
pyconfig.h file:

open("/usr/local/include/python2.7/pyconfig.h", O_RDONLY) = 4
read(4, "/* pyconfig.h.  Generated from p"..., 4096) = 4096
stat("pyconfig.h", {st_mode=S_IFREG|0664, st_size=36037, ...}) = 0
stat("pyconfig.h.in", {st_mode=S_IFREG|0644, st_size=34336, ...}) = 0
stat("PC/pyconfig.h", {st_mode=S_IFREG|0644, st_size=20770, ...}) = 0
stat("PC/os2vacpp/pyconfig.h", {st_mode=S_IFREG|0644, st_size=10113, ...})
= 0
stat("PC/os2emx/pyconfig.h", {st_mode=S_IFREG|0644, st_size=8096, ...}) = 0
stat("Include/pyconfig.h", {st_mode=S_IFREG|0664, st_size=36037, ...}) = 0
stat("build/bdist.linux-x86_64/rpm/BUILD/Python-2.7.3/pyconfig.h",
{st_mode=S_IFREG|0664, st_size=36037, ...}) = 0
stat("build/bdist.linux-x86_64/rpm/BUILD/Python-2.7.3/Include/pyconfig.h",
{st_mode=S_IFREG|0664, st_size=36037, ...}) = 0
stat("RISCOS/pyconfig.h", {st_mode=S_IFREG|0644, st_size=18510, ...}) = 0
open("/usr/local/include/python2.7/pyconfig.h", O_RDONLY) = 3
read(3, "/* pyconfig.h.  Generated from p"..., 4096) = 4096
error: pyconfig.h: No such file or directory

/usr/local/include/python2.7/pyconfig.h exists:

[scarolan@titania:~/Python-2.7.3]$ ls
/usr/local/include/python2.7/pyconfig.h -l
-rw-r--r-- 1 root root 36037 Mar 26 11:45
/usr/local/include/python2.7/pyconfig.h

I'm not sure exactly what the installer is expecting here...
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Building Python 2.7.3 on RHEL 5.8 x86_64 -- Syntax Error

2013-03-26 Thread Sean Carolan
>
> http://hg.python.org/cpython/file/d321885ff8f3/Lib/distutils/command/bdist_rpm.py#l23
>

No dice.

[scarolan@titania:~/Python-2.7.3]$ alias | grep python
alias python='/usr/local/bin/python2.7'

[scarolan@titania:~/Python-2.7.3]$ /usr/local/bin/python2.7 setup.py
bdist_rpm
error: pyconfig.h: No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.14555 (%build)
RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.14555 (%build)
error: command 'rpmbuild' failed with exit status 1

Has anyone on this list successfully built a python 2.7 RPM using this
command?
python2.7 setup.py bdist_rpm

If so, what was your secret?
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Building Python 2.7.3 on RHEL 5.8 x86_64 -- Syntax Error

2013-03-26 Thread eryksun
On Tue, Mar 26, 2013 at 11:18 AM, Sean Carolan  wrote:
> I've tried it with python24, python25 and python27 and all of them give the
> same error.

After looking at the source, I think the option python=python2.7 may
solve the problem.

http://hg.python.org/cpython/file/d321885ff8f3/Lib/distutils/command/bdist_rpm.py#l23
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Building Python 2.7.3 on RHEL 5.8 x86_64 -- Syntax Error

2013-03-26 Thread Walter Prins
Hi,


On 26 March 2013 16:54, Hugo Arts  wrote:

> On Tue, Mar 26, 2013 at 3:18 PM, Sean Carolan  wrote:
>
>>
>>  Could it be that it is taking the system python executable which is
>>> probably 2.4?
>>>
>>> -Amit.
>>
>>
>> I've tried it with python24, python25 and python27 and all of them give
>> the same error.
>>
>
> The easiest workaround I can think of is a temporary alias, i.e.:
>
> $ alias python="python27" && python setup.by bdist_rpm && unalias python
>
> Or some variation of such. The more permanent fix is to change the bash
> script that setup.py generates so it's less naive about having the right
> system python installed, *or* upgrading the system python version.
>

Sean you might also look into virtualenv.  I suspect a suitably setup
virtualenv will also avoid your problem, but is obviously more work than
what Hugo's suggested.  See for example this question on stackoverflow:
http://stackoverflow.com/questions/1534210/use-different-python-version-with-virtualenv


Walter
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Building Python 2.7.3 on RHEL 5.8 x86_64 -- Syntax Error

2013-03-26 Thread Sean Carolan
> What it looks like to me is that while you run (using python 2.7):
>
> >  python27 setup.py bdist_rpm
>
> doing that generates a temporary bash script, which in turn runs:
>
> > python setup.py build
>

Yea, I checked this, and /usr/local/bin/python is just a symlink pointing
at /usr/local/bin/python2.7.

Unfortunately Red Hat is slow to update their package versions; even the
most recent RHEL6 comes with Python 2.6.

I think if I can figure out where it wants that pyconfig.h file, it should
work.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Building Python 2.7.3 on RHEL 5.8 x86_64 -- Syntax Error

2013-03-26 Thread Hugo Arts
On Tue, Mar 26, 2013 at 3:18 PM, Sean Carolan  wrote:

>
>  Could it be that it is taking the system python executable which is
>> probably 2.4?
>>
>> -Amit.
>
>
> I've tried it with python24, python25 and python27 and all of them give
> the same error.
>
>
What it looks like to me is that while you run (using python 2.7):

>  python27 setup.py bdist_rpm

doing that generates a temporary bash script, which in turn runs:

> python setup.py build

which is linked to the system default python, which I'm guessing is 2.4. No
matter which version you execute the first one with, the bash script
generated will always try to use the system-default python. This is
essentially a bug in the setup script; it should generate a script that
uses the same python version it was executed with, ideally.

The easiest workaround I can think of is a temporary alias, i.e.:

$ alias python="python27" && python setup.by bdist_rpm && unalias python

Or some variation of such. The more permanent fix is to change the bash
script that setup.py generates so it's less naive about having the right
system python installed, *or* upgrading the system python version.

HTH,
Hugo
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Building Python 2.7.3 on RHEL 5.8 x86_64 -- Syntax Error

2013-03-26 Thread Sean Carolan
Ok, so I'm now attempting a "clean room" installation using Python 2.7.3 to
build the RPM.  Here's my installation command:

./configure --with-zlib=/usr/include; make; sudo make install

But the bdist_rpm setup command fails:

[scarolan@titania:~/Python-2.7.3]$ python2.7 setup.py bdist_rpm

error: pyconfig.h: No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.67699 (%build)

RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.67699 (%build)
error: command 'rpmbuild' failed with exit status 1

Where is it looking for pyconfig.h?




On Tue, Mar 26, 2013 at 10:18 AM, Sean Carolan  wrote:

>
> Could it be that it is taking the system python executable which is
>> probably 2.4?
>>
>> -Amit.
>
>
> I've tried it with python24, python25 and python27 and all of them give
> the same error.
>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Building Python 2.7.3 on RHEL 5.8 x86_64 -- Syntax Error

2013-03-26 Thread Sean Carolan
> Could it be that it is taking the system python executable which is
> probably 2.4?
>
> -Amit.


I've tried it with python24, python25 and python27 and all of them give the
same error.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Building Python 2.7.3 on RHEL 5.8 x86_64 -- Syntax Error

2013-03-26 Thread Amit Saha
On Wed, Mar 27, 2013 at 12:55 AM, Sean Carolan  wrote:
> I'm attempting to use setup.py to build an RPM, but ran into this error:
>
> [scarolan@cobbler:~/rpmbuild/BUILD/Python-2.7.3]$ python27 setup.py
> bdist_rpm
>
>   File "setup.py", line 361
> with open(tmpfile) as fp:
> ^
> SyntaxError: invalid syntax
> error: Bad exit status from /var/tmp/rpm-tmp.8897 (%build)
>
> It appears the syntax error is striggered when "python setup.py build" is
> run from that temporary bash script (/var/tmp/rpm-tmp.8897):

Could it be that it is taking the system python executable which is
probably 2.4?

-Amit.


-- 
http://amitsaha.github.com/
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Building Python 2.7.3 on RHEL 5.8 x86_64 -- Syntax Error

2013-03-26 Thread Sean Carolan
I'm attempting to use setup.py to build an RPM, but ran into this error:

[scarolan@cobbler:~/rpmbuild/BUILD/Python-2.7.3]$ python27 setup.py
bdist_rpm

  File "setup.py", line 361
with open(tmpfile) as fp:
^
SyntaxError: invalid syntax
error: Bad exit status from /var/tmp/rpm-tmp.8897 (%build)

It appears the syntax error is striggered when "python setup.py build" is
run from that temporary bash script (/var/tmp/rpm-tmp.8897):

+ cd
/home/scarolan/rpmbuild/BUILD/Python-2.7.3/build/bdist.linux-x86_64/rpm/BUILD
+ cd Python-2.7.3
+ env 'CFLAGS=-O2 -g -m64 -mtune=generic' python setup.py build
  File "setup.py", line 361
with open(tmpfile) as fp:
^
SyntaxError: invalid syntax

Any ideas how to fix this?  The documentation on this topic is quite scarce.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor