diff -r d964d7023aa4 Include/pymath.h --- a/Include/pymath.h Sat Nov 30 17:43:42 2013 -0800 +++ b/Include/pymath.h Thu Nov 28 21:26:19 2013 +0100 @@ -181,7 +181,7 @@ * According to Tim's checkin, the FreeBSD systems use isinf() to work * around a FPE bug on that platform. */ -#if defined(__FreeBSD__) || defined(__OpenBSD__) +#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__Bitrig__) #define Py_OVERFLOWED(X) isinf(X) #else #define Py_OVERFLOWED(X) ((X) != 0.0 && (errno == ERANGE || \ diff -r d964d7023aa4 Include/pyport.h --- a/Include/pyport.h Sat Nov 30 17:43:42 2013 -0800 +++ b/Include/pyport.h Thu Nov 28 21:26:19 2013 +0100 @@ -467,7 +467,8 @@ * This isn't reliable. See Py_OVERFLOWED comments. * X is evaluated more than once. */ -#if defined(__FreeBSD__) || defined(__OpenBSD__) || (defined(__hpux) && defined(__ia64)) +#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__Bitrig__) || \ + (defined(__hpux) && defined(__ia64)) #define _Py_SET_EDOM_FOR_NAN(X) if (isnan(X)) errno = EDOM; #else #define _Py_SET_EDOM_FOR_NAN(X) ; diff -r d964d7023aa4 Lib/ctypes/util.py --- a/Lib/ctypes/util.py Sat Nov 30 17:43:42 2013 -0800 +++ b/Lib/ctypes/util.py Thu Nov 28 21:26:19 2013 +0100 @@ -153,6 +153,7 @@ if (sys.platform.startswith("freebsd") or sys.platform.startswith("openbsd") + or sys.platform.startswith("bitrig") or sys.platform.startswith("dragonfly")): def _num_version(libname): diff -r d964d7023aa4 Lib/test/regrtest.py --- a/Lib/test/regrtest.py Sat Nov 30 17:43:42 2013 -0800 +++ b/Lib/test/regrtest.py Thu Nov 28 21:26:19 2013 +0100 @@ -1433,6 +1433,18 @@ test_ttk_textonly test_multiprocessing """, + 'bitrig0': + """ + test_bsddb + test_bsddb3 + test_curses + test_dl + test_epoll + test_gdb + test_ossaudiodev + test_tk + test_ttk_guionly + """, 'netbsd3': """ test_ascii_formatd diff -r d964d7023aa4 Lib/test/test_fcntl.py --- a/Lib/test/test_fcntl.py Sat Nov 30 17:43:42 2013 -0800 +++ b/Lib/test/test_fcntl.py Thu Nov 28 21:26:19 2013 +0100 @@ -28,7 +28,7 @@ else: start_len = "qq" - if (sys.platform.startswith(('netbsd', 'freebsd', 'openbsd', 'bsdos')) + if (sys.platform.startswith(('netbsd', 'freebsd', 'openbsd', 'bitrig', 'bsdos')) or sys.platform == 'darwin'): if struct.calcsize('l') == 8: off_t = 'l' diff -r d964d7023aa4 Lib/test/test_fileio.py --- a/Lib/test/test_fileio.py Sat Nov 30 17:43:42 2013 -0800 +++ b/Lib/test/test_fileio.py Thu Nov 28 21:26:19 2013 +0100 @@ -297,7 +297,7 @@ self.assertEqual(f.writable(), True) if sys.platform != "darwin" and \ 'bsd' not in sys.platform and \ - not sys.platform.startswith('sunos'): + not sys.platform.startswith(('sunos', 'bitrig')): # Somehow /dev/tty appears seekable on some BSDs self.assertEqual(f.seekable(), False) self.assertEqual(f.isatty(), True) diff -r d964d7023aa4 Lib/test/test_posix.py --- a/Lib/test/test_posix.py Sat Nov 30 17:43:42 2013 -0800 +++ b/Lib/test/test_posix.py Thu Nov 28 21:26:19 2013 +0100 @@ -487,7 +487,8 @@ quirky_platform = ( 'sunos' in sys.platform or 'netbsd' in sys.platform or - 'openbsd' in sys.platform + 'openbsd' in sys.platform or + 'bitrig' in sys.platform ) if quirky_platform: expected_errno = errno.ERANGE diff -r d964d7023aa4 Lib/test/test_subprocess.py --- a/Lib/test/test_subprocess.py Sat Nov 30 17:43:42 2013 -0800 +++ b/Lib/test/test_subprocess.py Thu Nov 28 21:26:19 2013 +0100 @@ -951,7 +951,7 @@ getattr(p, method)(*args) return p - @unittest.skipIf(sys.platform.startswith(('netbsd', 'openbsd')), + @unittest.skipIf(sys.platform.startswith(('netbsd', 'openbsd', 'bitrig')), "Due to known OS bug (issue #16762)") def _kill_dead_process(self, method, *args): # Do not inherit file handles from the parent. diff -r d964d7023aa4 Lib/uuid.py --- a/Lib/uuid.py Sat Nov 30 17:43:42 2013 -0800 +++ b/Lib/uuid.py Thu Nov 28 21:26:19 2013 +0100 @@ -326,7 +326,7 @@ # This works on Linux ('' or '-a'), Tru64 ('-av'), but not all Unixes. for args in ('', '-a', '-av'): - mac = _find_mac('ifconfig', args, ['hwaddr', 'ether'], lambda i: i+1) + mac = _find_mac('ifconfig', args, ['hwaddr', 'ether', 'lladdr'], lambda i: i+1) if mac: return mac diff -r d964d7023aa4 Modules/nismodule.c --- a/Modules/nismodule.c Sat Nov 30 17:43:42 2013 -0800 +++ b/Modules/nismodule.c Thu Nov 28 21:26:19 2013 +0100 @@ -89,7 +89,7 @@ return map; } -#if defined(__APPLE__) || defined(__OpenBSD__) || defined(__FreeBSD__) +#if defined(__APPLE__) || defined(__OpenBSD__) || defined(__Bitrig__) || defined(__FreeBSD__) typedef int (*foreachfunc)(unsigned long, char *, int, char *, int, void *); #else typedef int (*foreachfunc)(int, char *, int, char *, int, char *); diff -r d964d7023aa4 Modules/ossaudiodev.c --- a/Modules/ossaudiodev.c Sat Nov 30 17:43:42 2013 -0800 +++ b/Modules/ossaudiodev.c Thu Nov 28 21:26:19 2013 +0100 @@ -30,7 +30,7 @@ #endif #include -#include +#include #if defined(linux) @@ -1046,6 +1046,7 @@ /* Expose all the ioctl numbers for masochists who like to do this stuff directly. */ +#ifdef SNDCTL_COPR_HALT _EXPORT_INT(m, SNDCTL_COPR_HALT); _EXPORT_INT(m, SNDCTL_COPR_LOAD); _EXPORT_INT(m, SNDCTL_COPR_RCODE); @@ -1056,6 +1057,7 @@ _EXPORT_INT(m, SNDCTL_COPR_SENDMSG); _EXPORT_INT(m, SNDCTL_COPR_WCODE); _EXPORT_INT(m, SNDCTL_COPR_WDATA); +#endif #ifdef SNDCTL_DSP_BIND_CHANNEL _EXPORT_INT(m, SNDCTL_DSP_BIND_CHANNEL); #endif @@ -1098,18 +1100,25 @@ _EXPORT_INT(m, SNDCTL_DSP_STEREO); _EXPORT_INT(m, SNDCTL_DSP_SUBDIVIDE); _EXPORT_INT(m, SNDCTL_DSP_SYNC); +#ifdef SNDCTL_FM_4OP_ENABLE _EXPORT_INT(m, SNDCTL_FM_4OP_ENABLE); _EXPORT_INT(m, SNDCTL_FM_LOAD_INSTR); +#endif +#ifdef SNDCTL_MIDI_INFO _EXPORT_INT(m, SNDCTL_MIDI_INFO); _EXPORT_INT(m, SNDCTL_MIDI_MPUCMD); _EXPORT_INT(m, SNDCTL_MIDI_MPUMODE); _EXPORT_INT(m, SNDCTL_MIDI_PRETIME); +#endif +#ifdef SNDCTL_SEQ_CTRLRATE _EXPORT_INT(m, SNDCTL_SEQ_CTRLRATE); _EXPORT_INT(m, SNDCTL_SEQ_GETINCOUNT); _EXPORT_INT(m, SNDCTL_SEQ_GETOUTCOUNT); +#endif #ifdef SNDCTL_SEQ_GETTIME _EXPORT_INT(m, SNDCTL_SEQ_GETTIME); #endif +#ifdef SNDCTL_SEQ_NRMIDIS _EXPORT_INT(m, SNDCTL_SEQ_NRMIDIS); _EXPORT_INT(m, SNDCTL_SEQ_NRSYNTHS); _EXPORT_INT(m, SNDCTL_SEQ_OUTOFBAND); @@ -1120,17 +1129,21 @@ _EXPORT_INT(m, SNDCTL_SEQ_SYNC); _EXPORT_INT(m, SNDCTL_SEQ_TESTMIDI); _EXPORT_INT(m, SNDCTL_SEQ_THRESHOLD); +#endif #ifdef SNDCTL_SYNTH_CONTROL _EXPORT_INT(m, SNDCTL_SYNTH_CONTROL); #endif #ifdef SNDCTL_SYNTH_ID _EXPORT_INT(m, SNDCTL_SYNTH_ID); #endif +#ifdef SNDCTL_SYNTH_INFO _EXPORT_INT(m, SNDCTL_SYNTH_INFO); _EXPORT_INT(m, SNDCTL_SYNTH_MEMAVL); +#endif #ifdef SNDCTL_SYNTH_REMOVESAMPLE _EXPORT_INT(m, SNDCTL_SYNTH_REMOVESAMPLE); #endif +#ifdef SNDCTL_TMR_CONTINUE _EXPORT_INT(m, SNDCTL_TMR_CONTINUE); _EXPORT_INT(m, SNDCTL_TMR_METRONOME); _EXPORT_INT(m, SNDCTL_TMR_SELECT); @@ -1139,4 +1152,5 @@ _EXPORT_INT(m, SNDCTL_TMR_STOP); _EXPORT_INT(m, SNDCTL_TMR_TEMPO); _EXPORT_INT(m, SNDCTL_TMR_TIMEBASE); +#endif } diff -r d964d7023aa4 Modules/posixmodule.c --- a/Modules/posixmodule.c Sat Nov 30 17:43:42 2013 -0800 +++ b/Modules/posixmodule.c Thu Nov 28 21:26:19 2013 +0100 @@ -2098,6 +2098,7 @@ #if (defined(__sun) && defined(__SVR4)) || \ defined(__OpenBSD__) || \ + defined(__Bitrig__) || \ defined(__NetBSD__) /* Issue 9185: getcwd() returns NULL/ERANGE indefinitely. */ static PyObject * diff -r d964d7023aa4 Modules/selectmodule.c --- a/Modules/selectmodule.c Sat Nov 30 17:43:42 2013 -0800 +++ b/Modules/selectmodule.c Thu Nov 28 21:26:19 2013 +0100 @@ -1219,7 +1219,7 @@ /* * kevent is not standard and its members vary across BSDs. */ -#if !defined(__OpenBSD__) +#if !defined(__OpenBSD__) && !defined(__Bitrig__) # define IDENT_TYPE T_UINTPTRT # define IDENT_CAST Py_intptr_t # define DATA_TYPE T_INTPTRT diff -r d964d7023aa4 Modules/socketmodule.c --- a/Modules/socketmodule.c Sat Nov 30 17:43:42 2013 -0800 +++ b/Modules/socketmodule.c Thu Nov 28 21:26:19 2013 +0100 @@ -182,7 +182,7 @@ (this includes the getaddrinfo emulation) protect access with a lock. */ #if defined(WITH_THREAD) && (defined(__APPLE__) || \ (defined(__FreeBSD__) && __FreeBSD_version+0 < 503000) || \ - defined(__OpenBSD__) || defined(__NetBSD__) || \ + defined(__OpenBSD__) || defined(__Bitrig__) || defined(__NetBSD__) || \ defined(__VMS) || !defined(HAVE_GETADDRINFO)) #define USE_GETADDRINFO_LOCK #endif diff -r d964d7023aa4 configure --- a/configure Sat Nov 30 17:43:42 2013 -0800 +++ b/configure Thu Nov 28 21:26:19 2013 +0100 @@ -3261,7 +3261,7 @@ $as_echo "#define _BSD_SOURCE 1" >>confdefs.h ;; - OpenBSD/*) + OpenBSD/*|Bitrig/*) # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is # also defined. This can be overridden by defining _BSD_SOURCE # As this has a different meaning on Linux, only define it on OpenBSD @@ -5351,7 +5351,7 @@ RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH} INSTSONAME="$LDLIBRARY".$SOVERSION ;; - Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*) + Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*|Bitrig*) LDLIBRARY='libpython$(VERSION).so' BLDLIBRARY='-L. -lpython$(VERSION)' RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH} @@ -5359,6 +5359,9 @@ FreeBSD*) SOVERSION=`echo $SOVERSION|cut -d "." -f 1` ;; + OpenBSD*|Bitrig*) + SOVERSION=0.0 + ;; esac INSTSONAME="$LDLIBRARY".$SOVERSION ;; @@ -8268,7 +8271,7 @@ else LDSHARED="ld -Bshareable" fi;; - OpenBSD*) + OpenBSD*|Bitrig*) if [ "`$CC -dM -E -