* [StGIT] Failure to install on RHELWS4
@ 2008-07-11 17:03 Petr Baudis
2008-07-11 19:26 ` Thomas Rast
0 siblings, 1 reply; 8+ messages in thread
From: Petr Baudis @ 2008-07-11 17:03 UTC (permalink / raw)
To: git
Hi,
I wanted to install latest HEAD of StGIT on a rather ancient-feeling
RHEL4, however, when doing python setup.py install, I'm getting
File "setup.py", line 31
pyver = '.'.join(str(n) for n in sys.version_info)
^
SyntaxError: invalid syntax
I don't really know python and the ^ is rather curiously-positioned, so
I don't have much clue on what is going on. Python version is 2.3.4 -
maybe that's too old, but I didn't find any word on the minimal Python
version nowhere in the documentation.
--
Petr "Pasky" Baudis
The last good thing written in C++ was the Pachelbel Canon. -- J. Olson
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [StGIT] Failure to install on RHELWS4
2008-07-11 17:03 [StGIT] Failure to install on RHELWS4 Petr Baudis
@ 2008-07-11 19:26 ` Thomas Rast
2008-07-11 20:07 ` Miklos Vajna
0 siblings, 1 reply; 8+ messages in thread
From: Thomas Rast @ 2008-07-11 19:26 UTC (permalink / raw)
To: Petr Baudis; +Cc: Git Mailing List
[-- Attachment #1: Type: text/plain, Size: 348 bytes --]
Petr Baudis wrote:
>
> pyver = '.'.join(str(n) for n in sys.version_info)
> ^
[...]
> Python version is 2.3.4
That is indeed too old. Generator expressions like the above were
introduced in 2.4:
http://www.python.org/dev/peps/pep-0289/
- Thomas
--
Thomas Rast
trast@student.ethz.ch
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [StGIT] Failure to install on RHELWS4
2008-07-11 19:26 ` Thomas Rast
@ 2008-07-11 20:07 ` Miklos Vajna
2008-07-11 20:09 ` [PATCH] setup.py: fix error message when running with python-2.3 Miklos Vajna
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Miklos Vajna @ 2008-07-11 20:07 UTC (permalink / raw)
To: Catalin Marinas; +Cc: Thomas Rast, Petr Baudis, Git Mailing List
[-- Attachment #1: Type: text/plain, Size: 679 bytes --]
On Fri, Jul 11, 2008 at 09:26:29PM +0200, Thomas Rast <trast@student.ethz.ch> wrote:
> > pyver = '.'.join(str(n) for n in sys.version_info)
> > ^
> [...]
> > Python version is 2.3.4
>
> That is indeed too old. Generator expressions like the above were
> introduced in 2.4:
>
> http://www.python.org/dev/peps/pep-0289/
So obviously it's a bad idea to use generators for such a version check.
Also, setup.py would try to import stgit.run before the version check.
I'm sending two patches, which restore the wished "Python version 2.4 or
newer required. Found 2.2.1.final.0" error message.
(Tested with Python 2.2.1.)
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] setup.py: fix error message when running with python-2.3
2008-07-11 20:07 ` Miklos Vajna
@ 2008-07-11 20:09 ` Miklos Vajna
2008-07-12 5:19 ` Karl Hasselström
2008-07-11 20:09 ` [PATCH] setup.py: don't try to import stgit.run before the python version check Miklos Vajna
2008-07-11 21:35 ` [StGIT] Failure to install on RHELWS4 Catalin Marinas
2 siblings, 1 reply; 8+ messages in thread
From: Miklos Vajna @ 2008-07-11 20:09 UTC (permalink / raw)
To: Catalin Marinas; +Cc: Thomas Rast, Petr Baudis, Git Mailing List
When setup.py tries to check the python version, the check actually
won't give a usable error message but it'll raise a SyntaxError. Fix
this by not using generator expressions.
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
setup.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/setup.py b/setup.py
index 8d8f7a8..44cc6ea 100755
--- a/setup.py
+++ b/setup.py
@@ -28,7 +28,7 @@ def __check_min_version(min_ver, ver):
def __check_python_version():
"""Check the minimum Python version
"""
- pyver = '.'.join(str(n) for n in sys.version_info)
+ pyver = '.'.join(map(lambda x: str(x), sys.version_info))
if not __check_min_version(version.python_min_ver, pyver):
print >> sys.stderr, 'Python version %s or newer required. Found %s' \
% (version.python_min_ver, pyver)
--
1.5.6.2.450.g8d367.dirty
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH] setup.py: don't try to import stgit.run before the python version check
2008-07-11 20:07 ` Miklos Vajna
2008-07-11 20:09 ` [PATCH] setup.py: fix error message when running with python-2.3 Miklos Vajna
@ 2008-07-11 20:09 ` Miklos Vajna
2008-07-16 4:39 ` Karl Hasselström
2008-07-11 21:35 ` [StGIT] Failure to install on RHELWS4 Catalin Marinas
2 siblings, 1 reply; 8+ messages in thread
From: Miklos Vajna @ 2008-07-11 20:09 UTC (permalink / raw)
To: Catalin Marinas; +Cc: Thomas Rast, Petr Baudis, Git Mailing List
stgit.run would import datetime, which is not available in older python
versions. import it just after the version check passed.
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
setup.py | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/setup.py b/setup.py
index 44cc6ea..a685cf6 100755
--- a/setup.py
+++ b/setup.py
@@ -4,7 +4,6 @@ import sys, glob, os
from distutils.core import setup
from stgit import version
-from stgit.run import Run
def __version_to_list(version):
"""Convert a version string to a list of numbers or strings
@@ -68,6 +67,8 @@ if sys.argv[1] in ['install', 'build']:
__check_python_version()
__check_git_version()
+from stgit.run import Run
+
# ensure readable template files
old_mask = os.umask(0022)
--
1.5.6.2.450.g8d367.dirty
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [StGIT] Failure to install on RHELWS4
2008-07-11 20:07 ` Miklos Vajna
2008-07-11 20:09 ` [PATCH] setup.py: fix error message when running with python-2.3 Miklos Vajna
2008-07-11 20:09 ` [PATCH] setup.py: don't try to import stgit.run before the python version check Miklos Vajna
@ 2008-07-11 21:35 ` Catalin Marinas
2 siblings, 0 replies; 8+ messages in thread
From: Catalin Marinas @ 2008-07-11 21:35 UTC (permalink / raw)
To: Miklos Vajna
Cc: Thomas Rast, Petr Baudis, Git Mailing List, Karl Hasselström
2008/7/11 Miklos Vajna <vmiklos@frugalware.org>:
> On Fri, Jul 11, 2008 at 09:26:29PM +0200, Thomas Rast <trast@student.ethz.ch> wrote:
>> > pyver = '.'.join(str(n) for n in sys.version_info)
>> > ^
>> [...]
>> > Python version is 2.3.4
>>
>> That is indeed too old. Generator expressions like the above were
>> introduced in 2.4:
>>
>> http://www.python.org/dev/peps/pep-0289/
>
> So obviously it's a bad idea to use generators for such a version check.
Yes, I agree.
> Also, setup.py would try to import stgit.run before the version check.
>
> I'm sending two patches, which restore the wished "Python version 2.4 or
> newer required. Found 2.2.1.final.0" error message.
Thanks.
--
Catalin
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] setup.py: fix error message when running with python-2.3
2008-07-11 20:09 ` [PATCH] setup.py: fix error message when running with python-2.3 Miklos Vajna
@ 2008-07-12 5:19 ` Karl Hasselström
0 siblings, 0 replies; 8+ messages in thread
From: Karl Hasselström @ 2008-07-12 5:19 UTC (permalink / raw)
To: Miklos Vajna; +Cc: Catalin Marinas, Thomas Rast, Petr Baudis, Git Mailing List
On 2008-07-11 22:09:31 +0200, Miklos Vajna wrote:
> When setup.py tries to check the python version, the check actually
> won't give a usable error message but it'll raise a SyntaxError. Fix
> this by not using generator expressions.
> - pyver = '.'.join(str(n) for n in sys.version_info)
> + pyver = '.'.join(map(lambda x: str(x), sys.version_info))
Thanks. And by not using a list comprehension, you stay compatible
with pre-2.0 versions as well (though I guess we'd need to test that,
since there may be other 2.0 things we rely on in this code path).
--
Karl Hasselström, kha@treskal.com
www.treskal.com/kalle
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] setup.py: don't try to import stgit.run before the python version check
2008-07-11 20:09 ` [PATCH] setup.py: don't try to import stgit.run before the python version check Miklos Vajna
@ 2008-07-16 4:39 ` Karl Hasselström
0 siblings, 0 replies; 8+ messages in thread
From: Karl Hasselström @ 2008-07-16 4:39 UTC (permalink / raw)
To: Miklos Vajna; +Cc: Catalin Marinas, Thomas Rast, Petr Baudis, Git Mailing List
On 2008-07-11 22:09:32 +0200, Miklos Vajna wrote:
> @@ -68,6 +67,8 @@ if sys.argv[1] in ['install', 'build']:
> __check_python_version()
> __check_git_version()
>
> +from stgit.run import Run
> +
> # ensure readable template files
> old_mask = os.umask(0022)
>
I had to modify the second hunk to make it work:
@@ -37,6 +36,7 @@ def __check_python_version():
def __check_git_version():
"""Check the minimum GIT version
"""
+ from stgit.run import Run
gitver = Run('git', '--version').output_one_line().split()[2]
if not __check_min_version(git_min_ver, gitver):
print >> sys.stderr, 'GIT version %s or newer required. Found %s' \
--
Karl Hasselström, kha@treskal.com
www.treskal.com/kalle
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2008-07-16 4:41 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-11 17:03 [StGIT] Failure to install on RHELWS4 Petr Baudis
2008-07-11 19:26 ` Thomas Rast
2008-07-11 20:07 ` Miklos Vajna
2008-07-11 20:09 ` [PATCH] setup.py: fix error message when running with python-2.3 Miklos Vajna
2008-07-12 5:19 ` Karl Hasselström
2008-07-11 20:09 ` [PATCH] setup.py: don't try to import stgit.run before the python version check Miklos Vajna
2008-07-16 4:39 ` Karl Hasselström
2008-07-11 21:35 ` [StGIT] Failure to install on RHELWS4 Catalin Marinas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).