Esempio n. 1
0
    def refreshCtrl(self):
        ListCtrlView.refreshCtrl(self)

        from Models.PythonEditorModels import BaseAppModel
        otherApp = BaseAppModel('', self.compareTo, '', self.model.editor,
                                True, {})

        from Explorers.Explorer import openEx
        otherApp.transport = openEx(self.compareTo)

        otherApp.load()
        otherApp.readModules()

        filename, otherFilename = self.model.assertLocalFile(
        ), otherApp.assertLocalFile()

        i = 0
        # Compare apps
        if not cmp(filename, otherFilename):
            i = self.addReportItems(i, (os.path.splitext(
                os.path.basename(filename))[0], otherFilename, _('changed')))

        # Find changed modules and modules not occuring in other module
        for module in self.model.modules.keys():
            if otherApp.modules.has_key(module):
                otherFile = otherApp.assertLocalFile(
                    otherApp.moduleFilename(module))
                filename = self.model.assertLocalFile(
                    self.model.moduleFilename(module))
                try:
                    if not cmp(filename, otherFile):
                        i = self.addReportItems(
                            i, (module, otherFile, _('changed')))
                except OSError:
                    pass
            else:
                i = self.addReportItems(i, (module, '', _('deleted')))

        # Find modules only occuring in other module
        for module in otherApp.modules.keys():
            if not self.model.modules.has_key(module):
                #otherFile = otherApp.moduleFilename(module)
                i = self.addReportItems(i, (module, '', _('added')))

        self.pastelise()
Esempio n. 2
0
    def refreshCtrl(self):
        ListCtrlView.refreshCtrl(self)

        from Models.PythonEditorModels import BaseAppModel

        otherApp = BaseAppModel("", self.compareTo, "", self.model.editor, True, {})

        from Explorers.Explorer import openEx

        otherApp.transport = openEx(self.compareTo)

        otherApp.load()
        otherApp.readModules()

        filename, otherFilename = self.model.assertLocalFile(), otherApp.assertLocalFile()

        i = 0
        # Compare apps
        if not cmp(filename, otherFilename):
            i = self.addReportItems(i, (os.path.splitext(os.path.basename(filename))[0], otherFilename, _("changed")))

        # Find changed modules and modules not occuring in other module
        for module in self.model.modules.keys():
            if otherApp.modules.has_key(module):
                otherFile = otherApp.assertLocalFile(otherApp.moduleFilename(module))
                filename = self.model.assertLocalFile(self.model.moduleFilename(module))
                try:
                    if not cmp(filename, otherFile):
                        i = self.addReportItems(i, (module, otherFile, _("changed")))
                except OSError:
                    pass
            else:
                i = self.addReportItems(i, (module, "", _("deleted")))

        # Find modules only occuring in other module
        for module in otherApp.modules.keys():
            if not self.model.modules.has_key(module):
                # otherFile = otherApp.moduleFilename(module)
                i = self.addReportItems(i, (module, "", _("added")))

        self.pastelise()
Esempio n. 3
0
def diffdata(a, b, flags): # Compute directory differences.
	#
	a_only = [('A only:', header_action), ('', header_action)]
	b_only = [('B only:', header_action), ('', header_action)]
	ab_diff = [('A <> B:', header_action), ('', header_action)]
	ab_same = [('A == B:', header_action), ('', header_action)]
	data = [a_only, b_only, ab_diff, ab_same]
	#
	a_list = dircache.listdir(a)[:]
	b_list = dircache.listdir(b)[:]
	dircache.annotate(a, a_list)
	dircache.annotate(b, b_list)
	a_list.sort()
	b_list.sort()
	#
	for x in a_list:
		if x in ['./', '../']:
			pass
		elif x not in b_list:
			a_only.append(x, a_only_action)
		else:
			ax = os.path.join(a, x)
			bx = os.path.join(b, x)
			if os.path.isdir(ax) and os.path.isdir(bx):
				if flags == '-r':
					same = dircmp(ax, bx)
				else:
					same = 0
			else:
				try:
					same = cmp.cmp(ax, bx)
				except (RuntimeError, os.error):
					same = 0
			if same:
				ab_same.append(x, ab_same_action)
			else:
				ab_diff.append(x, ab_diff_action)
	#
	for x in b_list:
		if x in ['./', '../']:
			pass
		elif x not in a_list:
			b_only.append(x, b_only_action)
	#
	return data
