Opened 10 years ago

Last modified 9 years ago

#3912 enhancement new

Twisted version scheme differs whether setuptools is installed or not

Reported by: tarek Owned by:
Priority: normal Milestone:
Component: release management Keywords:
Cc: Jean-Paul Calderone, Thijs Triemstra Branch:
Author:

Description

If setuptools is not installed, and if I build a trunk version using twisted setup script, I'll get a : "8.2.0+r27123" for the version number (cooked by twisted.python.versions.Version.short)

If setuptools is installed, it'll cook the version number and the output will differ and will be "8.2.0-r27123".

The behavior should be the same,

Change History (11)

comment:1 Changed 10 years ago by Jean-Paul Calderone

Arg I hate setuptools.

fwiw, Nevow had exactly the same problem. http://divmod.org/trac/ticket/2880

comment:2 Changed 10 years ago by zooko

By the way there is another difference between the SVN revision number appended by setuptools and the one appended by twisted's internal version-number-cooking code. That is that if you commit a new patch to SVN on a different branch then the twisted revision number increments but the setuptools one doesn't. The setuptools one shows the most recent revision on *this* branch.

I would personally prefer it if (a) the Twisted way to cook version numbers happened to result in the same thing as the setuptools way to cook version numbers, for obvious (?) reasons of uniformity among other Python packages, and (b) Twisted didn't have a way to cook version numbers, but instead relied on some external tool whose sole job in life has to do with versioning and packaging and so on.

comment:3 Changed 10 years ago by Jean-Paul Calderone

Cc: Jean-Paul Calderone added
Priority: normalhighest

Hey, radix, please consider this issue and make a determination as to whether it needs to be resolved for Twisted 9.0.

comment:4 Changed 10 years ago by radix

Owner: changed from radix to Jean-Paul Calderone

Was the nevow fix easy? Is the same fix applicable to Twisted? If so, then we can probably get it in really quickly. If someone does that, I'll review it.

comment:5 Changed 10 years ago by Thijs Triemstra

Cc: Thijs Triemstra added

comment:6 Changed 10 years ago by Jean-Paul Calderone

The new fix was to disable the setuptools behavior even when setuptools was installed. The patch for Twisted would probably look something like this:

  • twisted/python/dist.py

     
    8080        if sys.version_info[:3] < (2, 3, 0):
    8181            kw['cmdclass']['build_py'] = build_py_twisted
    8282
     83        try:
     84            import setuptools
     85        except ImportError,:
     86            pass
     87        else:
     88            from distutils.command.sdist import sdist
     89            setup_args['cmdclass'] = {'sdist': sdist}
     90
    8391    if "conditionalExtensions" in kw:
    8492        extensions = kw["conditionalExtensions"]
    8593        del kw["conditionalExtensions"]

(but would probably also include unit tests).

comment:7 Changed 10 years ago by TimAllen

Ticket #4138 involves customizing the sdist command for other reasons, so it might wind up accidentally fixing this ticket too.

I had a look at setuptools' customized sdist and I can't see any evidence of it messing with version strings at all, so I'm not sure how replacing setuptools' sdist with distutils' sdist would help at all. Even if it did, it'd be a pretty difficult thing to write a test for, I think, unless the test was "shell out to 'python setup.py sdist'; look in dist/ and check what shows up", and even then you'd need a buildbot guaranteed to have setuptools installed, and one guaranteed not to.

A better solution might be to update t.p.versions to construct PEP0386-compatible version strings, which presumably would be acceptable input to distutils or setuptools or distribute.

comment:8 Changed 10 years ago by Jonathan Lange

Milestone: Twisted-10.0

This issue wasn't necessary for the 9.0 release, and the 10.0 release is already frozen.

comment:9 Changed 10 years ago by Jean-Paul Calderone

Summary: Twisted version scheme differs wether setuptools is installed or notTwisted version scheme differs whether setuptools is installed or not

comment:10 Changed 9 years ago by Jean-Paul Calderone

Priority: highestnormal

comment:11 Changed 9 years ago by <automation>

Owner: Jean-Paul Calderone deleted
Note: See TracTickets for help on using tickets.