Projects PYTHONPATH contribution has changed
774020
def pythonpath_changed(self):
        """"""
        self.remove_path_from_sys_path()
        self.project_path = self.projects.get_pythonpath()
        self.add_path_to_sys_path()
        self.sig_pythonpath_changed.emit()
11877
def fixup_paths():
    
    original_paths = os.environ.get('PATH', "").split(os.path.pathsep)
    original_dirs = set(added_dirs)
    yield

    # Fix PATH environment variable
    current_paths = os.environ.get('PATH', "").split(os.path.pathsep)
    if original_paths != current_paths:
        changed_paths = set(current_paths).difference(set(original_paths))
        # rebuild PATH env var
        fixed_paths = []
        for path in current_paths:
            if path in changed_paths:
                fixed_paths.append(env_t(fix_path(path)))
            else:
                fixed_paths.append(env_t(path))
        os.environ['PATH'] = os.pathsep.join(fixed_paths)

    # Fix added_dirs
    if added_dirs != original_dirs:
        for path in set(added_dirs.difference(original_dirs)):
            fixed_path = fix_path(path)
            if fixed_path != path:
                print("Fix %s >> %s" % (path, fixed_path))
                added_dirs.remove(path)
                added_dirs.add(fixed_path)

                i = sys.path.index(path)  # not efficient... but shouldn't happen often
                sys.path[i] = fixed_path

                if env_t(fixed_path) not in os.environ['PATH']:
                    os.environ['PATH'].append(os.pathsep + env_t(fixed_path))
52776
def remove_path_from_sys_path(self):
        """"""
        for path in self.path + self.project_path:
            while path in sys.path:
                sys.path.remove(path)
1131903
def change_directory(self, path, *args, **kwargs):
		
		previous_path = self.session_path()
		self.session_path(path)
		if os.path.isdir(self.full_path()) is False:
			self.session_path(previous_path)
			raise ValueError('Unable to change directory. It does not exist or is not a directory')
1089345
def parseGopkgImportPath(self, path):
		
		parts = path.split('/')
		if re.match('v[0-9]+', parts[1]):
			if len(parts) < 3:
				raise ValueError("Import path %s is not in gopkg.in/<v>/<repo> form" % path)

			project = ""
			repository = parts[2]
			version = parts[1]
			prefix = "/".join(parts[:3])
			provider_prefix = "gopkg.in/%s/%s" % (parts[1], parts[2])
		else:
			if len(parts) < 2:
				raise ValueError("Import path %s is not in gopkg.in/[<repo>.<v>|<project>/<repo>] form" % path)

			dotparts = parts[1].split(".")
			if len(dotparts) == 1:
				# gopkg.in/<project>/<repo>
				if len(parts) != 3:
					raise ValueError("Import path %s is not in gopkg.in/<project>/<repo> form" % path)
				prefix = "/".join(parts[:3])
				project = parts[1]
				dotparts = parts[2].split(".")
				repository = dotparts[0]
				if len(dotparts) == 0:
					version = ""
				else:
					version = dotparts[1]

				provider_prefix = "gopkg.in/%s/%s" % (parts[1], parts[2])

			else:
				if len(dotparts) != 2:
					raise ValueError("Import path %s is not in gopkg.in/<repo>.<v> form" % path)
				prefix = "/".join(parts[:2])
				project = ""
				repository = dotparts[0]
				version = dotparts[1]
				provider_prefix = "gopkg.in/%s" % parts[1]

		repo = {}
		repo["prefix"] = prefix
		repo["signature"] = {"provider": "gopkg", "username": project, "project": repository, "version": version}

		return repo
994404
def _changes(path):
    
    res = [path[0]]
    res += [p - p_prev for p, p_prev in zip(path[1:], path)]
    return res
591536
def rename(self, new_name):
        """"""
        old_name = self.name
        self.name = new_name
        pypath = self.relative_pythonpath  # ??
        self.root_path = self.root_path[:-len(old_name)]+new_name
        self.relative_pythonpath = pypath  # ??
        self.save()
262056
def _update_project(self, project_name):
        ''''''
        project = self.projectdb.get(project_name)
        if not project:
            return None
        return self._load_project(project)
176852
def _fix_paths(self, data):
        
        data['include_paths'] = [join('$PROJ_DIR$', path) for path in data['include_paths']]

        if data['linker_file']:
            data['linker_file'] = join('$PROJ_DIR$', data['linker_file'])

        data['groups'] = {}
        for attribute in SOURCE_KEYS:
            for k, v in data[attribute].items():
                if k not in data['groups']:
                    data['groups'][k] = []
                data['groups'][k].extend([join('$PROJ_DIR$', file) for file in v])
        for k,v in data['include_files'].items():
            if k not in data['groups']:
                data['groups'][k] = []
            data['groups'][k].extend([join('$PROJ_DIR$', file) for file in v])

        # sort groups
        data['groups'] = OrderedDict(sorted(data['groups'].items(), key=lambda t: t[0]))
1326811
def update_project(id, **kwargs):
    
    content = update_project_raw(id, **kwargs)
    if content:
        return utils.format_json(content)
530739
def parseGithubImportPath(self, path):
		
		parts = path.split("/")

		if len(parts) < 3:
			raise ValueError("Import path %s not in github.com/<project>/<repo> form" % path)

		repo = {}
		repo["prefix"] = "/".join(parts[:3])
		repo["signature"] = {"provider": "github", "username": parts[1], "project": parts[2]}

		return repo
1323220
def resolve_python_path(path):
    
    # Get the module
    module_path, local_path = path.split(':', 1)
    thing = importlib.import_module(module_path)
    # Traverse the local sections
    local_bits = local_path.split('.')
    for bit in local_bits:
        thing = getattr(thing, bit)
    return thing
413289
public void updateVCProject( VCProject vcProject )
    {
        vcProject.setBaseDirectory( getBaseDirectory() );
        vcProject.setOutputDirectory( outputDirectory );
        vcProject.setPreprocessorDefs( preprocessorDefs );
        vcProject.setIncludeDirectories( includeDirectories );
    }
749326
def _check_conflict(cls, dirPath, name):
        
        old_sys_path = sys.path
        try:
            sys.path = [d for d in old_sys_path if os.path.realpath(d) != os.path.realpath(dirPath)]
            try:
                colliding_module = importlib.import_module(name)
            except ImportError:
                pass
            else:
                raise ResourceException(
                    "The user module '%s' collides with module '%s from '%s'." % (
                        name, colliding_module.__name__, colliding_module.__file__))
        finally:
            sys.path = old_sys_path
556115
def changeTo(self, path):
        '''
        '''
        dictionary = DictSingle(Pair('PATH', StringSingle(path)))
        self.value = [dictionary]
949384
def add_to_pythonpath(self, path):
        """"""
        pathlist = self.get_pythonpath()
        if path in pathlist:
            return False
        else:
            pathlist.insert(0, path)
            self.set_pythonpath(pathlist)
            return True
311212
def path(project, credentials):
        """"""
        user, oauth_access_token = parsecredentials(credentials) #pylint: disable=unused-variable
        return settings.ROOT + "projects/" + user + '/' + project + "/"