Edgewall Software

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#11993 closed defect (fixed)

Mercurial plugin not loaded with setuptools>=8 — at Version 7

Reported by: Peter Suter Owned by:
Priority: normal Milestone: 0.12.7
Component: general Version:
Severity: normal Keywords: setuptools tag_svn_revision
Cc: Dirk Stöcker Branch:
Release Notes:

Removed tag_svn_revision.

API Changes:
Internal Changes:

Description

Trac[loader] ERROR: Skipping "TracMercurial 1.0.0.6.dev0": (version conflict "ContextualVersionConflict: (trac 1.1.3dev-r13332, Requirement.parse('Trac>=1.0dev'), set(['TracMercurial']))"

The mercurial plugin requires Trac >=1.0dev.

But it seems setuptools 8 has changed version parsing:

from pkg_resources import parse_version
parse_version('1.1.3dev-r13332') > parse_version('1.1dev')

In setuptools 7 and below this was True. In setuptools 8 and above this is False.

It seems one of these versions must be changed to be compliant with PEP:0440?

Change History (7)

comment:1 by Peter Suter, 9 years ago

Component: plugin/mercurialgeneral
Milestone: plugin - mercurialnext-dev-1.1.x

Apparently 1.1.3dev-r13332 should become 1.1.3.dev13332. In egg_info we can change tag_build from dev to .dev, but with tag_svn_revision setuptools adds the -r automatically so far. (Though since setuptools 10 that doesn't work anymore out of the box anyway.)

comment:2 by Jun Omae, 9 years ago

The tag_svn_revision option requires pypi:setuptools_svn since setuptools 10.0. See https://bitbucket.org/pypa/setuptools/issue/313.

Even without the changing from dev to .dev, it seems that both version strings are compatible with PEP:0440 and the same value. Unfortunately, tag_svn_revision option currently generates incompatible version string with PEP:0440.

>>> import setuptools
>>> setuptools.__version__
'12.0.5'
>>> parse_version('1.0.3dev')
<Version('1.0.3.dev0')>
>>> parse_version('1.0.3.dev')
<Version('1.0.3.dev0')>
>>> parse_version('1.0.3dev') == parse_version('1.0.3.dev')
True
>>> parse_version('1.0.3dev-r12345')
<LegacyVersion('1.0.3dev-r12345')>
>>> parse_version('1.0.3.dev-r12345')
<LegacyVersion('1.0.3.dev-r12345')>

in reply to:  2 ; comment:3 by Ryan J Ollos, 9 years ago

Replying to jomae:

Unfortunately, tag_svn_revision option currently generates incompatible version string with PEP:0440.

Given the issues we've seen with that option (e.g. th:#10778 seen with plugins - assuming a similar issue could be seen installing Trac), it seems better to just remove it. Do you guys agree?

Last edited 9 years ago by Ryan J Ollos (previous) (diff)

in reply to:  3 comment:4 by Peter Suter, 9 years ago

Replying to rjollos:

it seems better to just remove it. Do you guys agree?

Sadly yes, I don't see a good alternative.

in reply to:  3 comment:5 by Jun Omae, 9 years ago

Replying to rjollos:

…, it seems better to just remove it. Do you guys agree?

Agreed. Otherwise, adding inherited egg_info command.

  • setup.py

     
    1515import sys
    1616
    1717from setuptools import setup, find_packages
     18from setuptools.command.egg_info import egg_info
    1819
    1920min_python = (2, 6)
    2021if sys.version_info < min_python:
     
    5354    # give some context to the warnings we might get when installing Genshi
    5455
    5556
     57class svn_egg_info(egg_info):
     58
     59    def tags(self):
     60        import re
     61        return re.sub(r'\Adev-r([0-9]+)', r'dev\1', egg_info.tags(self))
     62
     63
     64extra.setdefault('cmdclass', {})['egg_info'] = svn_egg_info
     65
     66
    5667setup(
    5768    name = 'Trac',
    5869    version = '1.1.4',

Of course, I don't recommend to use it because the base class of egg_info might be modified in the future.

$ PYTHONPATH=. /dev/shm/venv/bin/python setup.py egg_info
running egg_info
writing requirements to Trac.egg-info/requires.txt
writing Trac.egg-info/PKG-INFO
writing top-level names to Trac.egg-info/top_level.txt
writing dependency_links to Trac.egg-info/dependency_links.txt
writing entry points to Trac.egg-info/entry_points.txt
writing manifest file 'Trac.egg-info/SOURCES.txt'
$ grep '^Version:' Trac.egg-info/PKG-INFO
Version: 1.1.4.dev13863

comment:6 by Ryan J Ollos, 9 years ago

Removed in [13902:13906]. I didn't look closely yet at whether #10658 should be closed.

comment:7 by Peter Suter, 9 years ago

Keywords: tag_svn_revision added
Milestone: next-dev-1.1.x0.12.7
Release Notes: modified (diff)
Resolution: fixed
Status: newclosed

Seems to me both #10658 and this ticket can be closed. Please reopen if I missed something.

Note: See TracTickets for help on using tickets.