changeset 34647:dacfcdd8b94e

codemod: use pycompat.isdarwin This is done by: sed -i "s/pycompat\.sysplatform == 'darwin'/pycompat.isdarwin/" **/*.py Plus a manual change to `sslutil.py` which involves indentation change that cannot be done by `sed`. Differential Revision: https://phab.mercurial-scm.org/D1035
author Jun Wu <quark@fb.com>
date Thu, 12 Oct 2017 23:34:34 -0700
parents 238abf65a8ad
children 4889b84b15f2
files hgext/fsmonitor/__init__.py hgext/largefiles/lfutil.py mercurial/cffi/osutil.py mercurial/posix.py mercurial/scmposix.py mercurial/sslutil.py mercurial/util.py
diffstat 7 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/fsmonitor/__init__.py	Thu Oct 12 09:04:22 2017 -0700
+++ b/hgext/fsmonitor/__init__.py	Thu Oct 12 23:34:34 2017 -0700
@@ -603,7 +603,7 @@
 def extsetup(ui):
     extensions.wrapfilecache(
         localrepo.localrepository, 'dirstate', wrapdirstate)
-    if pycompat.sysplatform == 'darwin':
+    if pycompat.isdarwin:
         # An assist for avoiding the dangling-symlink fsevents bug
         extensions.wrapfunction(os, 'symlink', wrapsymlink)
 
--- a/hgext/largefiles/lfutil.py	Thu Oct 12 09:04:22 2017 -0700
+++ b/hgext/largefiles/lfutil.py	Thu Oct 12 23:34:34 2017 -0700
@@ -79,7 +79,7 @@
                         encoding.environ.get('APPDATA'))
         if appdata:
             return os.path.join(appdata, longname)
-    elif pycompat.sysplatform == 'darwin':
+    elif pycompat.isdarwin:
         home = encoding.environ.get('HOME')
         if home:
             return os.path.join(home, 'Library', 'Caches', longname)
--- a/mercurial/cffi/osutil.py	Thu Oct 12 09:04:22 2017 -0700
+++ b/mercurial/cffi/osutil.py	Thu Oct 12 23:34:34 2017 -0700
@@ -16,7 +16,7 @@
     pycompat,
 )
 
-if pycompat.sysplatform == 'darwin':
+if pycompat.isdarwin:
     from . import _osutil
 
     ffi = _osutil.ffi
--- a/mercurial/posix.py	Thu Oct 12 09:04:22 2017 -0700
+++ b/mercurial/posix.py	Thu Oct 12 23:34:34 2017 -0700
@@ -332,7 +332,7 @@
 # fallback normcase function for non-ASCII strings
 normcasefallback = normcase
 
-if pycompat.sysplatform == 'darwin':
+if pycompat.isdarwin:
 
     def normcase(path):
         '''
--- a/mercurial/scmposix.py	Thu Oct 12 09:04:22 2017 -0700
+++ b/mercurial/scmposix.py	Thu Oct 12 23:34:34 2017 -0700
@@ -46,7 +46,7 @@
 def userrcpath():
     if pycompat.sysplatform == 'plan9':
         return [encoding.environ['home'] + '/lib/hgrc']
-    elif pycompat.sysplatform == 'darwin':
+    elif pycompat.isdarwin:
         return [os.path.expanduser('~/.hgrc')]
     else:
         confighome = encoding.environ.get('XDG_CONFIG_HOME')
--- a/mercurial/sslutil.py	Thu Oct 12 09:04:22 2017 -0700
+++ b/mercurial/sslutil.py	Thu Oct 12 23:34:34 2017 -0700
@@ -677,8 +677,8 @@
       for using system certificate store CAs in addition to the provided
       cacerts file
     """
-    if (pycompat.sysplatform != 'darwin' or
-                        util.mainfrozen() or not pycompat.sysexecutable):
+    if (not pycompat.isdarwin or util.mainfrozen() or
+        not pycompat.sysexecutable):
         return False
     exe = os.path.realpath(pycompat.sysexecutable).lower()
     return (exe.startswith('/usr/bin/python') or
@@ -736,7 +736,7 @@
 
     # The Apple OpenSSL trick isn't available to us. If Python isn't able to
     # load system certs, we're out of luck.
-    if pycompat.sysplatform == 'darwin':
+    if pycompat.isdarwin:
         # FUTURE Consider looking for Homebrew or MacPorts installed certs
         # files. Also consider exporting the keychain certs to a file during
         # Mercurial install.
--- a/mercurial/util.py	Thu Oct 12 09:04:22 2017 -0700
+++ b/mercurial/util.py	Thu Oct 12 23:34:34 2017 -0700
@@ -1561,7 +1561,7 @@
 
 def gui():
     '''Are we running in a GUI?'''
-    if pycompat.sysplatform == 'darwin':
+    if pycompat.isdarwin:
         if 'SSH_CONNECTION' in encoding.environ:
             # handle SSH access to a box where the user is logged in
             return False