Exemplo n.º 1
0
 def _get_license_dict(self, files):
     result = []
     for f in files:
         try:
             # once DB full, remove license path
             try:
                 license_path = helper.get_sources_path(session,
                                                        f['package'],
                                                        f['version'],
                                                        current_app.config)
             except (FileOrFolderNotFound, InvalidPackageOrVersionError):
                 raise Http404ErrorSuggestions(f['package'], f['version'],
                                               '')
             l = helper.get_license(session, f['package'],
                                    f['version'], f['path'], license_path)
             result.append(dict(oracle='debian',
                                path=f['path'],
                                package=f['package'],
                                version=f['version'],
                                license=l,
                                origin=helper.license_url(f['package'],
                                                          f['version'])))
         except Exception:
             result.append(dict(oracle='debian',
                                path=f['path'],
                                package=f['package'],
                                version=f['version'],
                                license=None,
                                origin=helper.license_url(f['package'],
                                                          f['version'])))
     return result
Exemplo n.º 2
0
 def _get_license_dict(self, files):
     result = []
     for f in files:
         try:
             # once DB full, remove license path
             try:
                 license_path = helper.get_sources_path(session,
                                                        f['package'],
                                                        f['version'],
                                                        current_app.config)
             except (FileOrFolderNotFound, InvalidPackageOrVersionError):
                 raise Http404ErrorSuggestions(f['package'], f['version'],
                                               '')
             l = helper.get_license(session, f['package'],
                                    f['version'], f['path'], license_path)
             result.append(dict(oracle='debian',
                                path=f['path'],
                                package=f['package'],
                                version=f['version'],
                                license=l,
                                origin=helper.license_url(f['package'],
                                                          f['version'])))
         except Exception:
             result.append(dict(oracle='debian',
                                path=f['path'],
                                package=f['package'],
                                version=f['version'],
                                license=None,
                                origin=helper.license_url(f['package'],
                                                          f['version'])))
     return result
Exemplo n.º 3
0
 def _get_license_dict(self, files):
     result = []
     for f in files:
         try:
             # once DB full, remove license path
             try:
                 license_path = helper.get_sources_path(
                     session, f["package"], f["version"],
                     current_app.config)
             except (FileOrFolderNotFound, InvalidPackageOrVersionError):
                 raise Http404ErrorSuggestions(f["package"], f["version"],
                                               "")
             # parse file
             try:
                 c = helper.parse_license(license_path)
                 license = helper.get_license(f["package"], f["version"],
                                              f["path"], c)
             except copyright.NotMachineReadableError:
                 license = None
             result.append(
                 dict(
                     oracle="debian",
                     path=f["path"],
                     package=f["package"],
                     version=f["version"],
                     license=license,
                     origin=helper.license_url(f["package"], f["version"]),
                 ))
         except Exception:
             result.append(
                 dict(
                     oracle="debian",
                     path=f["path"],
                     package=f["package"],
                     version=f["version"],
                     license=None,
                     origin=helper.license_url(f["package"], f["version"]),
                 ))
     return result
Exemplo n.º 4
0
 def _license_of_files(self, f):
     # once DB full, remove license path
     try:
         license_path = helper.get_sources_path(session, f.package,
                                                f.version,
                                                current_app.config)
     except (FileOrFolderNotFound, InvalidPackageOrVersionError):
         raise Http404ErrorSuggestions(f.package, f.version, '')
     return dict(oracle='debian',
                 path=f.path,
                 package=f.package,
                 version=f.version,
                 license=helper.get_license(session, f.package, f.version,
                                            f.path, license_path),
                 origin=helper.license_url(f.package, f.version))
Exemplo n.º 5
0
 def _license_of_files(self, f):
     # once DB full, remove license path
     try:
         license_path = helper.get_sources_path(session, f.package,
                                                f.version,
                                                current_app.config)
     except (FileOrFolderNotFound, InvalidPackageOrVersionError):
         raise Http404ErrorSuggestions(f.package, f.version, '')
     return dict(oracle='debian',
                 path=f.path,
                 package=f.package,
                 version=f.version,
                 license=helper.get_license(session, f.package,
                                            f.version, f.path,
                                            license_path),
                 origin=helper.license_url(f.package, f.version))
Exemplo n.º 6
0
    def _license_of_files(self, f):
        # once DB full, remove license path
        try:
            license_path = helper.get_sources_path(session, f.package,
                                                   f.version,
                                                   current_app.config)
        except (FileOrFolderNotFound, InvalidPackageOrVersionError):
            raise Http404ErrorSuggestions(f.package, f.version, '')

        try:
            c = helper.parse_license(license_path)
            l = helper.get_license(f.package, f.version, f.path, c)
        except copyright.NotMachineReadableError:
            l = None
        return dict(oracle='debian',
                    path=f.path,
                    package=f.package,
                    version=f.version,
                    license=l,
                    origin=helper.license_url(f.package, f.version))
Exemplo n.º 7
0
    def _license_of_files(self, f):
        # once DB full, remove license path
        try:
            license_path = helper.get_sources_path(session, f.package,
                                                   f.version,
                                                   current_app.config)
        except (FileOrFolderNotFound, InvalidPackageOrVersionError):
            raise Http404ErrorSuggestions(f.package, f.version, '')

        try:
            c = helper.parse_license(license_path)
            l = helper.get_license(f.package, f.version, f.path, c)
        except copyright.NotMachineReadableError:
            l = None
        return dict(oracle='debian',
                    path=f.path,
                    package=f.package,
                    version=f.version,
                    license=l,
                    origin=helper.license_url(f.package, f.version))