Esempio n. 1
0
 def from_dist(cls, dist, dependency_links):
     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:
                 warnings.warn(
                     "SVN editable detection based on dependency links "
                     "will be dropped in the future.",
                     RemovedInPip11Warning,
                 )
                 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
                 req = '%s@%s#egg=%s' % (svn_location, rev,
                                         cls.egg_name(dist))
     return cls(dist.project_name, req, editable, comments)
Esempio n. 2
0
 def from_dist(cls, dist, dependency_links):
     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' % \
          ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
Esempio n. 3
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))
        from pip._internal.vcs import vcs, get_src_requirement
        if not dist_is_editable(dist):
            req = dist.as_requirement()
            return (req, False, [])

        vc_type = vcs.get_backend_type(location)

        if not vc_type:
            req = dist.as_requirement()
            return (req, False, [])

        try:
            req = get_src_requirement(vc_type, dist, location)
        except InstallationError as exc:
            logger.warning(
                "Error when trying to get requirement for VCS system %s, "
                "falling back to uneditable format", exc)
        else:
            if req is not None:
                return (req, True, [])

        logger.warning('Could not determine repository location of %s',
                       location)
        comments = ['## !! Could not determine repository location']
        req = dist.as_requirement()

        return (req, False, comments)
Esempio n. 4
0
 def from_dist(cls, dist, dependency_links):
     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:
                 warnings.warn(
                     "SVN editable detection based on dependency links "
                     "will be dropped in the future.",
                     RemovedInPip11Warning,
                 )
                 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
                 req = '%s@%s#egg=%s' % (
                     svn_location,
                     rev,
                     cls.egg_name(dist)
                 )
     return cls(dist.project_name, req, editable, comments)
Esempio n. 5
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)
Esempio n. 6
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)