Exemplo n.º 1
0
 def setDistFile(self, filename):
     self.filename = filename
     try:
         package = BDist(filename)
     except ValueError, e:
         print e
         return False
Exemplo n.º 2
0
    def handle(self, *args, **kwargs):
        self.log.debug('import packages script started')
        for filename in args:
            self.log.debug('File: %s' % filename)

            self._curfile = filename
            try:
                if filename.endswith('.zip') or filename.endswith('.tar.gz') or \
                                                        filename.endswith('.tgz'):
                    package = SDist(self._curfile)
                    self._log(filename, package, *self._add_dist(package))
                elif filename.endswith('.egg'):
                    package = BDist(self._curfile)
                    self._log(filename, package, *self._add_dist(package))
                else:
                    self.log.debug('Ignoring: %s:' % filename)

            except ValueError, e:
                if 'No PKG-INFO in archive' in e.message and \
                                            self.options.old_products and \
                                            (filename.endswith('.tar.gz') or \
                                            filename.endswith('.tgz')):
                    self._log(filename, None,
                              *self._old_style_product(filename))
                    continue
                self.log.error('Could not import %s: %s' %
                               (filename, e.message))
Exemplo n.º 3
0
 def set_dist_file(self, filename):
     """Setup our distribution using details from the binary"""
     self.filename = filename
     try:
         package = BDist(filename)
     except ValueError, e:
         print e
         return False
Exemplo n.º 4
0
def parse_file(path):
    w = None
    package = None
    version = None
    if path.endswith(".tar.gz"):
        w = SDist(path)
    if path.endswith(".egg"):
        w = BDist(path)
    if path.endswith(".whl"):
        w = Wheel(path)
    if w:
        package = w.name
        version = w.version

    return package, version
Exemplo n.º 5
0
def parse_egg_binary(location):
    """
    Passing wheel file location which is generated via setup.py bdist_wheel.
    """
    binary_dist = BDist(location)
    return parse_with_pkginfo(binary_dist)