summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorAlastair Houghton <alastair@alastairs-place.net>2016-08-23 09:36:04 +0100
committerAlastair Houghton <alastair@alastairs-place.net>2016-08-23 09:36:04 +0100
commitaae70f3c3d7e67fabf88a9617be1cbf0c21c42c1 (patch)
tree1069ea11e5b13f6f022aa62b6cd70aa0323ebc70 /setup.py
parented36daa5cc734c0ca4ebc811984b51e49549d591 (diff)
parentce1eacefdde30131261958698a0cb080721df443 (diff)
downloadnetifaces-git-aae70f3c3d7e67fabf88a9617be1cbf0c21c42c1.tar.gz
Merged in steffann/netifaces (pull request #5), though it's missing a `close()` call, so until I check in the fix, the tip will leak sockets for IPv6.
Add support for retrieving IPv6 address flags on BSD/Mac-OS
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py61
1 files changed, 59 insertions, 2 deletions
diff --git a/setup.py b/setup.py
index b289cc9..0ce3742 100644
--- a/setup.py
+++ b/setup.py
@@ -22,7 +22,7 @@ else:
output = getattr(builtins, 'print', lambda x: True)
-__version__ = "0.10.4"
+__version__ = "0.10.5"
# Disable hard links, otherwise building distributions fails on OS X
try:
@@ -209,6 +209,63 @@ class my_build_ext(build_ext):
results['have_getnameinfo'] = result
+ if results['have_getifaddrs']:
+ output("checking for IPv6 socket IOCTLs...", end='')
+
+ result = results.get('have_ipv6_socket_ioctls', None)
+ if result is not None:
+ cached = '(cached)'
+ else:
+ cached = ''
+
+ if not os.path.exists(self.build_temp):
+ os.makedirs(self.build_temp)
+ outname = os.path.join(self.build_temp, 'conftest4.out')
+ self.ctout = os.open(outname, os.O_RDWR | os.O_CREAT | os.O_TRUNC)
+
+ result = []
+ ioctls = ('SIOCGIFAFLAG_IN6',)
+ added_includes = ""
+ if mos.startswith('sunos'):
+ added_includes = """
+ #include <unistd.h>
+ #include <stropts.h>
+ #include <sys/sockio.h>
+ """
+
+ for ioctl in ioctls:
+ testrig = """
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <sys/ioctl.h>
+ #include <net/if.h>
+ #include <netinet/in.h>
+ #include <netinet/in_var.h>
+ #include <arpa/inet.h>
+ %(addedinc)s
+ int main(void) {
+ int fd = socket (AF_INET6, SOCK_DGRAM, IPPROTO_IPV6);
+ struct in6_ifreq ifreq;
+
+ ioctl(fd, %(ioctl)s, &ifreq);
+
+ return 0;
+ }
+ """ % { 'ioctl': ioctl , 'addedinc': added_includes}
+
+ if self.test_build(testrig,libraries=libraries):
+ result.append(ioctl)
+
+ if result:
+ output("%r. %s" % (result, cached))
+ for ioctl in result:
+ self.compiler.define_macro('HAVE_%s' % ioctl, 1)
+ self.compiler.define_macro('HAVE_IPV6_SOCKET_IOCTLS', 1)
+ else:
+ output("not found. %s" % cached)
+
+ results['have_ipv6_socket_ioctls'] = result
+
if not results['have_getifaddrs']:
output("checking for socket IOCTLs...", end='')
@@ -361,7 +418,7 @@ class my_build_ext(build_ext):
if not os.path.exists(self.build_temp):
os.makedirs(self.build_temp)
- outname = os.path.join(self.build_temp, 'conftest4.out')
+ outname = os.path.join(self.build_temp, 'conftest5.out')
self.ctout = os.open(outname, os.O_RDWR | os.O_CREAT | os.O_TRUNC)
sockaddrs = ('at', 'ax25', 'dl', 'eon', 'in', 'in6',