Ejemplo n.º 1
0
 def get_src_requirement(cls, location, project_name):
     repo = cls.get_remote_url(location)
     if repo is None:
         return None
     repo = 'svn+' + repo
     rev = cls.get_revision(location)
     return make_vcs_requirement_url(repo, rev, project_name)
Ejemplo n.º 2
0
 def get_src_requirement(cls, location, project_name):
     repo = cls.get_remote_url(location)
     if repo is None:
         return None
     repo = 'svn+' + repo
     rev = cls.get_revision(location)
     return make_vcs_requirement_url(repo, rev, project_name)
Ejemplo n.º 3
0
 def get_src_requirement(self, dist, location):
     repo = self.get_url(location)
     if not repo.lower().startswith('hg:'):
         repo = 'hg+' + repo
     current_rev_hash = self.get_revision_hash(location)
     egg_project_name = dist.egg_name().split('-', 1)[0]
     return make_vcs_requirement_url(repo, current_rev_hash,
                                     egg_project_name)
Ejemplo n.º 4
0
 def get_src_requirement(self, dist, location):
     repo = self.get_url(location)
     if not repo.lower().startswith("hg:"):
         repo = "hg+" + repo
     current_rev_hash = self.get_revision_hash(location)
     egg_project_name = dist.egg_name().split("-", 1)[0]
     return make_vcs_requirement_url(repo, current_rev_hash,
                                     egg_project_name)
Ejemplo n.º 5
0
 def get_src_requirement(cls, location, project_name):
     repo = cls.get_remote_url(location)
     if not repo:
         return None
     if not repo.lower().startswith("bzr:"):
         repo = "bzr+" + repo
     current_rev = cls.get_revision(location)
     return make_vcs_requirement_url(repo, current_rev, project_name)
Ejemplo n.º 6
0
Archivo: bazaar.py Proyecto: jaraco/pip
 def get_src_requirement(self, location, project_name):
     repo = self.get_remote_url(location)
     if not repo:
         return None
     if not repo.lower().startswith('bzr:'):
         repo = 'bzr+' + repo
     current_rev = self.get_revision(location)
     return make_vcs_requirement_url(repo, current_rev, project_name)
Ejemplo n.º 7
0
 def get_src_requirement(self, location, project_name):
     repo = self.get_remote_url(location)
     if not repo:
         return None
     if not repo.lower().startswith('bzr:'):
         repo = 'bzr+' + repo
     current_rev = self.get_revision(location)
     return make_vcs_requirement_url(repo, current_rev, project_name)
Ejemplo n.º 8
0
 def get_src_requirement(self, dist, location):
     repo = self.get_url(location)
     if not repo:
         return None
     if not repo.lower().startswith('bzr:'):
         repo = 'bzr+' + repo
     current_rev = self.get_revision(location)
     egg_project_name = dist.egg_name().split('-', 1)[0]
     return make_vcs_requirement_url(repo, current_rev, egg_project_name)
Ejemplo n.º 9
0
 def get_src_requirement(self, dist, location):
     repo = self.get_url(location)
     if repo is None:
         return None
     repo = 'svn+' + repo
     rev = self.get_revision(location)
     # FIXME: why not project name?
     egg_project_name = dist.egg_name().split('-', 1)[0]
     return make_vcs_requirement_url(repo, rev, egg_project_name)
Ejemplo n.º 10
0
 def get_src_requirement(self, dist, location):
     repo = self.get_url(location)
     if not repo:
         return None
     if not repo.lower().startswith('bzr:'):
         repo = 'bzr+' + repo
     current_rev = self.get_revision(location)
     egg_project_name = dist.egg_name().split('-', 1)[0]
     return make_vcs_requirement_url(repo, current_rev, egg_project_name)
Ejemplo n.º 11
0
 def get_src_requirement(self, dist, location):
     repo = self.get_url(location)
     if repo is None:
         return None
     repo = 'svn+' + repo
     rev = self.get_revision(location)
     # FIXME: why not project name?
     egg_project_name = dist.egg_name().split('-', 1)[0]
     return make_vcs_requirement_url(repo, rev, egg_project_name)
Ejemplo n.º 12
0
    def get_src_requirement(cls, location, project_name):
        repo = cls.get_remote_url(location)
        if not repo.lower().startswith('git:'):
            repo = 'git+' + repo
        current_rev = cls.get_revision(location)
        subdir = cls._get_subdirectory(location)
        req = make_vcs_requirement_url(repo, current_rev, project_name,
                                       subdir=subdir)

        return req
Ejemplo n.º 13
0
    def get_src_requirement(cls, location, project_name):
        repo = cls.get_remote_url(location)
        if not repo.lower().startswith('git:'):
            repo = 'git+' + repo
        current_rev = cls.get_revision(location)
        subdir = cls._get_subdirectory(location)
        req = make_vcs_requirement_url(repo, current_rev, project_name,
                                       subdir=subdir)

        return req
Ejemplo n.º 14
0
Archivo: git.py Proyecto: xrmx/pip
    def get_src_requirement(self, dist, location):
        repo = self.get_url(location)
        if not repo.lower().startswith('git:'):
            repo = 'git+' + repo
        current_rev = self.get_revision(location)
        egg_project_name = dist.egg_name().split('-', 1)[0]
        subdir = self._get_subdirectory(location)
        req = make_vcs_requirement_url(repo, current_rev, egg_project_name,
                                       subdir=subdir)

        return req
