On Wed, Oct 21, 2009 at 10:42 AM, M.-A. Lemburg <m...@egenix.com> wrote: > Tarek Ziadé wrote: >> On Tue, Oct 20, 2009 at 5:20 PM, M.-A. Lemburg <m...@egenix.com> wrote: >>>>> The micro-language should provide a limited number of >>>>> variables to use on the conditions: >>>>> >>>>> python_version = sys.version >>>>> sys_platform = sys.platform >>>> >>>> If we adopt such a micro-language (I'm reserving judgment until I've >>>> had more time to read the relevant PEPs carefully), I'd rather see the >>>> names match what's in the Python runtime more closely, probably only >>>> avoiding the call syntax. >>> >>> We could do that as well, yes. >> >> +1 on close names + no call syntax >> >> but, notice that "python_version" here is: "%s.%s" % >> sys.version_info[0], sys.version_info[1] >> >> thats why we came up with that name, to disinguish it from sys.version >> (that contains more stuff) > > I think we do need the full version here, so perhaps using > sys.version.split()[0] would be better or simply the full > version string and then have conditions use >=, <=, <, > > only (ie. not =, since that would likely never match).
Notice that for the comparisons >, < to work, that requires more than string comparisons in case we provide the ability to work with rc versions, because: >>> '2.6.3rc4' < '2.6.3' False We said earlier that we could use sys.hexversion to handle this, but otherwise, at least for the Python version, we can use the StrictVersion() class from Distutils, *But* we ended up thinking that it would be better for the first version to keep just "==", "!=", "in" and "not in" operators and a MAJOR.MINOR string. These are enough just to compare strings, on a limited number of versions for Python. What use case you have in mind for a three numbers version ? > > Note that packages do sometimes need to know that a certain > Python patch level release is installed (e.g. Zope often has > had this need) and a proper dependency checker would have to > detect a possible mismatch. I see. I would rather have this patch info in another variable, and restrict the micro language capabilities as much as possible. Any hint were Zope does this ? Regards Tarek _______________________________________________ Distutils-SIG maillist - Distutils-SIG@python.org http://mail.python.org/mailman/listinfo/distutils-sig