Exemplo n.º 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

        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
Exemplo n.º 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

        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
Exemplo n.º 3
0
        path = args[0]

    if not options.scanalldirs:
        noGodeps = Config().getSkippedDirectories()
    else:
        noGodeps = []

    if options.skipdirs:
        for dir in options.skipdirs.split(','):
            dir = dir.strip()
            if dir == "":
                continue
            noGodeps.append(dir)

    gse_obj = GoSymbolsExtractor(path,
                                 noGodeps=noGodeps,
                                 skip_errors=options.skiperrors)
    if not gse_obj.extract():
        sys.stderr.write("%s\n" % gse_obj.getError())
        exit(1)

    if options.provides:
        ip = gse_obj.getSymbolsPosition()

        ips = []
        for pkg in ip:
            ips.append(ip[pkg])

        skipped_provides_with_prefix = Config().getSkippedProvidesWithPrefix()

        for ip in sorted(ips):
Exemplo n.º 4
0
	if len(args):
		path = args[0]

	if not options.scanalldirs:
		noGodeps = Config().getSkippedDirectories()
	else:
		noGodeps = []

	if options.skipdirs:
		for dir in options.skipdirs.split(','):
			dir = dir.strip()
			if dir == "":
				continue
			noGodeps.append(dir)

	gse_obj = GoSymbolsExtractor(path, noGodeps=noGodeps, skip_errors=options.skiperrors)
	if not gse_obj.extract():
		sys.stderr.write("%s\n" % gse_obj.getError())
		exit(1)

	if options.provides:
		ip = gse_obj.getSymbolsPosition()

		ips = []
		for pkg in ip:
			ips.append(ip[pkg])

		skipped_provides_with_prefix = Config().getSkippedProvidesWithPrefix()

		for ip in sorted(ips):
			skip = False
Exemplo n.º 5
0
	fmt_obj = FormatedPrint()

	if not options.scanalldirs:
		noGodeps = Config().getSkippedDirectories()
	else:
		noGodeps = []

	if options.skipdirs:
		for dir in options.skipdirs.split(','):
			dir = dir.strip()
			if dir == "":
				continue
			noGodeps.append(dir)

	gse_obj = GoSymbolsExtractor(path, imports_only=True, skip_errors=options.skiperrors, noGodeps=noGodeps)
	if not gse_obj.extract():
		fmt_obj.printError(gse_obj.getError())
		exit(1)

	package_imports_occurence = gse_obj.getPackageImportsOccurences()

	ip_used = gse_obj.getImportedPackages()
	ipd = ImportPathsDecomposer(ip_used)
	if not ipd.decompose():
		fmt_obj.printError(ipd.getError())
		exit(1)

	warn = ipd.getWarning()
	if warn != "":
		fmt_obj.printWarning("Warning: %s" % warn)
Exemplo n.º 6
0
    fmt_obj = FormatedPrint()

    if not options.scanalldirs:
        noGodeps = Config().getSkippedDirectories()
    else:
        noGodeps = []

    if options.skipdirs:
        for dir in options.skipdirs.split(','):
            dir = dir.strip()
            if dir == "":
                continue
            noGodeps.append(dir)

    gse_obj = GoSymbolsExtractor(path,
                                 imports_only=True,
                                 skip_errors=options.skiperrors,
                                 noGodeps=noGodeps)
    if not gse_obj.extract():
        fmt_obj.printError(gse_obj.getError())
        exit(1)

    package_imports_occurence = gse_obj.getPackageImportsOccurences()

    ip_used = gse_obj.getImportedPackages()
    ipd = ImportPathsDecomposer(ip_used)
    if not ipd.decompose():
        fmt_obj.printError(ipd.getError())
        exit(1)

    warn = ipd.getWarning()
    if warn != "":
Exemplo n.º 7
0
        noGodeps = []

    if options.skipdirs:
        for dir in options.skipdirs.split(','):
            dir = dir.strip()
            if dir == "":
                continue
            noGodeps.append(dir)

    #obj = ProjectToXml(options.prefix, go_dir)
    #print obj
    #print obj.getError()
    #exit(0)

    gse_obj = GoSymbolsExtractor(go_dir,
                                 skip_errors=options.skiperrors,
                                 noGodeps=noGodeps)
    if not gse_obj.extract():
        print gse_obj.getError()
        exit(1)

    if options.provides:
        ip = gse_obj.getSymbolsPosition()
        ips = []
        for pkg in ip:
            ips.append(ip[pkg])

        for ip in sorted(ips):
            if ip == "." and options.prefix != "":
                print options.prefix
            else:
Exemplo n.º 8
0
			if dir == "":
				continue
			noGodeps.append(dir)

	#obj = ProjectToXml(options.prefix, go_dir)
	#print obj
	#print obj.getError()
	#exit(0)

	parser_config = ParserConfig()
	if options.skiperrors:
		parser_config.setSkipErrors()
	parser_config.setNoGodeps(noGodeps)
	parser_config.setParsePath(go_dir)

	gse_obj = GoSymbolsExtractor(parser_config)
	if not gse_obj.extract():
		print gse_obj.getError()
		exit(1)

	if options.provides:
		ip = gse_obj.getSymbolsPosition()
		ips = []
		for pkg in ip:
			ips.append(ip[pkg])

		for ip in sorted(ips):
			if ip == "." and options.prefix != "":
				print options.prefix
			else:
				print "%s%s" % (prefix, ip)