Edgewall Software
Modify

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#11993 closed defect (fixed)

Mercurial plugin not loaded with setuptools>=8

Reported by: Peter Suter Owned by: Peter Suter
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:

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?

Attachments (0)

Change History (10)

comment:1 Changed 4 years ago by Peter Suter

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 Changed 4 years ago by Jun Omae

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')>

comment:3 in reply to:  2 ; Changed 4 years ago by Ryan J Ollos

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 4 years ago by Ryan J Ollos (previous) (diff)

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

Replying to rjollos:

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

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

comment:5 in reply to:  3 Changed 4 years ago by Jun Omae

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 Changed 4 years ago by Ryan J Ollos

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

comment:7 Changed 4 years ago by Peter Suter

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.

comment:8 Changed 4 years ago by Ryan J Ollos

Owner: set to Peter Suter

comment:9 Changed 4 years ago by Ryan J Ollos

Cc: Dirk Stöcker added

SpamFilter also has a tag_svn_revision in setup.cfg.

comment:10 in reply to:  9 Changed 4 years ago by Ryan J Ollos

Replying to rjollos:

SpamFilter also has a tag_svn_revision in setup.cfg.

I opened #12038 after encountering a problem due to the invalid version number.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Peter Suter.
The resolution will be deleted.
to The owner will be changed from Peter Suter to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.