Patchwork D1035: codemod: use pycompat.isdarwin

login
register
mail settings
Submitter phabricator
Date Oct. 13, 2017, 6:37 a.m.
Message ID <a9cd97d0b0cfeb9840680784c94a4e50@localhost.localdomain>
Download mbox | patch
Permalink /patch/24815/
State Not Applicable
Headers show

Comments

phabricator - Oct. 13, 2017, 6:37 a.m.
quark updated this revision to Diff 2658.
quark edited the summary of this revision.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1035?vs=2638&id=2658

REVISION DETAIL
  https://phab.mercurial-scm.org/D1035

AFFECTED 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

CHANGE DETAILS




To: quark, #hg-reviewers, spectral
Cc: mercurial-devel

Patch

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -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
diff --git a/mercurial/sslutil.py b/mercurial/sslutil.py
--- a/mercurial/sslutil.py
+++ b/mercurial/sslutil.py
@@ -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.
diff --git a/mercurial/scmposix.py b/mercurial/scmposix.py
--- a/mercurial/scmposix.py
+++ b/mercurial/scmposix.py
@@ -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')
diff --git a/mercurial/posix.py b/mercurial/posix.py
--- a/mercurial/posix.py
+++ b/mercurial/posix.py
@@ -332,7 +332,7 @@ 
 # fallback normcase function for non-ASCII strings
 normcasefallback = normcase
 
-if pycompat.sysplatform == 'darwin':
+if pycompat.isdarwin:
 
     def normcase(path):
         '''
diff --git a/mercurial/cffi/osutil.py b/mercurial/cffi/osutil.py
--- a/mercurial/cffi/osutil.py
+++ b/mercurial/cffi/osutil.py
@@ -16,7 +16,7 @@ 
     pycompat,
 )
 
-if pycompat.sysplatform == 'darwin':
+if pycompat.isdarwin:
     from . import _osutil
 
     ffi = _osutil.ffi
diff --git a/hgext/largefiles/lfutil.py b/hgext/largefiles/lfutil.py
--- a/hgext/largefiles/lfutil.py
+++ b/hgext/largefiles/lfutil.py
@@ -80,7 +80,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)
diff --git a/hgext/fsmonitor/__init__.py b/hgext/fsmonitor/__init__.py
--- a/hgext/fsmonitor/__init__.py
+++ b/hgext/fsmonitor/__init__.py
@@ -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)