Patchwork [2,of,3,v2] hghave: add demandimport checking

login
register
mail settings
Submitter timeless
Date Aug. 25, 2016, 10:42 p.m.
Message ID <2122bf277e3ad68bd59d.1472164923@gcc2-power8.osuosl.org>
Download mbox | patch
Permalink /patch/16426/
State Superseded
Headers show

Comments

timeless - Aug. 25, 2016, 10:42 p.m.
# HG changeset patch
# User timeless <timeless@mozdev.org>
# Date 1472164235 0
#      Thu Aug 25 22:30:35 2016 +0000
# Node ID 2122bf277e3ad68bd59d1d5cea79fea137b09c5a
# Parent  d240f3e2d0d3f2be06ca5a7b04fa4b6d99e695ff
# Available At https://bitbucket.org/timeless/mercurial-crew
#              hg pull https://bitbucket.org/timeless/mercurial-crew -r 2122bf277e3a
hghave: add demandimport checking
Gábor Stefanik - Aug. 25, 2016, 10:57 p.m.
>



--------------------------------------------------------------------------
This message, including its attachments, is confidential. For more information please read NNG's email policy here:
http://www.nng.com/emailpolicy/
By responding to this email you accept the email policy.


-----Original Message-----
> From: Mercurial-devel [mailto:mercurial-devel-bounces@mercurial-scm.org]

> On Behalf Of timeless

> Sent: Friday, August 26, 2016 12:42 AM

> To: mercurial-devel@mercurial-scm.org

> Subject: [PATCH 2 of 3 v2] hghave: add demandimport checking

>

> # HG changeset patch

> # User timeless <timeless@mozdev.org>

> # Date 1472164235 0

> #      Thu Aug 25 22:30:35 2016 +0000

> # Node ID 2122bf277e3ad68bd59d1d5cea79fea137b09c5a

> # Parent  d240f3e2d0d3f2be06ca5a7b04fa4b6d99e695ff

> # Available At https://bitbucket.org/timeless/mercurial-crew

> #              hg pull https://bitbucket.org/timeless/mercurial-crew -r

> 2122bf277e3a

> hghave: add demandimport checking

>

> diff -r d240f3e2d0d3 -r 2122bf277e3a tests/hghave.py

> --- a/tests/hghave.pyThu Aug 25 22:03:51 2016 +0000

> +++ b/tests/hghave.pyThu Aug 25 22:30:35 2016 +0000

> @@ -522,6 +522,11 @@

>                           br'other supported Python versions')

>      return dpkg and dh and dh_py2

>

> +@check("demandimport", "demandimport enabled") def

> has_demandimport():

> +    return not ('HGDEMANDIMPORT' in os.environ and

> +                os.environ['HGDEMANDIMPORT'] == 'disable')


Again, more concise with os.environ.get().

> +

>  @check("absimport", "absolute_import in __future__")  def

> has_absimport():

>      import __future__

> _______________________________________________

> Mercurial-devel mailing list

> Mercurial-devel@mercurial-scm.org

> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
timeless - Aug. 25, 2016, 11:10 p.m.
Gábor STEFANIK <Gabor.STEFANIK@nng.com> wrote:
> Again, more concise with os.environ.get().

Thanks+Sorry, your email came after I had already sent v3. Sent a v4 with this.

Patch

diff -r d240f3e2d0d3 -r 2122bf277e3a tests/hghave.py
--- a/tests/hghave.py	Thu Aug 25 22:03:51 2016 +0000
+++ b/tests/hghave.py	Thu Aug 25 22:30:35 2016 +0000
@@ -522,6 +522,11 @@ 
                          br'other supported Python versions')
     return dpkg and dh and dh_py2
 
+@check("demandimport", "demandimport enabled")
+def has_demandimport():
+    return not ('HGDEMANDIMPORT' in os.environ and
+                os.environ['HGDEMANDIMPORT'] == 'disable')
+
 @check("absimport", "absolute_import in __future__")
 def has_absimport():
     import __future__