Ejemplo n.º 1
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, 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)

	classes = ipd.getClasses()
Ejemplo n.º 2
0
	if options.info:
		exit(0)

	if options.archive:
		archive = options.archive

	if options.spec:
		specfile = options.spec

	if options.sources:
		sources = options.sources

	fp_obj = FormatedPrint(formated=True)

	if archive == "":
		fp_obj.printError("archive not set")
		exit(1)

	if specfile == "":
		fp_obj.printError("specfile not set")
		exit(1)

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

	if options.skipdirs:
		for dir in options.skipdirs.split(','):
			dir = dir.strip()
			if dir == "":
Ejemplo n.º 3
0
    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)

    classes = ipd.getClasses()
Ejemplo n.º 4
0
	if checkOptions(options):
		exit(1)

	fmt_obj = FormatedPrint(options.format)

	if not options.format:
		ENDC = ""
		RED = ""
		GREEN = ""

	if options.detect == "":
		# collect spec file information
		project = options.project
		repo = options.repo
		if project == "":
			fmt_obj.printError("Project missing")
			exit(1)

		if repo == "":
			fmt_obj.printError("Repository missing")
			exit(1)

		if options.github:
			import_path = "github.com/%s/%s" % (project, repo)
			commit = options.commit
		elif options.googlecode:
			import_path = "code.google.com/p/%s" % repo
			commit = options.rev
		elif options.bitbucket:
			import_path = "bitbucket.org/%s/%s" % (project, repo)
			commit = options.commit
Ejemplo n.º 5
0
    fmt_obj = FormatedPrint(formated=False)

    if options.imports and options.provides:
        print "You can not set both -i and -o options at the same time"
        exit(1)

    if options.create:
        if createDB(full=options.full, verbose=options.verbose):
            print "DB updated"
        else:
            print "DB not updated"

    elif options.imports:
        ipdb_obj = ImportPathDB()
        if not ipdb_obj.load():
            fmt_obj.printError(ipdb_obj.getError())
            exit(1)

        paths = ipdb_obj.getImportedPaths()
        displayPaths(paths, options.prefix, options.minimal)
    elif options.provides:
        ipdb_obj = ImportPathDB()
        if not ipdb_obj.load():
            fmt_obj.printError(ipdb_obj.getError())
            exit(1)

        paths = ipdb_obj.getProvidedPaths()
        displayPaths(paths, options.prefix, options.minimal)
    else:
        print "Synopsis: prog [-c [-f]] [-i|-p [-s [-m]]]"
        exit(1)
Ejemplo n.º 6
0
	if checkOptions(options):
		exit(1)

	fmt_obj = FormatedPrint(options.format)

	if not options.format:
		ENDC = ""
		RED = ""
		GREEN = ""

	if options.detect == "":
		# collect spec file information
		project = options.project
		repo = options.repo
		if not options.googlecode and project == "":
			fmt_obj.printError("Project missing")
			exit(1)

		if repo == "":
			fmt_obj.printError("Repository missing")
			exit(1)

		if options.github:
			import_path = "github.com/%s/%s" % (project, repo)
			commit = options.commit
		elif options.googlecode:
			import_path = "code.google.com/p/%s" % repo
			commit = options.revision
		elif options.bitbucket:
			import_path = "bitbucket.org/%s/%s" % (project, repo)
			commit = options.commit
Ejemplo n.º 7
0
            noGodeps.append(dir)

    fp = FormatedPrint()

    scan_time_start = time()
    if not options.cyclic and not options.leaves and not options.roots and not options.graphviz:
        print "Synopsis: prog [-d --from-dir|--from-xml] -c|-l|-r|-g [-v] [PACKAGE]"
        exit(1)

    if options.decompose != "":
        gb = ProjectDecompositionGraphBuilder(options.decompose,
                                              skip_errors=options.skiperrors,
                                              noGodeps=noGodeps)
        if options.fromxml != "":
            if not gb.buildFromXml(options.fromxml):
                fp.printError(gb.getError())
                exit(1)
        elif options.fromdir != "":
            if not gb.buildFromDirectory(options.fromdir):
                fp.printError(gb.getError())
                exit(1)
        else:
            fp.printError("--from-xml or --from-dir option is missing")
            exit(1)
    else:
        print "Reading packages..."
        gb = DependencyGraphBuilder(cache=True)
        if not gb.build():
            fp.printError(gb.getError())
            exit(1)
