def get_formatted_locations(self): lines = [] if self.index_urls and self.index_urls != [PyPI.simple_url]: lines.append("Looking in indexes: {}".format(", ".join( remove_auth_from_url(url) for url in self.index_urls))) if self.find_links: lines.append("Looking in links: {}".format(", ".join( self.find_links))) return "\n".join(lines)
def get_formatted_locations(self): lines = [] if self.index_urls and self.index_urls != [PyPI.simple_url]: lines.append( "Looking in indexes: {}".format(", ".join( remove_auth_from_url(url) for url in self.index_urls)) ) if self.find_links: lines.append( "Looking in links: {}".format(", ".join(self.find_links)) ) return "\n".join(lines)
def export(self, location): """Export the svn repository at the url to the destination location""" url, rev = self.get_url_rev() rev_options = get_rev_options(self, url, rev) url = remove_auth_from_url(url) logger.info('Exporting svn repository %s to %s', url, location) with indent_log(): if os.path.exists(location): # Subversion doesn't like to check out over an existing # directory --force fixes this, but was only added in svn 1.5 rmtree(location) cmd_args = ['export'] + rev_options.to_args() + [url, location] self.run_command(cmd_args, show_stdout=False)
def obtain(self, dest): url, rev = self.get_url_rev() rev_options = get_rev_options(self, url, rev) url = remove_auth_from_url(url) if self.check_destination(dest, url, rev_options): rev_display = rev_options.to_display() logger.info( 'Checking out %s%s to %s', url, rev_display, display_path(dest), ) cmd_args = ['checkout', '-q'] + rev_options.to_args() + [url, dest] self.run_command(cmd_args)
def _get_index_url(self, url): """Return the original index URL matching the requested URL. Cached or dynamically generated credentials may work against the original index URL rather than just the netloc. The provided url should have had its username and password removed already. If the original index url had credentials then they will be included in the return value. Returns None if no matching index was found, or if --no-index was specified by the user. """ if not url or not self.index_urls: return None for u in self.index_urls: prefix = remove_auth_from_url(u).rstrip("/") + "/" if url.startswith(prefix): return u
def test_remove_auth_from_url(auth_url, expected_url): url = remove_auth_from_url(auth_url) assert url == expected_url
def get_url_rev_args(self, url): extra_args = get_rev_options_args(url) url = remove_auth_from_url(url) return url, extra_args
Cached or dynamically generated credentials may work against the original index URL rather than just the netloc. The provided url should have had its username and password removed already. If the original index url had credentials then they will be included in the return value. Returns None if no matching index was found, or if --no-index was specified by the user. """ if not url or not self.index_urls: return None for u in self.index_urls: prefix = remove_auth_from_url(u).rstrip("/") + "/" if url.startswith(prefix): return u <<<<<<< HEAD return None def _get_new_credentials(self, original_url, allow_netrc=True, allow_keyring=True): # type: (str, bool, bool) -> AuthInfo ======= def _get_new_credentials(self, original_url, allow_netrc=True, allow_keyring=True): >>>>>>> b66a76afa15ab74019740676a52a071b85ed8f71 """Find and return credentials for the specified URL.""" # Split the credentials and netloc from the url.
def obtain(self, dest): url, rev = self.get_url_rev() rev_options = get_rev_options(self, url, rev) url = remove_auth_from_url(url) if self.check_destination(dest, url, rev_options): self.fetch_new(dest, url, rev_options)
def test_remove_auth_from_url(auth_url: str, expected_url: str) -> None: url = remove_auth_from_url(auth_url) assert url == expected_url