def __init__(self, filepath): self._filepath = filepath self._pipeline_file = os.path.join(self._filepath, self.PIPELINE_FILENAME) if not os.path.exists(self._pipeline_file): raise EnvironmentError('invalid user file: ' + self._pipeline_file + ' does not exist') self._datadict = pipeline_io.readfile(self._pipeline_file)
def load_pipeline_file(self, filepath): """ load the pipeline file that describes this element """ self._filepath = filepath self._pipeline_file = os.path.join(filepath, self.PIPELINE_FILENAME) if not os.path.exists(self._pipeline_file): raise EnvironmentError("not a valid element: " + self._pipeline_file + " does not exist") self._datadict = pipeline_io.readfile(self._pipeline_file)
def __init__(self, filepath): """ create a checkout instance describing the result of the checkout operation in the given filepath if it is not a valid checkout directory, raise EnvironmentError """ self._filepath = filepath self._pipeline_file = os.path.join(filepath, self.PIPELINE_FILENAME) if not os.path.exists(self._pipeline_file): raise EnvironmentError("not a valid checkout directory: " + self._filepath) self._datadict = pipeline_io.readfile(self._pipeline_file)
def __init__(self): ''' Creates an Environment instance from data in the .project file in the directory defined by the environment variable $MEDIA_PROJECT_DIR. If this variable is not defined or the .project file does not exist inside it, an EnvironmentError is raised. Creates the workspace for the current user if it doesn't already exist. ''' self._project_dir = os.getenv(Environment.PROJECT_ENV) if self._project_dir is None: raise EnvironmentError(Environment.PROJECT_ENV + ' is not defined') project_file = os.path.join(self._project_dir, Environment.PIPELINE_FILENAME) if not os.path.exists(project_file): raise EnvironmentError(project_file + ' does not exist') self._datadict = pipeline_io.readfile(project_file) self._current_username = getpass.getuser() # print(self._datadict) # print(self._current_username) self._current_user_workspace = os.path.join(self.get_users_dir(), self._current_username) self._create_user(self._current_username)