return True if user may need to turn shell off
    if mac OS version is 16 (sierra) or higher, may need to set shell off due
    to os's security requirements
    http://stackoverflow.com/questions/39702871/gdb-kind-of-doesnt-work-on-macos-sierra
335428
def warn_startup_with_shell_off(platform, gdb_args):
    
    darwin_match = re.match("darwin-(\d+)\..*", platform)
    on_darwin = darwin_match is not None and int(darwin_match.groups()[0]) >= 16
    if on_darwin:
        shell_is_off = "startup-with-shell off" in gdb_args
        return not shell_is_off
    return False
214402
def on_windows ():
    
    if bjam.variable("NT"):
        return True

    elif bjam.variable("UNIX"):

        uname = bjam.variable("JAMUNAME")
        if uname and uname[0].startswith("CYGWIN"):
            return True

    return False
1125622
def check(self):
        
        g = get_root(self).globals
        if self.stopped_ok:
            # Exposure stopped OK; modify buttons
            self.disable()

            # try and write FITS table before enabling start button, otherwise
            # a new start will clear table
            try:
                insertFITSHDU(g)
            except Exception as err:
                g.clog.warn('Could not add FITS Table to run')
                g.clog.warn(str(err))

            g.observe.start.enable()
            g.setup.powerOn.disable()
            g.setup.powerOff.enable()

            # Report that run has stopped
            g.clog.info('Run stopped')

            # enable idle mode now run has stopped
            g.clog.info('Setting chips to idle')
            idle = {'appdata': {'app': 'Idle'}}
            try:
                success = postJSON(g, idle)
                if not success:
                    raise Exception('postJSON returned false')
            except Exception as err:
                g.clog.warn('Failed to enable idle mode')
                g.clog.warn(str(err))

            g.clog.info('Stopping offsets (if running')
            try:
                success = stopNodding(g)
                if not success:
                    raise Exception('Failed to stop dithering: response was false')
            except Exception as err:
                g.clog.warn('Failed to stop GTC offset script')
                g.clog.warn(str(err))

            return True

        elif self.stopping:
            # Exposure in process of stopping
            # Disable lots of buttons
            self.disable()
            g.observe.start.disable()
            g.setup.powerOn.disable()
            g.setup.powerOff.disable()

            # wait a second before trying again
            self.after(500, self.check)

        else:
            self.enable()
            g.observe.start.disable()
            g.setup.powerOn.disable()
            g.setup.powerOff.disable()
            # Start exposure meter
            g.info.timer.start()
            return False
917822
def is_new_osx():
    """"""
    name = distutils.util.get_platform()
    if sys.platform != "darwin":
        return False
    elif name.startswith("macosx-10"):
        minor_version = int(name.split("-")[1].split(".")[1])
        if minor_version >= 7:
            return True
        else:
            return False
    else:
        return False
625351
public static boolean isMac() {
        if (System.getProperty(SEA_GLASS_OVERRIDE_OS_NAME) != null) {
            return System.getProperty(SEA_GLASS_OVERRIDE_OS_NAME).startsWith("Mac OS");
        }

        return System.getProperty("os.name").startsWith("Mac OS");
    }
433008
def write_with_mac(self, data, block):
        
        # Write a single data block protected with a mac. The card
        # will only accept the write if it computed the same mac.
        log.debug("write 1 block with mac")
        if len(data) != 16:
            raise ValueError("data must be 16 octets")
        if type(block) is not int:
            raise ValueError("block number must be int")
        if self._sk is None or self._iv is None:
            raise RuntimeError("tag must be authenticated first")

        # The write count is the first three byte of the wcnt block.
        wcnt = str(self.read_without_mac(0x90)[0:3])
        log.debug("write count is 0x{0}".format(wcnt[::-1].encode("hex")))

        # We must generate the mac_a block to write the data. The data
        # to encrypt to the mac is composed of write count and block
        # numbers (8 byte) and the data we want to write. The mac for
        # write must be generated with the key flipped (sk2 || sk1).
        def flip(sk):
            return sk[8:16] + sk[0:8]

        data = wcnt + "\x00" + chr(block) + "\x00\x91\x00" + data
        maca = self.generate_mac(data, flip(self._sk), self._iv) + wcnt+5*"\0"

        # Now we can write the data block with our computed mac to the
        # desired block and the maca block. Write without encryption
        # means that the data is not encrypted with a service key.
        sc_list = [tt3.ServiceCode(0, 0b001001)]
        bc_list = [tt3.BlockCode(block), tt3.BlockCode(0x91)]
        self.write_without_encryption(sc_list, bc_list, data[8:24] + maca)
1111645
def get_mac(self):
        '''  '''
        ifreq = struct.pack('16sH14s', self.name, AF_UNIX, b'\x00'*14)
        res = fcntl.ioctl(sockfd, SIOCGIFHWADDR, ifreq)
        address = struct.unpack('16sH14s', res)[2]
        mac = struct.unpack('6B8x', address)

        return ":".join(['%02X' % i for i in mac])
