def __init__(self, local_path, group=None):
        try:
            import rpm
        except __HOLE__:
            raise ArtifactError("Can't import rpm module to detect name and version")
        ts = rpm.ts()
        fdno = os.open(local_path, os.O_RDONLY)
        headers = ts.hdrFromFdno(fdno)
        os.close(fdno)

        if not group:
            group = self.get_artifact_group(headers['url'])
        artifact = headers['name']
        version = '{v}-{r}'.format(v=headers['version'], r=headers['release'])
        super(LocalRpmArtifact, self).__init__(group=group, artifact=artifact, version=version, local_path=local_path)
dataset/ETHPy150Open stardust85/repositorytools/repositorytools/lib/artifact.py/LocalRpmArtifact.__init__