Пример #1
0
    def retrieve(self, directory, skip_errors=False):
        """
		Retrieve information about project from directory
		"""
        # directory exists?
        if not path.exists(directory):
            self.err = "Directory %s does not exist" % directory
            return False

        parser_config = ParserConfig()
        if skip_errors:
            parser_config.setSkipErrors()
        parser_config.setNoGodeps(self.noGodeps)
        parser_config.setParsePath(directory)

        gse_obj = GoSymbolsExtractor(parser_config)
        if not gse_obj.extract():
            self.err = gse_obj.getError()
            return False

        self.godeps_on = gse_obj.godepsDirectoryExists()
        ip_used = gse_obj.getImportedPackages()
        self.package_imports_occurence = gse_obj.getPackageImportsOccurences()
        packages = gse_obj.getSymbolsPosition()
        tests = gse_obj.getTestDirectories()

        ips_imported = []
        ips_provided = []

        # imported paths
        ipd = ImportPathsDecomposer(ip_used)
        if not ipd.decompose():
            self.err = ipd.getError()
            return False

        self.warn = ipd.getWarning()

        classes = ipd.getClasses()
        sorted_classes = sorted(classes.keys())

        for ip_class in sorted_classes:
            if ip_class == "Native":
                continue

            for ip in classes[ip_class]:
                self.imported_packages.append(ip)

                # provided paths
        for pkg in packages:
            self.provided_packages.append(packages[pkg])

            # project documentation
        self.docs = self._getDocFiles(directory)

        self.imported_packages = sorted(self.imported_packages)
        self.provided_packages = sorted(self.provided_packages)
        self.test_directories = sorted(tests)

        return True
Пример #2
0
    def retrieve(self, directory, skip_errors=False):
        """
		Retrieve information about project from directory
		"""
        # directory exists?
        if not path.exists(directory):
            self.err = "Directory %s does not exist" % directory
            return False

        gse_obj = GoSymbolsExtractor(directory,
                                     skip_errors=skip_errors,
                                     noGodeps=self.noGodeps)
        if not gse_obj.extract():
            self.err = gse_obj.getError()
            return False

        self.godeps_on = gse_obj.godepsDirectoryExists()
        ip_used = gse_obj.getImportedPackages()
        self.package_imports_occurence = gse_obj.getPackageImportsOccurences()
        packages = gse_obj.getSymbolsPosition()
        tests = gse_obj.getTestDirectories()

        ips_imported = []
        ips_provided = []

        # imported paths
        ipd = ImportPathsDecomposer(ip_used)
        if not ipd.decompose():
            self.err = ipd.getError()
            return False

        self.warn = ipd.getWarning()

        classes = ipd.getClasses()
        sorted_classes = sorted(classes.keys())

        for ip_class in sorted_classes:
            if ip_class == "Native":
                continue

            for ip in classes[ip_class]:
                self.imported_packages.append(ip)

        # provided paths
        for pkg in packages:
            self.provided_packages.append(packages[pkg])

        # project documentation
        self.docs = self._getDocFiles(directory)

        self.imported_packages = sorted(self.imported_packages)
        self.provided_packages = sorted(self.provided_packages)
        self.test_directories = sorted(tests)

        return True
Пример #3
0
            if options.spec != False:
                if ip != ".":
                    print "Provides: golang(%%{import_path}/%s) = %%{version}-%%{release}" % (
                        ip)
                else:
                    print "Provides: golang(%{import_path}) = %{version}-%{release}"
            elif options.prefix != "":
                if ip != ".":
                    print "%s/%s" % (options.prefix, ip)
                else:
                    print options.prefix
            else:
                print ip

    elif options.test:
        sdirs = sorted(gse_obj.getTestDirectories())
        for dir in sdirs:
            if options.spec != False:
                if dir != ".":
                    print "go test %%{import_path}/%s" % dir
                else:
                    print "go test %{import_path}"
            else:
                print dir
    elif options.dirs:
        dirs = gse_obj.getSymbolsPosition().values(
        ) + gse_obj.getTestDirectories()
        sdirs = []
        for dir in dirs:
            sdirs.append(dir.split("/")[0])
Пример #4
0
			if options.spec != False:
				if ip != ".":
					print "Provides: golang(%%{import_path}/%s) = %%{version}-%%{release}" % (ip)
				else:
					print "Provides: golang(%{import_path}) = %{version}-%{release}"
			elif options.prefix != "":
				if ip != ".":
					print "%s/%s" % (options.prefix, ip)
				else:
					print options.prefix
			else:
				print ip

	elif options.test:
		sdirs = sorted(gse_obj.getTestDirectories())
		for dir in sdirs:
			if options.spec != False:
				if dir != ".":
					print "go test %%{import_path}/%s" % dir
				else:
					print "go test %{import_path}"
			else:
				print dir
	elif options.dirs:
		dirs = gse_obj.getSymbolsPosition().values() + gse_obj.getTestDirectories()
		sdirs = []
		for dir in dirs:
			sdirs.append( dir.split("/")[0] )

		sdirs = sorted(list(set(sdirs)))
Пример #5
0
			if options.spec != False:
				if ip != ".":
					print "Provides: golang(%%{import_path}/%s) = %%{version}-%%{release}" % (ip)
				else:
					print "Provides: golang(%{import_path}) = %{version}-%{release}"
			elif options.prefix != "":
				if ip != ".":
					print "%s/%s" % (options.prefix, ip)
				else:
					print options.prefix
			else:
				print ip

	elif options.test:
		sdirs = sorted(gse_obj.getTestDirectories())
		for dir in sdirs:
			if options.spec != False:
				if dir != ".":
					print "go test %%{import_path}/%s" % dir
				else:
					print "go test %{import_path}"
			else:
				print dir
	elif options.dirs:
		dirs = gse_obj.getSymbolsPosition().values() + gse_obj.getTestDirectories()
		sdirs = []
		for dir in dirs:
			sdirs.append( dir.split("/")[0] )

		sdirs = sorted(list(set(sdirs)))