[tahoe-lafs-trac-stream] [tahoe-lafs] #1466: don't attempt to import pyutil; use allmydata.util.verlib or distutils.version.LooseVersion instead
tahoe-lafs
trac at tahoe-lafs.org
Wed Aug 3 09:22:35 PDT 2011
#1466: don't attempt to import pyutil; use allmydata.util.verlib or
distutils.version.LooseVersion instead
----------------------------+-------------------------------------
Reporter: davidsarah | Owner: somebody
Type: defect | Status: new
Priority: major | Milestone: undecided
Component: packaging | Version: 1.8.2
Resolution: | Keywords: pyutil darcsver version
Launchpad Bug: |
----------------------------+-------------------------------------
Description changed by davidsarah:
Old description:
> The {{{src/allmydata/_version.py}} generated by darcsver looks like:
> {{{
>
> # This is the version of this tree, as created by setup.py darcsver from
> the darcs patch
> # information: the main version number is taken from the most recent
> release
> # tag. If some patches have been added since the last release, this will
> have a
> # -NN "build number" suffix, or else a -rNN "revision number" suffix.
> Please see
> # pyutil.version_class for a description of what the different fields
> mean.
>
> __pkgname__ = "allmydata-tahoe"
> verstr = "1.8.2-r5124"
> try:
> from pyutil.version_class import Version as pyutil_Version
> __version__ = pyutil_Version(verstr)
> except (ImportError, ValueError):
> # Maybe there is no pyutil installed, or this may be an older version
> of
> # pyutil.version_class which does not support SVN-alike revision
> numbers.
> from distutils.version import LooseVersion as distutils_Version
> __version__ = distutils_Version(verstr)
> }}}
>
> But we don't declare a dependency on pyutil nor do we check its version
> number, so we have no reason to be sure that it isn't somehow broken.
>
> [source:src/allmydata/util/verlib.py] implements a well-defined
> versioning syntax and has unit tests. Note that
> [source:src/allmydata/__init__.py] already imports
> {{{allmydata.util.verlib}}}. Alternatively,
> {{{distutils.version.LooseVersion}}} could be used all the time rather
> than falling back to it.
>
> It may be more difficult to remove the dependency on pyutil in other
> packages using {{{darcsver}}} that Tahoe depends on, because they don't
> have {{{allmydata.util.verlib}}}. Maybe that's a good reason to use
> {{{distutils.version.LooseVersion}}} all the time.
New description:
The {{{src/allmydata/_version.py}}} generated by darcsver looks like:
{{{
# This is the version of this tree, as created by setup.py darcsver from
the darcs patch
# information: the main version number is taken from the most recent
release
# tag. If some patches have been added since the last release, this will
have a
# -NN "build number" suffix, or else a -rNN "revision number" suffix.
Please see
# pyutil.version_class for a description of what the different fields
mean.
__pkgname__ = "allmydata-tahoe"
verstr = "1.8.2-r5124"
try:
from pyutil.version_class import Version as pyutil_Version
__version__ = pyutil_Version(verstr)
except (ImportError, ValueError):
# Maybe there is no pyutil installed, or this may be an older version
of
# pyutil.version_class which does not support SVN-alike revision
numbers.
from distutils.version import LooseVersion as distutils_Version
__version__ = distutils_Version(verstr)
}}}
But we don't declare a dependency on pyutil nor do we check its version
number, so we have no reason to be sure that it isn't somehow broken.
[source:src/allmydata/util/verlib.py] implements a well-defined versioning
syntax and has unit tests. Note that [source:src/allmydata/__init__.py]
already imports {{{allmydata.util.verlib}}}. Alternatively,
{{{distutils.version.LooseVersion}}} could be used all the time rather
than falling back to it.
It may be more difficult to remove the dependency on pyutil in other
packages using {{{darcsver}}} that Tahoe depends on, because they don't
have {{{allmydata.util.verlib}}}. Maybe that's a good reason to use
{{{distutils.version.LooseVersion}}} all the time.
--
--
Ticket URL: <http://tahoe-lafs.org/trac/tahoe-lafs/ticket/1466#comment:1>
tahoe-lafs <http://tahoe-lafs.org>
secure decentralized storage
More information about the tahoe-lafs-trac-stream
mailing list