コード例 #1
0
 def test_recognize_cpan_manifest_as_plain_package(self):
     test_file = self.get_test_loc('cpan/MANIFEST')
     try:
         recognize_package(test_file)
         self.fail('Exception not raised')
     except NotImplementedError:
         pass
コード例 #2
0
ファイル: api.py プロジェクト: yudhik11/scancode-toolkit
def get_package_infos(location):
    """
    Return a list of mappings of package information collected from the
    `location` or an empty list.
    """
    from packagedcode.recognize import recognize_package
    package = recognize_package(location)
    if not package:
        return []
    return [package.to_dict()]
コード例 #3
0
ファイル: api.py プロジェクト: ocabrisses/scancode-toolkit
def get_package_infos(location):
    """
    Return a list of mappings of package information collected from the
    `location` or an empty list.
    """
    from packagedcode.recognize import recognize_package
    package = recognize_package(location)
    if not package:
        return []
    return [package.to_dict()]
コード例 #4
0
def get_package_info(location, **kwargs):
    """
    Return a mapping of package manifest information detected in the
    file at `location`.

    Note that all exceptions are caught if there are any errors while parsing a
    package manifest.
    """
    from packagedcode.recognize import recognize_package
    try:
        manifest = recognize_package(location)
        if manifest:
            return dict(packages=[manifest.to_dict()])
    except Exception as e:
        if TRACE:
            logger.error('get_package_info: {}: Exception: {}'.format(location, e))
        pass
    return dict(packages=[])
コード例 #5
0
 def test_recognize_maven_pom_xml(self):
     test_file = self.get_test_loc('maven2/urwerk_pom.xml')
     package = recognize_package(test_file)
     assert isinstance(package, maven.MavenPomPackage)
コード例 #6
0
 def test_recognize_package_iso(self):
     test_file = self.get_test_loc('archives/small.iso')
     package = recognize_package(test_file)
     assert isinstance(package, models.IsoImagePackage)
コード例 #7
0
 def test_recognize_cpan_manifest_is_not_yet_supported(self):
     test_file = self.get_test_loc('cpan/MANIFEST')
     package = recognize_package(test_file)
     assert not package
コード例 #8
0
 def test_recognize_package_rar(self):
     test_file = self.get_test_loc('archives/basic.rar')
     package = recognize_package(test_file)
     assert isinstance(package, models.RarPackage)
コード例 #9
0
 def test_recognize_package_gem(self):
     test_file = self.get_test_loc(
         'archives/mysmallidea-address_standardization-0.4.1.gem')
     package = recognize_package(test_file)
     assert isinstance(package, models.RubyGem)
コード例 #10
0
 def test_recognize_package_deb(self):
     test_file = self.get_test_loc('archives/adduser_3.112ubuntu1_all.deb')
     package = recognize_package(test_file)
     assert isinstance(package, packagedcode.models.DebianPackage)
コード例 #11
0
 def test_recognize_package_rpm(self):
     test_file = self.get_test_loc('archives/alfandega-2.2-2.rh80.src.rpm')
     package = recognize_package(test_file)
     assert isinstance(package, rpm.RpmPackage)
コード例 #12
0
 def test_recognize_cpan_manifest_as_plain_package(self):
     test_file = self.get_test_loc('cpan/MANIFEST')
     package = recognize_package(test_file)
     assert isinstance(package, packagedcode.models.CpanModule)
コード例 #13
0
 def test_recognize_maven_dot_pom(self):
     test_file = self.get_test_loc('m2/aspectj/aspectjrt/1.5.3/aspectjrt-1.5.3.pom')
     package = recognize_package(test_file)
     assert isinstance(package, maven.MavenPomPackage)
コード例 #14
0
 def test_recognize_package_iso(self):
     test_file = self.get_test_loc('archives/small.iso')
     package = recognize_package(test_file)
     assert isinstance(package, packagedcode.models.IsoImagePackage)
コード例 #15
0
 def test_recognize_package_tarball(self):
     test_file = self.get_test_loc('archives/tarred_bzipped.tar.bz2')
     package = recognize_package(test_file)
     assert isinstance(package, packagedcode.models.TarPackage)
コード例 #16
0
 def test_recognize_package_jar(self):
     test_file = self.get_test_loc('archives/simple.jar')
     package = recognize_package(test_file)
     assert isinstance(package, packagedcode.models.JavaJar)
コード例 #17
0
 def test_recognize_package_gem(self):
     test_file = self.get_test_loc('archives/mysmallidea-address_standardization-0.4.1.gem')
     package = recognize_package(test_file)
     assert isinstance(package, packagedcode.models.RubyGem)