Ejemplo n.º 8
0
	fmt_obj = FormatedPrint(formated=False)

	if options.imports and options.provides:
		print "You can not set both -i and -o options at the same time"
		exit(1)

	if options.create:
		if createDB(full=options.full, verbose=options.verbose):
			print "DB updated"
		else:
			print "DB not updated"

	elif options.imports:
		ipdb_obj = ImportPathDB()
		if not ipdb_obj.load():
			fmt_obj.printError(ipdb_obj.getError())
			exit(1)

		paths = ipdb_obj.getImportedPaths()
		displayPaths(paths, options.prefix, options.minimal)
	elif options.provides:
		ipdb_obj = ImportPathDB()
		if not ipdb_obj.load():
			fmt_obj.printError(ipdb_obj.getError())
			exit(1)

		paths = ipdb_obj.getProvidedPaths()
		displayPaths(paths, options.prefix, options.minimal)
	else:
		print "Synopsis: prog [-c [-f]] [-i|-p [-s [-m]]]"
		exit(1)
Ejemplo n.º 9
0
	if checkOptions(options):
		exit(1)

	fmt_obj = FormatedPrint(options.format)

	if not options.format:
		ENDC = ""
		RED = ""
		GREEN = ""

	if options.detect == "":
		# collect spec file information
		project = options.project
		repo = options.repo
		if not options.googlecode and project == "":
			fmt_obj.printError("Project missing")
			exit(1)

		if repo == "":
			fmt_obj.printError("Repository missing")
			exit(1)

		if options.github:
			import_path = "github.com/%s/%s" % (project, repo)
			commit = options.commit
		elif options.googlecode:
			import_path = "code.google.com/p/%s" % repo
			commit = options.revision
		elif options.bitbucket:
			import_path = "bitbucket.org/%s/%s" % (project, repo)
			commit = options.commit
Ejemplo n.º 10
0
    if options.info:
        exit(0)

    if options.archive:
        archive = options.archive

    if options.spec:
        specfile = options.spec

    if options.sources:
        sources = options.sources

    fp_obj = FormatedPrint(formated=True)

    if archive == "":
        fp_obj.printError("archive not set")
        exit(1)

    if specfile == "":
        fp_obj.printError("specfile not set")
        exit(1)

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

    if options.skipdirs:
        for dir in options.skipdirs.split(','):
            dir = dir.strip()
            if dir == "":
Ejemplo n.º 11
0
	scan_time_start = time()
	if not options.cyclic and not options.leaves and not options.roots and not options.graphviz:
		print "Synopsis: prog [-d --from-dir|--from-xml] -c|-l|-r|-g [-v] [PACKAGE]"
		exit(1)

	if options.decompose != "":
		config = ParserConfig()
		if options.skiperrors:
			config.setSkipErrors()
		config.setNoGodeps(noGodeps)
		config.setImportPathPrefix(options.decompose)

		gb = ProjectDecompositionGraphBuilder(config)
		if options.fromxml != "":
			if not gb.buildFromXml(options.fromxml):
				fp.printError(gb.getError())
				exit(1)
		elif options.fromdir != "":
			if not gb.buildFromDirectory(options.fromdir):
				fp.printError(gb.getError())
				exit(1)
		else:
			fp.printError("--from-xml or --from-dir option is missing")
			exit(1)
	else:
		print "Reading packages..."
		gb = DependencyGraphBuilder(cache = True)
		if not gb.build():
			fp.printError(gb.getError())
			exit(1)