(self, filename=None, sign=False, verify=False)
Initialise an instance using a (valid) filename.
Initialise an instance using a (valid) filename.
Initialise an instance using a ( valid ) filename .
def __init__(self, filename=None, sign=False, verify=False):
        """
        Initialise an instance using a (valid) filename.
        """
        self.sign = sign
        self.should_verify = verify
        self.buildver = ''
        self.pyver = [PYVER]
        self.abi = ['none']
        self.arch = ['any']
        self.dirname = os.getcwd()
        if filename is None:
            self.name = 'dummy'
            self.version = '0.1'
            self._filename = self.filename
        else:
            m = NAME_VERSION_RE.match(filename)
            if m:
                info = m.groupdict('')
                self.name = info['nm']
                # Reinstate the local version separator
                self.version = info['vn'].replace('_', '-')
                self.buildver = info['bn']
                self._filename = self.filename
            else:
                dirname, filename = os.path.split(filename)
                m = FILENAME_RE.match(filename)
                if not m:
                    raise DistlibException('Invalid name or '
                                           'filename: %r' % filename)
                if dirname:
                    self.dirname = os.path.abspath(dirname)
                self._filename = filename
                info = m.groupdict('')
                self.name = info['nm']
                self.version = info['vn']
                self.buildver = info['bn']
                self.pyver = info['py'].split('.')
                self.abi = info['bi'].split('.')
                self.arch = info['ar'].split('.')
def __init__ ( self , filename = None , sign = False , verify = False ) : self . sign = sign self . should_verify = verify self . buildver = '' self . pyver = [ PYVER ] self . abi = [ 'none' ] self . arch = [ 'any' ] self . dirname = os . getcwd ( ) if filename is None : self . name = 'dummy' self . version = '0.1' self . _filename = self . filename else : m = NAME_VERSION_RE . match ( filename ) if m : info = m . groupdict ( '' ) self . name = info [ 'nm' ] # Reinstate the local version separator self . version = info [ 'vn' ] . replace ( '_' , '-' ) self . buildver = info [ 'bn' ] self . _filename = self . filename else : dirname , filename = os . path . split ( filename ) m = FILENAME_RE . match ( filename ) if not m : raise DistlibException ( 'Invalid name or ' 'filename: %r' % filename ) if dirname : self . dirname = os . path . abspath ( dirname ) self . _filename = filename info = m . groupdict ( '' ) self . name = info [ 'nm' ] self . version = info [ 'vn' ] self . buildver = info [ 'bn' ] self . pyver = info [ 'py' ] . split ( '.' ) self . abi = info [ 'bi' ] . split ( '.' ) self . arch = info [ 'ar' ] . split ( '.' )