def register(self, working_copy): """Record information about the environment.""" # Check the code hasn't changed and the version is correct logger.debug("Checking code") if len(self.diff) == 0: assert not working_copy.has_changed() assert_equal(working_copy.current_version(), self.version, "version") # Check the main file is in the working copy if self.main_file: check_file_under_version_control(self.main_file, working_copy) # Record dependencies logger.debug("Recording dependencies") self.dependencies = [] if self.main_file is None: if self.executable.requires_script: raise MissingInformationError("main script file not specified") else: if len(self.main_file.split() ) == 1: # this assumes filenames cannot contain spaces self.dependencies = dependency_finder.find_dependencies( self.main_file, self.executable) else: # if self.main_file contains multiple file names # this seems a bit hacky. Should perhaps store a list self.main_files, _and_ check that all files exist. for main_file in self.main_file.split(): self.dependencies.extend( dependency_finder.find_dependencies( main_file, self.executable)) # if self.on_changed is 'error', should check that all the dependencies have empty diffs and raise an UncommittedChangesError otherwise # Record platform information logger.debug("Recording platform information") self.platforms = self.launch_mode.get_platform_information() # Record information about the current user self.user = get_user(working_copy)
def register(self, working_copy): """Record information about the environment.""" # Check the code hasn't changed and the version is correct logger.debug("Checking code") if len(self.diff) == 0: assert not working_copy.has_changed() assert_equal(working_copy.current_version(), self.version, "version") # Check the main file is in the working copy #if self.main_file: # check_file_under_version_control(self.main_file, working_copy) # Record dependencies logger.debug("Recording dependencies") self.dependencies = [] if self.main_file is None: if self.executable.requires_script: raise MissingInformationError("main script file not specified") else: if len(self.main_file.split()) == 1: # this assumes filenames cannot contain spaces self.dependencies = dependency_finder.find_dependencies(self.main_file, self.executable) else: # if self.main_file contains multiple file names # this seems a bit hacky. Should perhaps store a list self.main_files, _and_ check that all files exist. for main_file in self.main_file.split(): self.dependencies.extend(dependency_finder.find_dependencies(main_file, self.executable)) # if self.on_changed is 'error', should check that all the dependencies have empty diffs and raise an UncommittedChangesError otherwise # Record platform information logger.debug("Recording platform information") self.platforms = self.launch_mode.get_platform_information() # Record information about the current user self.user = get_user(working_copy)