コード例 #18
0
 def test_recognize_package_zip(self):
     test_file = self.get_test_loc('archives/myarch-2.3.0.7z')
     package = recognize_package(test_file)
     assert isinstance(package, packagedcode.models.PlainZipPackage)
コード例 #19
0
 def test_recognize_package_rar(self):
     test_file = self.get_test_loc('archives/basic.rar')
     package = recognize_package(test_file)
     assert isinstance(package, packagedcode.models.RarPackage)
コード例 #20
0
 def test_recognize_maven_pom_xml(self):
     test_file = self.get_test_loc('maven2/urwerk_pom.xml')
     package = recognize_package(test_file)
     assert isinstance(package, maven.MavenPomPackage)
コード例 #21
0
 def test_recognize_package_does_not_recognize_plain_tarball(self):
     test_file = self.get_test_loc('archives/tarred_bzipped.tar.bz2')
     package = recognize_package(test_file)
     assert None == package
コード例 #22
0
 def test_recognize_npm(self):
     test_file = self.get_test_loc('recon/package.json')
     package = recognize_package(test_file)
     assert isinstance(package, npm.NpmPackage)
コード例 #23
0
 def test_recognize_package_deb(self):
     test_file = self.get_test_loc('archives/adduser_3.112ubuntu1_all.deb')
     package = recognize_package(test_file)
     assert isinstance(package, models.DebianPackage)
コード例 #24
0
 def test_recognize_cargo(self):
     test_file = self.get_test_loc('recon/Cargo.toml')
     package = recognize_package(test_file)
     assert isinstance(package, cargo.RustCargoCrate)
コード例 #25
0
 def test_recognize_package_cab(self):
     test_file = self.get_test_loc('archives/basic.cab')
     package = recognize_package(test_file)
     assert isinstance(package, models.CabPackage)
コード例 #26
0
 def test_recognize_composer(self):
     test_file = self.get_test_loc('recon/composer.json')
     package = recognize_package(test_file)
     assert isinstance(package, phpcomposer.PHPComposerPackage)
コード例 #27
0
 def test_recognize_package_zip(self):
     test_file = self.get_test_loc('archives/myarch-2.3.0.7z')
     package = recognize_package(test_file)
     assert isinstance(package, models.PlainZipPackage)
コード例 #28
0
 def test_recognize_freebsd(self):
     test_file = self.get_test_loc('freebsd/multi_license/+COMPACT_MANIFEST')
     package = recognize_package(test_file)
     assert isinstance(package, freebsd.FreeBSDPackage)
コード例 #29
0
 def test_recognize_package_jar(self):
     test_file = self.get_test_loc('archives/simple.jar')
     package = recognize_package(test_file)
     assert isinstance(package, models.JavaJar)
コード例 #30
0
 def test_recognize_package_rpm(self):
     test_file = self.get_test_loc('archives/alfandega-2.2-2.rh80.src.rpm')
     package = recognize_package(test_file)
     assert isinstance(package, rpm.RpmPackage)
コード例 #31
0
 def test_recognize_package_tarball(self):
     test_file = self.get_test_loc('archives/tarred_bzipped.tar.bz2')
     package = recognize_package(test_file)
     assert isinstance(package, models.TarPackage)
コード例 #32
0
 def test_recognize_composer(self):
     test_file = self.get_test_loc('recon/composer.json')
     package = recognize_package(test_file)
     assert isinstance(package, phpcomposer.PHPComposerPackage)
コード例 #33
0
 def test_recognize_maven_dot_pom(self):
     test_file = self.get_test_loc(
         'm2/aspectj/aspectjrt/1.5.3/aspectjrt-1.5.3.pom')
     package = recognize_package(test_file)
     assert isinstance(package, maven.MavenPomPackage)
コード例 #34
0
 def test_recognize_package_zip(self):
     test_file = self.get_test_loc('archives/myarch-2.3.0.7z')
     package = recognize_package(test_file)
     assert None == package
コード例 #35
0
 def test_recognize_nuget(self):
     test_file = self.get_test_loc('recon/bootstrap.nuspec')
     package = recognize_package(test_file)
     assert isinstance(package, nuget.NugetPackage)
コード例 #36
0
 def test_recognize_package_cab(self):
     test_file = self.get_test_loc('archives/basic.cab')
     package = recognize_package(test_file)
     assert isinstance(package, packagedcode.models.CabPackage)
コード例 #37
0
 def test_recognize_package_rar(self):
     test_file = self.get_test_loc('archives/basic.rar')
     package = recognize_package(test_file)
     assert None == package
コード例 #38
0
 def test_recognize_npm(self):
     test_file = self.get_test_loc('recon/package.json')
     package = recognize_package(test_file)
     assert isinstance(package, npm.NpmPackage)