Patchwork [3,of,6] setup: detect statfs

login
register
mail settings
Submitter Jun Wu
Date March 21, 2017, 12:04 a.m.
Message ID <8a5bf6002f2c9f98fbbe.1490054676@localhost.localdomain>
Download mbox | patch
Permalink /patch/19481/
State Accepted
Headers show

Comments

Jun Wu - March 21, 2017, 12:04 a.m.
# HG changeset patch
# User Jun Wu <quark@fb.com>
# Date 1490047878 25200
#      Mon Mar 20 15:11:18 2017 -0700
# Node ID 8a5bf6002f2c9f98fbbe68c216579a7803693d65
# Parent  3706485e7df8662529498360cc09584b185dfcc7
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r 8a5bf6002f2c
setup: detect statfs

statfs is not defined by POSIX but is available in various systems to help
decide filesystem type. Let's detect it and set the macro HAVE_STATFS.

Patch

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -591,7 +591,7 @@  osutil_cflags = []
 osutil_ldflags = []
 
-# platform specific macros: HAVE_SETPROCTITLE
-for plat, func in [(re.compile('freebsd'), 'setproctitle')]:
-    if plat.search(sys.platform) and hasfunction(new_compiler(), func):
+# platform specific macros
+for plat, func in [('bsd', 'setproctitle'), ('bsd|darwin|linux', 'statfs')]:
+    if re.search(plat, sys.platform) and hasfunction(new_compiler(), func):
         osutil_cflags.append('-DHAVE_%s' % func.upper())