[PATCH] setup.py: attempt to use setuptools

Augie Fackler raf at durin42.com
Fri Jan 16 12:14:35 CST 2015


On Jan 16, 2015, at 1:03 PM, Gregory Szorc <gregory.szorc at gmail.com> wrote:

> # HG changeset patch
> # User Gregory Szorc <gregory.szorc at gmail.com>
> # Date 1421431223 28800
> #      Fri Jan 16 10:00:23 2015 -0800
> # Node ID 711fa69653f69a7059966fff1dae1a352244b781
> # Parent  049a9e3a078d7c988cb12ed456aad6ec2779ea69
> setup.py: attempt to use setup tools

I endorse this patch - it should improve things.

> 
> The Python Packaging User Guide recommends setuptools over distutils
> (https://packaging.python.org/en/latest/distributing.html).
> 
> setuptools.setup should be a drop-in replacement for
> distutils.core.setup and this patch should "just work." That being said,
> setuptools does differ from distutils. I wouldn't be surprised if this
> change broke Mercurial packaging somewhere. If it does, it should be
> easy enough to revert.
> 
> With this patch applied, I did notice a new warning when running
> setup.py:
> 
>  UserWarning: The version specified requires normalization, consider
> using '3.2.4+668.41fac217e2e4' instead of '3.2.4+668-41fac217e2e4'.

Sigh, but yes, we'll probably want to move to that at some point.

> 
> Furter research indicates that setuptools may break our current
> dev versioning format in the future.
> 
> The impetus for this patch is to work around
> https://bugs.python.org/issue23246, which was preventing me from easily
> building Mercurial on Windows using the Visual C++ for Python
> distribution.
> 
> In the future, this patch may open the door to other distribution
> potentials for Mercurial, including wheels, which the Python world is
> slowly moving to. On my machine, |python setup.py bdist_wheel| does
> produce a wheel. But I haven't tested whether the wheel is sane.
> 
> diff --git a/setup.py b/setup.py
> --- a/setup.py
> +++ b/setup.py
> @@ -66,10 +66,16 @@ else:
> import os, stat, subprocess, time
> import re
> import shutil
> import tempfile
> +
> +try:
> +    from setuptools import setup
> +except:
> +    from distutils.core import setup
> +
> from distutils import log
> -from distutils.core import setup, Command, Extension
> +from distutils.core import Command, Extension
> from distutils.dist import Distribution
> from distutils.command.build import build
> from distutils.command.build_ext import build_ext
> from distutils.command.build_py import build_py
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20150116/38855bc2/attachment.pgp>


More information about the Mercurial-devel mailing list