990501
protected function isLegacyDrush() {
    try {
      // Try for a drush 9 version.
      $version = trim($this->drush('version', [], ['format' => 'string']));
      return version_compare($version, '9', '<=');
    }
    catch (\RuntimeException $e) {
      // The version of drush is old enough that only `--version` was available,
      // so this is a legacy version.
      return TRUE;
    }
  }
1139107
public static function isEnabled()
      {
          $ini = eZINI::instance( 'squid.ini' );

          if ( $ini->hasSection( 'Squid' )
                && $ini->hasVariable( 'Squid', 'PurgeCacheOnPublish' )
                    && $ini->variable( 'Squid', 'PurgeCacheOnPublish' ) == 'enabled' )
          {
              return true;
          }
          else
          {
              return false;
          }
      }
695988
function() {
			for (var i=0, t, m; t=this.osInfo[i]; i++) {
				if (enyo.platform[t.os] < t.version) {
					return false;
				}
			}
			return true;
		}
923157
def ci_macos():
    
    run_command("brew install $PYTHON pipenv || echo \"Installed PipEnv\"")
    command_string = "sudo -H $PIP install "
    for element in DEPENDENCIES + REQUIREMENTS + ["-U"]:
        command_string += element + " "
    run_command(command_string)
    # Build a wheel
    run_command("sudo -H $PYTHON setup.py bdist_wheel")
    assert check_wheel_existence()
    exit(0)
940951
boolean checkChunkMac(byte[] headerNonce, long chunkNumber, ByteBuffer chunkBuf) {
		assert chunkBuf.remaining() >= NONCE_SIZE + MAC_SIZE;

		// get three components: nonce + payload + mac
		final ByteBuffer chunkNonceBuf = chunkBuf.asReadOnlyBuffer();
		chunkNonceBuf.position(0).limit(NONCE_SIZE);
		final ByteBuffer payloadBuf = chunkBuf.asReadOnlyBuffer();
		payloadBuf.position(NONCE_SIZE).limit(chunkBuf.limit() - MAC_SIZE);
		final ByteBuffer expectedMacBuf = chunkBuf.asReadOnlyBuffer();
		expectedMacBuf.position(chunkBuf.limit() - MAC_SIZE);

		// get nonce:
		final byte[] chunkNonce = new byte[NONCE_SIZE];
		chunkNonceBuf.get(chunkNonce);

		// get expected MAC:
		final byte[] expectedMac = new byte[MAC_SIZE];
		expectedMacBuf.get(expectedMac);

		// get actual MAC:
		final byte[] calculatedMac = calcChunkMac(macKey, headerNonce, chunkNumber, chunkNonce, payloadBuf);

		// time-constant equality check of two MACs:
		return MessageDigest.isEqual(expectedMac, calculatedMac);
	}
408307
private static String getMacUserShell()
        throws EnvironmentException
    {
        if( null != m_SHELL )
        {
            return m_SHELL;
        }
        String[] args = { "nidump", "passwd", "/" };
        return readShellFromPasswdFile( args );
    }
580788
def is_valid_release_version(version):
    ''''''
    return version is not None and len(version) == 6 and version[0] == 'R' \
            and int(version[1:5]) in range(1990, 2050) \
            and version[5] in ('h', 'g', 'f', 'e', 'd', 'c', 'b', 'a')
1155603
protected boolean isVeraEnabled( boolean quiet ) 
    {
        if ( vera.getSkip() )
        {
            if ( ! quiet )
            {
                getLog().info( VeraConfiguration.SKIP_MESSAGE 
                        + ", 'skip' set to true in the " + VeraConfiguration.TOOL_NAME + " configuration" );
            }
            
            return false;
        }
        
        if ( vera.getVeraHome() == null ) 
        {
            if ( ! quiet )
            {
                getLog().info( VeraConfiguration.SKIP_MESSAGE 
                        + ", path to " + VeraConfiguration.TOOL_NAME + " home directory not set" );
            }
            
            return false;
        }        
        
        return true;
    }
1038482
protected function isBinaryAvailable(): bool
    {
        if (OsHelper::isUnix()) {
            // Do not use the 'which' program to check if a binary exists.
            // See also http://stackoverflow.com/questions/592620/check-if-a-program-exists-from-a-bash-script
            $process = new Process([
                'sh',
                '-c',
                'command -v $0',
                $this->getBinary(),
            ]);
        } else {
            // 'where' is available on Windows since Server 2003
            $process = new Process([
                'where',
                $this->getBinary(),
            ]);
        }

        $process->run();

        return $process->isSuccessful();
    }
544618
def os_requires_version(ostack_release, pkg):
    
    def wrap(f):
        @wraps(f)
        def wrapped_f(*args):
            if os_release(pkg) < ostack_release:
                raise Exception("This hook is not supported on releases"
                                " before %s" % ostack_release)
            f(*args)
        return wrapped_f
    return wrap