示例#1
0
    def run(self, args) -> bool:
        '''
		Callback for running the command.
		:param args: the arguments.
		'''
        eprint(os.environ['PATH'])
        return True
示例#2
0
def dbg_showfolder(folder: str, recursive: bool = False):
    '''
	Print the content of a folder.
	The output is similar to the 'ls -lR' command line on Unix systems.
	:param folder: The name of the folder to display.
	:type folder: str
	:param recursive: Indicates if the subfolders are also displayed (default: False).
	:type recursive: bool
	'''
    eprint()
    for dirname, dirnames, filenames in os.walk(folder):
        eprint("%s:" % dirname)

        # print path to all subdirectories first.
        for subdirname in dirnames:
            eprint("%s/" % subdirname)

        # print path to all filenames.
        for filename in filenames:
            eprint(filename)

        if recursive:
            for subdirname in dirnames:
                fullPath = os.path.join(dirname, subdirname)
                eprint()
                dbg_showfolder(fullPath, recursive)
示例#3
0
def dbg_struct(var: object):
    '''
	Raw display the value structure of the given variable on the console.
	This function never returns.
	:param var: The variable to display.
	:type var: object
	'''
    eprint(var.__class__)
    eprint(dir(var))
    exit(255)
示例#4
0
    def run(self, args) -> bool:
        '''
		Callback for running the command.
		:param args: the arguments.
		:return: True to continue process. False to stop the process.
		'''
        # Explore the auto-generated images
        auto_images = self._get_auto_images()

        # Explore the folders
        manual_images = self._get_manually_given_images(auto_images)

        # Parse the TeX
        maker = AutoLaTeXMaker.create(self.configuration)

        included_images = set()
        for root_file in maker.rootFiles:
            parser = ImageInclusions(filename=root_file)
            if not parser.run():
                return False
            images = parser.get_included_figures()
            included_images.update(images)

        # Compute the not-included figures
        not_included_images = manual_images.difference(included_images)

        # Do the action
        ddir = self.configuration.documentDirectory
        for image_file in not_included_images:
            relpath = os.path.relpath(image_file, ddir)
            abspath = genutils.abspath(image_file, ddir)
            eprint(relpath)
            if args.delete:
                #eprint("> " + abspath)
                genutils.unlink(abspath)

        return True
示例#5
0
	def run(self,  args) -> bool:
		'''
		Callback for running the command.
		:param args: the arguments.
		:return: True to continue process. False to stop the process.
		'''
		system_path = self.configuration.systemConfigFile
		if system_path is not None:
			if os.path.isfile(system_path):
				if os.access(system_path, os.R_OK):
					eprint(system_path)
				else:
					logging.error(_T("%s (unreable)") % (system_path))
			else:
				logging.error(_T("%s (not found)") % (system_path))

		user_path = self.configuration.userConfigFile
		if user_path is not None:
			if os.path.isfile(user_path):
				if os.access(user_path, os.R_OK):
					eprint(user_path)
				else:
					logging.error(_T("%s (unreadable)") % (user_path))
			else:
				logging.error(_T("%s (not found)") % (user_path))

		document_directory = self.configuration.documentDirectory
		if document_directory is None:
			logging.error(_T("Cannot detect document directory"))
		else:
			doc_path = self.configuration.makeDocumentConfigFilename(document_directory)
			if doc_path is not None:
				if os.path.isfile(doc_path):
					if os.access(doc_path, os.R_OK):
						eprint(doc_path)
					else:
						logging.error(_T("%s (unreadable)") % (doc_path))
				else:
					logging.error(_T("%s (not found)") % (doc_path))

		return True
示例#6
0
	def _show_all_images(self,  image_list,  runner):
		sorted_dict = {k: image_list[k] for k in sorted(image_list)}
		for abspath, relpath in sorted_dict.items():
			eprint(relpath)
示例#7
0
	def _show_changed_images(self,  image_list,  runner):
		sorted_dict = {k: image_list[k] for k in sorted(image_list)}
		for abspath, relpath in sorted_dict.items():
			if not self._is_valid_image(abspath,  runner):
				eprint(relpath)
示例#8
0
	def _show_image_translators(self,  image_list,  runner):
		sorted_dict = {k: image_list[k] for k in sorted(image_list)}
		for abspath, relpath in sorted_dict.items():
			translator = runner.getTranslatorFor(abspath)
			if translator:
				eprint(_T("%s => %s") % (relpath, translator.name))
 def _show_inclusion_names_only(self, all_inclusions: dict):
     sorted_dict = {k: all_inclusions[k] for k in sorted(all_inclusions)}
     for translator_name, level in sorted_dict.items():
         eprint(translator_name)
 def _show_inclusions(self, all_inclusions: dict):
     sorted_dict = {k: all_inclusions[k] for k in sorted(all_inclusions)}
     for translator_name, level in sorted_dict.items():
         eprint(_T("%s = %s") % (translator_name, str(level)))