Esempio n. 4
0
def diffdata(a, b, flags):  # Compute directory differences.
    #
    a_only = [("A only:", header_action), ("", header_action)]
    b_only = [("B only:", header_action), ("", header_action)]
    ab_diff = [("A <> B:", header_action), ("", header_action)]
    ab_same = [("A == B:", header_action), ("", header_action)]
    data = [a_only, b_only, ab_diff, ab_same]
    #
    a_list = dircache.listdir(a)[:]
    b_list = dircache.listdir(b)[:]
    dircache.annotate(a, a_list)
    dircache.annotate(b, b_list)
    a_list.sort()
    b_list.sort()
    #
    for x in a_list:
        if x in ["./", "../"]:
            pass
        elif x not in b_list:
            a_only.append((x, a_only_action))
        else:
            ax = os.path.join(a, x)
            bx = os.path.join(b, x)
            if os.path.isdir(ax) and os.path.isdir(bx):
                if flags == "-r":
                    same = dircmp(ax, bx)
                else:
                    same = 0
            else:
                try:
                    same = cmp.cmp(ax, bx)
                except (RuntimeError, os.error):
                    same = 0
            if same:
                ab_same.append((x, ab_same_action))
            else:
                ab_diff.append((x, ab_diff_action))
                #
    for x in b_list:
        if x in ["./", "../"]:
            pass
        elif x not in a_list:
            b_only.append((x, b_only_action))
            #
    return data
Esempio n. 5
0
    # Actual work starts here...

    dict = findmodules.findmodules(scriptfile, modules, path)

    backup = frozen_c + '~'
    try:
        os.rename(frozen_c, backup)
    except os.error:
        backup = None
    outfp = open(frozen_c, 'w')
    try:
        makefreeze.makefreeze(outfp, dict)
    finally:
        outfp.close()
    if backup:
        if cmp.cmp(backup, frozen_c):
            sys.stderr.write('%s not changed, not written\n' % frozen_c)
            os.rename(backup, frozen_c)

    builtins = []
    unknown = []
    mods = dict.keys()
    mods.sort()
    for mod in mods:
        if dict[mod] == '<builtin>':
            builtins.append(mod)
        elif dict[mod] == '<unknown>':
            unknown.append(mod)

    addfiles = []
    if unknown:
Esempio n. 6
0
	print "Modules being frozen:"
	for name in names:
	    print '\t', name

	backup = frozen_c + '~'
	try:
		os.rename(frozen_c, backup)
	except os.error:
		backup = None
	outfp = open(frozen_c, 'w')
	try:
		makefreeze.makefreeze(outfp, dict)
	finally:
		outfp.close()
	if backup:
		if cmp.cmp(backup, frozen_c):
			sys.stderr.write('%s not changed, not written\n' %
					 frozen_c)
			os.rename(backup, frozen_c)

	builtins = []
	unknown = []
	mods = dict.keys()
	mods.sort()
	for mod in mods:
		if dict[mod] == '<builtin>':
			builtins.append(mod)
		elif dict[mod] == '<unknown>':
			unknown.append(mod)

	addfiles = []
Esempio n. 7
0
	# Actual work starts here...

	dict = findmodules.findmodules(scriptfile, modules, path)

	backup = frozen_c + '~'
	try:
		os.rename(frozen_c, backup)
	except os.error:
		backup = None
	outfp = open(frozen_c, 'w')
	try:
		makefreeze.makefreeze(outfp, dict)
	finally:
		outfp.close()
	if backup:
		if cmp.cmp(backup, frozen_c):
			sys.stderr.write('%s not changed, not written\n' %
					 frozen_c)
			os.rename(backup, frozen_c)

	builtins = []
	unknown = []
	mods = dict.keys()
	mods.sort()
	for mod in mods:
		if dict[mod] == '<builtin>':
			builtins.append(mod)
		elif dict[mod] == '<unknown>':
			unknown.append(mod)

	addfiles = []
Esempio n. 8
0
import cmp

if cmp.cmp("samples/sample.au", "samples/sample.wav"):
    print "files are identical"
else:
    print "files differ!"

## files differ!
Esempio n. 9
0
import cmp

if cmp.cmp("samples/sample.au", "samples/sample.wav"):
    print("files are identical")
else:
    print("files differ!")

## files differ!