returns /etc/os-release in a dictionary
436287
def os_release():
    
    with settings(hide('warnings', 'running', 'stderr'),
                  warn_only=True, capture=True):

        release = {}
        data = run('cat /etc/os-release')
        for line in data.split('\n'):
            if not line:
                continue
            parts = line.split('=')
            if len(parts) == 2:
                release[parts[0]] = parts[1].strip('\n\r"')

        return release
25119
def release(self):
        """"""
        success, _ = self.etcd_client.transaction(
            compare=[
                self.etcd_client.transactions.value(self.key) == self.uuid
            ],
            success=[self.etcd_client.transactions.delete(self.key)],
            failure=[]
        )
        return success
1307120
def get(self):
        """"""
        output = helm("get", self.release)
        if output.returncode != 0:
            print("Something went wrong!")
            print(output.stderr)
        else:
            print(output.stdout)
158317
def release(self, id):
        
        json = None
        if int(id) > 0:
            url = self._build_url('releases', str(id), base_url=self._api)
            json = self._json(self._get(url), 200)
        return Release(json, self) if json else None
1256036
def release(self):
        
        unlocked = self.database.run_script(
            'lock_release',
            keys=[self.key, self.event],
            args=[self._lock_id])
        return unlocked != 0
1272078
def release():
    

    if not is_working_tree_clean():
        print('Your working tree is not clean. Refusing to create a release.')
        return

    print('Rebuilding the AUTHORS file to check for modifications...')
    authors()

    if not is_working_tree_clean():
        print('Your working tree is not clean after the AUTHORS file was '
              'rebuilt.')
        print('Please commit the changes before continuing.')
        return

    if not is_manifest_up_to_date():
        print('Manifest is not up to date.')
        print('Please update MANIFEST.in or remove spurious files.')
        return

    # Get version
    version = 'v{}'.format(local('python setup.py --version', capture=True))
    name = local('python setup.py --name', capture=True)

    # Tag
    tag_message = '{} release version {}.'.format(name, version)

    print('----------------------')
    print('Proceeding will tag the release, push the repository upstream,')
    print('and release a new version on PyPI.')
    print()
    print('Version: {}'.format(version))
    print('Tag message: {}'.format(tag_message))
    print()
    if not confirm('Continue?', default=True):
        print('Aborting.')
        return

    local('git tag -a {} -m {}'.format(pipes.quote(version),
                                       pipes.quote(tag_message)))

    # Push
    local('git push --tags origin develop')

    # Package and upload to pypi
    local('python setup.py sdist bdist_wheel upload')
964089
def _lsb_release_info(self):
        
        if not self.include_lsb:
            return {}
        with open(os.devnull, 'w') as devnull:
            try:
                cmd = ('lsb_release', '-a')
                stdout = subprocess.check_output(cmd, stderr=devnull)
            except OSError:  # Command not found
                return {}
        content = stdout.decode(sys.getfilesystemencoding()).splitlines()
        return self._parse_lsb_release_content(content)
152762
def ossos_release_parser(table=False, data_release=parameters.RELEASE_VERSION):
    
    names = ['cl', 'p', 'j', 'k', 'sh', 'object', 'mag', 'e_mag', 'Filt', 'Hsur', 'dist', 'e_dist', 'Nobs',
             'time', 'av_xres', 'av_yres', 'max_x', 'max_y', 'a', 'e_a', 'e', 'e_e', 'i', 'e_i', 'Omega', 'e_Omega',
             'omega', 'e_omega', 'tperi', 'e_tperi', 'RAdeg', 'DEdeg', 'JD', 'rate']#, 'eff', 'm_lim']

    if table:
        retval = Table.read(parameters.RELEASE_DETECTIONS[data_release], format='ascii', guess=False,
                           delimiter=' ', data_start=0, comment='#', names=names, header_start=None)
    else:
        retval = []
        with open(data_release, 'r') as detectionsfile:
            for line in detectionsfile.readlines()[1:]:  # first line is column definitions
                obj = TNO.from_string(line, version=parameters.RELEASE_DETECTIONS[data_release])
                retval.append(obj)

    return retval
1120632
def bin_path(self, release=None):
        """"""
        if release:
            for r in self.releases:
                if release in r:
                    return self.releases[r]
            raise MongoOrchestrationError("No such release '%s' in %r"
                                          % (release, self.releases))
        if self.default_release:
            return self.releases[self.default_release]
        if self.releases:
            return list(self.releases.values())[0]
        return ''
866450
def release(self, forceRelease=False):
        '''
            
        '''
        if not self.held:
            if forceRelease is False:
                return False # We were not holding the lock
            else:
                self.held = True # If we have force release set, pretend like we held its
        
        if not os.path.exists(self.lockPath):
            self.held = False
            self.acquiredAt = None
            return True

        if forceRelease is False:
            # We waited too long and lost the lock
            if self.maxLockAge and time.time() > self.acquiredAt + self.maxLockAge:
                self.held = False
                self.acquiredAt = None
                return False

        self.acquiredAt = None

        try:
            os.rmdir(self.lockPath)
            self.held = False
            return True
        except:
            self.held = False
            return False
1153613
def ossystem(cmd):
  """"""
  p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE,
                       stderr=subprocess.STDOUT)
  (stdout, stderr) = p.communicate()
  return stdout.decode('ascii')
1035807
def version():
    '''
    
    '''
    cmd = '{0} -v'.format(_detect_os())
    out = __salt__['cmd.run'](cmd).splitlines()
    ret = out[0].split(': ')
    return ret[1]
950209
def lsb_release():
    
    with settings(hide('warnings', 'running'), capture=True):

        _lsb_release = {}
        data = sudo('cat /etc/lsb-release')
        for line in data.split('\n'):
            if not line:
                continue
            parts = line.split('=')
            if len(parts) == 2:
                _lsb_release[parts[0]] = parts[1].strip('\n\r"')

        return _lsb_release
371449
def _get_library_os_path_from_library_dict_tree(self, library_path, library_name):
        """"""
        if library_path is None or library_name is None:
            return None
        path_list = library_path.split(os.sep)
        target_lib_dict = self.libraries
        # go down the path to the correct library
        for path_element in path_list:
            if path_element not in target_lib_dict:  # Library cannot be found
                target_lib_dict = None
                break
            target_lib_dict = target_lib_dict[path_element]
        return None if target_lib_dict is None or library_name not in target_lib_dict else target_lib_dict[library_name]
1020286
def os_info():
    
    return {
        'uname': dict(platform.uname()._asdict()),
        'path': os.environ.get('PATH', '').split(':'),
        'shell': os.environ.get('SHELL', '/bin/sh'),
    }
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
1212100
def os_path_transform(self, s, sep=os.path.sep):
        
        if sep == '/':
            return s
        else:
            return s.replace(sep, '/')