Ejemplo n.º 15
0
def test_make_vcs_requirement_url(args, expected):
    actual = make_vcs_requirement_url(*args)
    assert actual == expected
Ejemplo n.º 16
0
 def get_src_requirement(cls, location, project_name):
     repo = cls.get_remote_url(location)
     if not repo.lower().startswith('hg:'):
         repo = 'hg+' + repo
     current_rev_hash = cls.get_revision_hash(location)
     return make_vcs_requirement_url(repo, current_rev_hash, project_name)
Ejemplo n.º 17
0
def test_make_vcs_requirement_url(args, expected):
    actual = make_vcs_requirement_url(*args)
    assert actual == expected
Ejemplo n.º 18
0
 def get_src_requirement(cls, location, project_name):
     repo = cls.get_remote_url(location)
     if not repo.lower().startswith('hg:'):
         repo = 'hg+' + repo
     current_rev_hash = cls.get_revision_hash(location)
     return make_vcs_requirement_url(repo, current_rev_hash, project_name)
Ejemplo n.º 19
0
    def _init_args_from_dist(cls, dist, dependency_links):
        """
        Compute and return arguments (req, editable, comments) to pass to
        FrozenRequirement.__init__().

        This method is for use in FrozenRequirement.from_dist().
        """
        location = os.path.normcase(os.path.abspath(dist.location))
        comments = []
        from pip._internal.vcs import vcs, get_src_requirement
        if dist_is_editable(dist) and vcs.get_backend_name(location):
            editable = True
            try:
                req = get_src_requirement(dist, location)
            except InstallationError as exc:
                logger.warning(
                    "Error when trying to get requirement for VCS system %s, "
                    "falling back to uneditable format", exc)
                req = None
            if req is None:
                logger.warning('Could not determine repository location of %s',
                               location)
                comments.append(
                    '## !! Could not determine repository location')
                req = dist.as_requirement()
                editable = False
        else:
            editable = False
            req = dist.as_requirement()
            specs = req.specs
            assert len(specs) == 1 and specs[0][0] in ["==", "==="], \
                'Expected 1 spec with == or ===; specs = %r; dist = %r' % \
                (specs, dist)
            version = specs[0][1]
            ver_match = cls._rev_re.search(version)
            date_match = cls._date_re.search(version)
            if ver_match or date_match:
                svn_backend = vcs.get_backend('svn')
                if svn_backend:
                    svn_location = svn_backend().get_location(
                        dist,
                        dependency_links,
                    )
                if not svn_location:
                    logger.warning(
                        'Warning: cannot find svn location for %s',
                        req,
                    )
                    comments.append(
                        '## FIXME: could not find svn URL in dependency_links '
                        'for this package:')
                else:
                    deprecated(
                        "SVN editable detection based on dependency links "
                        "will be dropped in the future.",
                        replacement=None,
                        gone_in="18.2",
                        issue=4187,
                    )
                    comments.append(
                        '# Installing as editable to satisfy requirement %s:' %
                        req)
                    if ver_match:
                        rev = ver_match.group(1)
                    else:
                        rev = '{%s}' % date_match.group(1)
                    editable = True
                    egg_name = cls.egg_name(dist)
                    req = make_vcs_requirement_url(svn_location, rev, egg_name)

        return (req, editable, comments)
Ejemplo n.º 20
0
    def _init_args_from_dist(cls, dist, dependency_links):
        """
        Compute and return arguments (req, editable, comments) to pass to
        FrozenRequirement.__init__().

        This method is for use in FrozenRequirement.from_dist().
        """
        location = os.path.normcase(os.path.abspath(dist.location))
        comments = []
        from pip._internal.vcs import vcs, get_src_requirement
        if dist_is_editable(dist) and vcs.get_backend_name(location):
            editable = True
            try:
                req = get_src_requirement(dist, location)
            except InstallationError as exc:
                logger.warning(
                    "Error when trying to get requirement for VCS system %s, "
                    "falling back to uneditable format", exc
                )
                req = None
            if req is None:
                logger.warning(
                    'Could not determine repository location of %s', location
                )
                comments.append(
                    '## !! Could not determine repository location'
                )
                req = dist.as_requirement()
                editable = False
        else:
            editable = False
            req = dist.as_requirement()
            specs = req.specs
            assert len(specs) == 1 and specs[0][0] in ["==", "==="], \
                'Expected 1 spec with == or ===; specs = %r; dist = %r' % \
                (specs, dist)
            version = specs[0][1]
            ver_match = cls._rev_re.search(version)
            date_match = cls._date_re.search(version)
            if ver_match or date_match:
                svn_backend = vcs.get_backend('svn')
                if svn_backend:
                    svn_location = svn_backend().get_location(
                        dist,
                        dependency_links,
                    )
                if not svn_location:
                    logger.warning(
                        'Warning: cannot find svn location for %s', req,
                    )
                    comments.append(
                        '## FIXME: could not find svn URL in dependency_links '
                        'for this package:'
                    )
                else:
                    deprecated(
                        "SVN editable detection based on dependency links "
                        "will be dropped in the future.",
                        replacement=None,
                        gone_in="18.2",
                        issue=4187,
                    )
                    comments.append(
                        '# Installing as editable to satisfy requirement %s:' %
                        req
                    )
                    if ver_match:
                        rev = ver_match.group(1)
                    else:
                        rev = '{%s}' % date_match.group(1)
                    editable = True
                    egg_name = cls.egg_name(dist)
                    req = make_vcs_requirement_url(svn_location, rev, egg_name)

        return (req, editable, comments)