Patchwork [STABLE] setup: silence warning of unknown option python_requires on distutils

login
register
mail settings
Submitter Yuya Nishihara
Date July 27, 2017, 2:34 p.m.
Message ID <08f557c2b20e2ae98f57.1501166084@mimosa>
Download mbox | patch
Permalink /patch/22564/
State Accepted
Headers show

Comments

Yuya Nishihara - July 27, 2017, 2:34 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1501164914 -32400
#      Thu Jul 27 23:15:14 2017 +0900
# Branch stable
# Node ID 08f557c2b20e2ae98f57b76fcb2ea0d870cfdcba
# Parent  c5607b65fcb8cf5b789c49a8cf4fecfe83931727
setup: silence warning of unknown option python_requires on distutils

  /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution
  option: 'python_requires'
Augie Fackler - July 27, 2017, 6:46 p.m.
> On Jul 27, 2017, at 10:34, Yuya Nishihara <yuya@tcha.org> wrote:
> 
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1501164914 -32400
> #      Thu Jul 27 23:15:14 2017 +0900
> # Branch stable
> # Node ID 08f557c2b20e2ae98f57b76fcb2ea0d870cfdcba
> # Parent  c5607b65fcb8cf5b789c49a8cf4fecfe83931727
> setup: silence warning of unknown option python_requires on distutils

Sigh. Queued for stable, thanks.

> 
>  /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution
>  option: 'python_requires'
> 
> diff --git a/setup.py b/setup.py
> --- a/setup.py
> +++ b/setup.py
> @@ -111,7 +111,8 @@ from distutils import log
> # We have issues with setuptools on some platforms and builders. Until
> # those are resolved, setuptools is opt-in except for platforms where
> # we don't have issues.
> -if os.name == 'nt' or 'FORCE_SETUPTOOLS' in os.environ:
> +issetuptools = (os.name == 'nt' or 'FORCE_SETUPTOOLS' in os.environ)
> +if issetuptools:
>     from setuptools import setup
> else:
>     from distutils.core import setup
> @@ -843,6 +844,8 @@ setupversion = version.decode('ascii')
> 
> extra = {}
> 
> +if issetuptools:
> +    extra['python_requires'] = supportedpy
> if py2exeloaded:
>     extra['console'] = [
>         {'script':'hg',
> @@ -937,5 +940,4 @@ setup(name='mercurial',
>                               'welcome': 'contrib/macosx/Welcome.html',
>                               },
>                },
> -      python_requires=supportedpy,
>       **extra)
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -111,7 +111,8 @@  from distutils import log
 # We have issues with setuptools on some platforms and builders. Until
 # those are resolved, setuptools is opt-in except for platforms where
 # we don't have issues.
-if os.name == 'nt' or 'FORCE_SETUPTOOLS' in os.environ:
+issetuptools = (os.name == 'nt' or 'FORCE_SETUPTOOLS' in os.environ)
+if issetuptools:
     from setuptools import setup
 else:
     from distutils.core import setup
@@ -843,6 +844,8 @@  setupversion = version.decode('ascii')
 
 extra = {}
 
+if issetuptools:
+    extra['python_requires'] = supportedpy
 if py2exeloaded:
     extra['console'] = [
         {'script':'hg',
@@ -937,5 +940,4 @@  setup(name='mercurial',
                               'welcome': 'contrib/macosx/Welcome.html',
                               },
                },
-      python_requires=supportedpy,
       **extra)