[PATCH 3 of 8 v2] cleanup: replace hasattr() usage with getattr() in hghave

Brodie Rao brodie at sf.io
Sat May 12 09:03:19 CDT 2012


# HG changeset patch
# User Brodie Rao <brodie at sf.io>
# Date 1336831253 -7200
# Node ID 60e7e0ed504f1d63836e50bf743c9b80531cc841
# Parent  3c7a3aeb7bb4690b4f8fb99a37012bdca50a466b
cleanup: replace hasattr() usage with getattr() in hghave

diff --git a/tests/hghave b/tests/hghave
--- a/tests/hghave
+++ b/tests/hghave
@@ -106,7 +106,7 @@ def has_inotify():
         return False
 
 def has_fifo():
-    return hasattr(os, "mkfifo")
+    return getattr(os, "mkfifo", None) is not None
 
 def has_cacheable_fs():
     from mercurial import util
@@ -169,7 +169,7 @@ def has_p4():
             matchoutput('p4d -V', r'Rev\. P4D/'))
 
 def has_symlink():
-    if not hasattr(os, "symlink"):
+    if getattr(os, "symlink", None) is None:
         return False
     name = tempfile.mktemp(dir=".", prefix='hg-checklink-')
     try:


More information about the Mercurial-devel mailing list