Beispiel #1
0
 def update_editable(self, obtain=True):
     # type: (bool) -> None
     if not self.link:
         logger.debug(
             "Cannot update repository at %s; repository location is "
             "unknown",
             self.source_dir,
         )
         return
     assert self.editable
     assert self.source_dir
     if self.link.scheme == 'file':
         # Static paths don't get updated
         return
     assert '+' in self.link.url, "bad url: %r" % self.link.url
     vc_type, url = self.link.url.split('+', 1)
     vcs_backend = vcs.get_backend(vc_type)
     if vcs_backend:
         hidden_url = hide_url(self.link.url)
         if obtain:
             vcs_backend.obtain(self.source_dir, url=hidden_url)
         else:
             vcs_backend.export(self.source_dir, url=hidden_url)
     else:
         assert 0, (
             'Unexpected version control type (in %s): %s'
             % (self.link, vc_type))
Beispiel #2
0
 def is_immutable_rev_checkout(self, url: str, dest: str) -> bool:
     _, rev_options = self.get_url_rev_options(hide_url(url))
     if not rev_options.rev:
         return False
     if not self.is_commit_id_equal(dest, rev_options.rev):
         # the current commit is different from rev,
         # which means rev was something else than a commit hash
         return False
     # return False in the rare case rev is both a commit hash
     # and a tag or a branch; we don't want to cache in that case
     # because that branch/tag could point to something else in the future
     is_tag_or_branch = bool(
         self.get_revision_sha(dest, rev_options.rev)[0])
     return not is_tag_or_branch
Beispiel #3
0
    def get_url_rev_options(self, url):
        # type: (HiddenText) -> Tuple[HiddenText, RevOptions]
        """
        Return the URL and RevOptions object to use in obtain() and in
        some cases export(), as a tuple (url, rev_options).
        """
        secret_url, rev, user_pass = self.get_url_rev_and_auth(url.secret)
        username, secret_password = user_pass
        password = None  # type: Optional[HiddenText]
        if secret_password is not None:
            password = hide_value(secret_password)
        extra_args = self.make_rev_args(username, password)
        rev_options = self.make_rev_options(rev, extra_args=extra_args)

        return hide_url(secret_url), rev_options
Beispiel #4
0
 def update_editable(self) -> None:
     if not self.link:
         logger.debug(
             "Cannot update repository at %s; repository location is unknown",
             self.source_dir,
         )
         return
     assert self.editable
     assert self.source_dir
     if self.link.scheme == "file":
         # Static paths don't get updated
         return
     vcs_backend = vcs.get_backend_for_scheme(self.link.scheme)
     # Editable requirements are validated in Requirement constructors.
     # So here, if it's neither a path nor a valid VCS URL, it's a bug.
     assert vcs_backend, f"Unsupported VCS URL {self.link.url}"
     hidden_url = hide_url(self.link.url)
     vcs_backend.obtain(self.source_dir, url=hidden_url, verbosity=0)
Beispiel #5
0
def unpack_vcs_link(link: Link, location: str, verbosity: int) -> None:
    vcs_backend = vcs.get_backend_for_scheme(link.scheme)
    assert vcs_backend is not None
    vcs_backend.unpack(location, url=hide_url(link.url), verbosity=verbosity)
Beispiel #6
0
def unpack_vcs_link(link, location):
    # type: (Link, str) -> None
    vcs_backend = _get_used_vcs_backend(link)
    assert vcs_backend is not None
    vcs_backend.unpack(location, url=hide_url(link.url))
Beispiel #7
0
def unpack_vcs_link(link, location):
    # type: (Link, str) -> None
    vcs_backend = vcs.get_backend_for_scheme(link.scheme)
    assert vcs_backend is not None
    vcs_backend.unpack(location, url=hide_url(link.url))