diff --git a/contrib/setup3k.py b/contrib/setup3k.py
index 7ce7177e029a040648ed65048cab491ca6be86cc_Y29udHJpYi9zZXR1cDNrLnB5..f4bc0b9e03a4763b1df1a833b60a93d375db77b6_Y29udHJpYi9zZXR1cDNrLnB5 100644
--- a/contrib/setup3k.py
+++ b/contrib/setup3k.py
@@ -309,7 +309,7 @@
 else:
     extmodules.append(Extension('mercurial.osutil', ['mercurial/osutil.c']))
 
-if sys.platform == 'linux2' and os.uname()[2] > '2.6':
+if sys.platform.startswith('linux') and os.uname()[2] > '2.6':
     # The inotify extension is only usable with Linux 2.6 kernels.
     # You also need a reasonably recent C library.
     # In any case, if it fails to build the error will be skipped ('optional').
diff --git a/hgext/inotify/server.py b/hgext/inotify/server.py
index 7ce7177e029a040648ed65048cab491ca6be86cc_aGdleHQvaW5vdGlmeS9zZXJ2ZXIucHk=..f4bc0b9e03a4763b1df1a833b60a93d375db77b6_aGdleHQvaW5vdGlmeS9zZXJ2ZXIucHk= 100644
--- a/hgext/inotify/server.py
+++ b/hgext/inotify/server.py
@@ -443,7 +443,7 @@
             if err.args[0] != errno.EPIPE:
                 raise
 
-if sys.platform == 'linux2':
+if sys.platform.startswith('linux'):
     import linuxserver as _server
 else:
     raise ImportError
diff --git a/setup.py b/setup.py
index 7ce7177e029a040648ed65048cab491ca6be86cc_c2V0dXAucHk=..f4bc0b9e03a4763b1df1a833b60a93d375db77b6_c2V0dXAucHk= 100644
--- a/setup.py
+++ b/setup.py
@@ -366,7 +366,7 @@
     extmodules.append(Extension('mercurial.osutil', ['mercurial/osutil.c'],
                                 extra_link_args=osutil_ldflags))
 
-if sys.platform == 'linux2' and os.uname()[2] > '2.6':
+if sys.platform.startswith('linux') and os.uname()[2] > '2.6':
     # The inotify extension is only usable with Linux 2.6 kernels.
     # You also need a reasonably recent C library.
     # In any case, if it fails to build the error will be skipped ('optional').