I guess this error is caused by Numeric-16.0 taking the distutils version string list a bit too seriously. The setup.py script wants to do if vs[0] < 1 and vs[1] < 9: raise SystemExit, "Please see README: Distutils-0.9 or later required." is there a correct way to get this kind of version number? C:\Python\devel\Numeric-16.0>python setup.py build Traceback (innermost last): File "setup.py", line 14, in ? vs = map(string.atoi, string.split(v, '.')) File "<built-in>", line 2, in map ValueError: invalid literal for atoi(): 2pre -- Robin Becker
Robin Becker wrote:
I guess this error is caused by Numeric-16.0 taking the distutils version string list a bit too seriously. The setup.py script wants to do if vs[0] < 1 and vs[1] < 9: raise SystemExit, "Please see README: Distutils-0.9 or later required."
is there a correct way to get this kind of version number?
Distutils has some special classes for dealing with version numbers, see distutils/version.py . Your code should then look similar to this: from distutils.version import StrictVersion if StrictVersion(v) < "0.9": raise SystemExit, "Please see README: Distutils-0.9 or later required." Kind regards Rene Liebscher
OK, I'll fix it. But first convince me this "<" really works though? 0.10 vs. 0.9, for example?
-----Original Message----- From: distutils-sig-admin@python.org [mailto:distutils-sig-admin@python.org]On Behalf Of Rene Liebscher Sent: Wednesday, August 30, 2000 3:43 AM To: Robin Becker Cc: distutils-sig@python.org Subject: Re: [Distutils] Numeric-16.0 problem
Robin Becker wrote:
I guess this error is caused by Numeric-16.0 taking the
distutils version string
list a bit too seriously. The setup.py script wants to do if vs[0] < 1 and vs[1] < 9: raise SystemExit, "Please see README: Distutils-0.9 or later required."
is there a correct way to get this kind of version number?
Distutils has some special classes for dealing with version numbers, see distutils/version.py .
Your code should then look similar to this:
from distutils.version import StrictVersion
if StrictVersion(v) < "0.9": raise SystemExit, "Please see README: Distutils-0.9 or later required."
Kind regards
Rene Liebscher
_______________________________________________ Distutils-SIG maillist - Distutils-SIG@python.org http://www.python.org/mailman/listinfo/distutils-sig
On 30 August 2000, Paul F. Dubois said:
OK, I'll fix it. But first convince me this "<" really works though? 0.10 vs. 0.9, for example?
It works, depending on how you define "works". In the "strict versioning" scheme, version numbers are dot-separated integer tuples, not floating-point numbers. Thus, "0.10" != "0.1", but "0.1.0" == "0.1" (a slight corruption of the integer-tuple view, made as a concession to reality). This is the version numbering scheme advocated by the GNU project, and by ESR's "Software Release Howto". It works for me, and it's the scheme that will always be used by the Distutils. So yes, it's safe to say if StrictVersion(distutils.__version__) < "0.9" ...except that I use "0.9.2pre" for pre-release development code, which makes StrictVersion blow up. Foo! I think it's time StrictVersion was revisited and made a little less strict, since I'm not *quite* such a version number fascist as I was 18 months ago, when I wrote that code. ;-) Greg
Paul F. Dubois writes:
OK, I'll fix it. But first convince me this "<" really works though? 0.10 vs. 0.9, for example?
Actually, the easiest way to deal with this would be for distutils to provide a version_info structure like that defined in the sys module (starting with Python 1.6something): import distutils if distutils.version_info < (0, 9): bad_distutils_version() else: setup(...) The definition of sys.version_info guarantees that the value monotonically increases with each new release so long as we don't change the numbering scheme, and comparisons against only the interesting prefix (as above) work reasonably. -Fred -- Fred L. Drake, Jr. <fdrake at beopen.com> BeOpen PythonLabs Team Member
import distutils if distutils.version_info < (0, 9): bad_distutils_version() else: setup(...)
The definition of sys.version_info guarantees that the value monotonically increases with each new release so long as we don't change the numbering scheme, and comparisons against only the interesting prefix (as above) work reasonably.
-Fred
And THAT works? comparison of tuples is lexographic? Really? This sig is full of odd things. Hidden Secrets of Python -- by Fred L. Drake, Jr. At a newstand near you. Just imagine the wealth and fame.
Paul F. Dubois writes:
And THAT works? comparison of tuples is lexographic? Really? This sig is full of odd things.
The values in the tuple are integers, not strings: Python 2.0b1 (#248, Aug 31 2000, 00:55:23) [GCC 2.95.3 19991030 (prerelease)] on linux2 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam Copyright 1995-2000 Corporation for National Research Initiatives (CNRI)
sys.version_info (2, 0, 0, 'beta', 1)
The values for the fourth entry are specifically chosen so that lexicographic comparison works: "alpha" < "beta" < "candidate" < "final" -Fred -- Fred L. Drake, Jr. <fdrake at beopen.com> BeOpen PythonLabs Team Member
On Thu, 31 Aug 2000, Fred L. Drake, Jr. wrote:
Paul F. Dubois writes:
And THAT works? comparison of tuples is lexographic? Really? This sig is full of odd things.
The values in the tuple are integers, not strings:
Python 2.0b1 (#248, Aug 31 2000, 00:55:23) [GCC 2.95.3 19991030 (prerelease)] on linux2 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam Copyright 1995-2000 Corporation for National Research Initiatives (CNRI)
sys.version_info (2, 0, 0, 'beta', 1)
The values for the fourth entry are specifically chosen so that lexicographic comparison works:
"alpha" < "beta" < "candidate" < "final"
-Fred
-- Fred L. Drake, Jr. <fdrake at beopen.com> BeOpen PythonLabs Team Member
What I meant was that I hadn't known that comparison of tuples was meaningful at all; evidently you are teaching me that the comparisons of tuples are lexographic in the sense that it compares the first entries and only proceeds to the next component if the first entries are equal, etc. Python is full of little surprises, almost always pleasant.
Paul F. Dubois writes:
What I meant was that I hadn't known that comparison of tuples was meaningful at all; evidently you are teaching me that the comparisons of tuples are lexographic in the sense that it compares the first entries and only proceeds to the next component if the first entries are equal, etc. Python is full of little surprises, almost always pleasant.
Yes. Just as interestingly, this has been there a long time. Guido must have used his time machine to know we would have this specific requirement for comparing version numbers, and generalized effectively to begin with. ;) -Fred -- Fred L. Drake, Jr. <fdrake at beopen.com> BeOpen PythonLabs Team Member
participants (6)
-
Fred L. Drake, Jr.
-
Greg Ward
-
Paul F. Dubois
-
Rene Liebscher
-
Robin Becker
-
Tim Peters