fix path/absolute_path handling
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
		
					parent
					
						
							
								c56d17d674
							
						
					
				
			
			
				commit
				
					
						ffb33189c7
					
				
			
		
					 1 changed files with 9 additions and 5 deletions
				
			
		| 
						 | 
					@ -49,6 +49,8 @@ class Type(object):
 | 
				
			||||||
    def __init__(self, base_path, name):
 | 
					    def __init__(self, base_path, name):
 | 
				
			||||||
        self._base_path = base_path
 | 
					        self._base_path = base_path
 | 
				
			||||||
        self.name = name
 | 
					        self.name = name
 | 
				
			||||||
 | 
					        self.path = self.name
 | 
				
			||||||
 | 
					        self.absolute_path = os.path.join(self._base_path, self.path)
 | 
				
			||||||
        self.manifest_path = os.path.join(self.name, "manifest")
 | 
					        self.manifest_path = os.path.join(self.name, "manifest")
 | 
				
			||||||
        self.explorer_path = os.path.join(self.name, "explorer")
 | 
					        self.explorer_path = os.path.join(self.name, "explorer")
 | 
				
			||||||
        self.manifest_path = os.path.join(self.name, "manifest")
 | 
					        self.manifest_path = os.path.join(self.name, "manifest")
 | 
				
			||||||
| 
						 | 
					@ -66,22 +68,24 @@ class Type(object):
 | 
				
			||||||
    def __repr__(self):
 | 
					    def __repr__(self):
 | 
				
			||||||
        return '<Type %s>' % self.name
 | 
					        return '<Type %s>' % self.name
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @property
 | 
					    @property
 | 
				
			||||||
    def is_singleton(self):
 | 
					    def is_singleton(self):
 | 
				
			||||||
        """Check whether a type is a singleton."""
 | 
					        """Check whether a type is a singleton."""
 | 
				
			||||||
        return os.path.isfile(os.path.join(self.path, "singleton"))
 | 
					        return os.path.isfile(os.path.join(self.absolute_path, "singleton"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @property
 | 
					    @property
 | 
				
			||||||
    def is_install(self):
 | 
					    def is_install(self):
 | 
				
			||||||
        """Check whether a type is used for installation (if not: for configuration)"""
 | 
					        """Check whether a type is used for installation (if not: for configuration)"""
 | 
				
			||||||
        return os.path.isfile(os.path.join(self.path, "install"))
 | 
					        return os.path.isfile(os.path.join(self.absolute_path, "install"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @property
 | 
					    @property
 | 
				
			||||||
    def explorers(self):
 | 
					    def explorers(self):
 | 
				
			||||||
        """Return a list of available explorers"""
 | 
					        """Return a list of available explorers"""
 | 
				
			||||||
        if not self.__explorers:
 | 
					        if not self.__explorers:
 | 
				
			||||||
            try:
 | 
					            try:
 | 
				
			||||||
                self.__explorers = os.listdir(os.path.join(self.path, "explorer"))
 | 
					                self.__explorers = os.listdir(os.path.join(self.absolute_path, "explorer"))
 | 
				
			||||||
            except EnvironmentError:
 | 
					            except EnvironmentError:
 | 
				
			||||||
                # error ignored
 | 
					                # error ignored
 | 
				
			||||||
                self.__explorers = []
 | 
					                self.__explorers = []
 | 
				
			||||||
| 
						 | 
					@ -93,7 +97,7 @@ class Type(object):
 | 
				
			||||||
        if not self.__required_parameters:
 | 
					        if not self.__required_parameters:
 | 
				
			||||||
            parameters = []
 | 
					            parameters = []
 | 
				
			||||||
            try:
 | 
					            try:
 | 
				
			||||||
                with open(os.path.join(self.path, "parameter", "required")) as fd:
 | 
					                with open(os.path.join(self.absolute_path, "parameter", "required")) as fd:
 | 
				
			||||||
                    for line in fd:
 | 
					                    for line in fd:
 | 
				
			||||||
                        parameters.append(line.strip())
 | 
					                        parameters.append(line.strip())
 | 
				
			||||||
            except EnvironmentError:
 | 
					            except EnvironmentError:
 | 
				
			||||||
| 
						 | 
					@ -109,7 +113,7 @@ class Type(object):
 | 
				
			||||||
        if not self.__optional_parameters:
 | 
					        if not self.__optional_parameters:
 | 
				
			||||||
            parameters = []
 | 
					            parameters = []
 | 
				
			||||||
            try:
 | 
					            try:
 | 
				
			||||||
                with open(os.path.join(self.path, "parameter", "optional")) as fd:
 | 
					                with open(os.path.join(self.absolute_path, "parameter", "optional")) as fd:
 | 
				
			||||||
                    for line in fd:
 | 
					                    for line in fd:
 | 
				
			||||||
                        parameters.append(line.strip())
 | 
					                        parameters.append(line.strip())
 | 
				
			||||||
            except EnvironmentError:
 | 
					            except EnvironmentError:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue