Rosetta
Classes | Functions | Variables
ez_setup Namespace Reference

Classes

class  ContextualZipFile
 

Functions

def _python_cmd (*args)
 
def _install (archive_filename, install_args=())
 
def _build_egg (egg, archive_filename, to_dir)
 
def archive_context (filename)
 
def _do_download (version, download_base, to_dir, download_delay)
 
def use_setuptools (version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=DEFAULT_SAVE_DIR, download_delay=15)
 
def _conflict_bail (VC_err, version)
 
def _unload_pkg_resources ()
 
def _clean_check (cmd, target)
 
def download_file_powershell (url, target)
 
def has_powershell ()
 
def download_file_curl (url, target)
 
def has_curl ()
 
def download_file_wget (url, target)
 
def has_wget ()
 
def download_file_insecure (url, target)
 
def get_best_downloader ()
 
def download_setuptools (version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=DEFAULT_SAVE_DIR, delay=15, downloader_factory=get_best_downloader)
 
def _build_install_args (options)
 
def _parse_args ()
 
def _download_args (options)
 
def main ()
 

Variables

 USER_SITE = None
 
string DEFAULT_VERSION = "33.1.1"
 
string DEFAULT_URL = "https://pypi.io/packages/source/s/setuptools/"
 
 DEFAULT_SAVE_DIR = os.curdir
 
string DEFAULT_DEPRECATION_MESSAGE = "ez_setup.py is deprecated and when using it setuptools will be pinned to {0} since it's the last version that supports setuptools self upgrade/installation, check https://github.com/pypa/setuptools/issues/581 for more info; use pip to install setuptools"
 
string MEANINGFUL_INVALID_ZIP_ERR_MSG = 'Maybe {0} is corrupted, delete it and try again.'
 

Detailed Description

Setuptools bootstrapping installer.

Maintained at https://github.com/pypa/setuptools/tree/bootstrap.

Run this script to install or upgrade setuptools.

This method is DEPRECATED. Check https://github.com/pypa/setuptools/issues/581 for more details.

Function Documentation

◆ _build_egg()

def ez_setup._build_egg (   egg,
  archive_filename,
  to_dir 
)
private
Build Setuptools egg.

References _python_cmd(), and archive_context().

Referenced by _do_download().

◆ _build_install_args()

def ez_setup._build_install_args (   options)
private
Build the arguments to 'python setup.py install' on the setuptools package.

Returns list of command line arguments.

Referenced by main().

◆ _clean_check()

def ez_setup._clean_check (   cmd,
  target 
)
private
Run the command to download target.

If the command fails, clean up before re-raising the error.

Referenced by download_file_curl(), download_file_powershell(), and download_file_wget().

◆ _conflict_bail()

def ez_setup._conflict_bail (   VC_err,
  version 
)
private
Setuptools was imported prior to invocation, so it is
unsafe to unload it. Bail out.

Referenced by use_setuptools().

◆ _do_download()

def ez_setup._do_download (   version,
  download_base,
  to_dir,
  download_delay 
)
private

◆ _download_args()

def ez_setup._download_args (   options)
private
Return args for download_setuptools function from cmdline args.

Referenced by main().

◆ _install()

def ez_setup._install (   archive_filename,
  install_args = () 
)
private
Install Setuptools.

References _python_cmd(), and archive_context().

Referenced by main().

◆ _parse_args()

def ez_setup._parse_args ( )
private
Parse the command line for options.

Referenced by main().

◆ _python_cmd()

def ez_setup._python_cmd ( args)
private
Execute a command.

Return True if the command succeeded.

Referenced by _build_egg(), and _install().

◆ _unload_pkg_resources()

def ez_setup._unload_pkg_resources ( )
private

Referenced by _do_download(), and use_setuptools().

◆ archive_context()

def ez_setup.archive_context (   filename)
Unzip filename to a temporary directory, set to the cwd.

The unzipped target is cleaned up after.

Referenced by _build_egg(), and _install().

◆ download_file_curl()

def ez_setup.download_file_curl (   url,
  target 
)

References _clean_check().

◆ download_file_insecure()

def ez_setup.download_file_insecure (   url,
  target 
)
Use Python to download the file, without connection authentication.

References basic::database.open().

◆ download_file_powershell()

def ez_setup.download_file_powershell (   url,
  target 
)
Download the file at url to target using Powershell.

Powershell will validate trust.
Raise an exception if the command cannot complete.

References _clean_check().

◆ download_file_wget()

def ez_setup.download_file_wget (   url,
  target 
)

References _clean_check().

◆ download_setuptools()

def ez_setup.download_setuptools (   version = DEFAULT_VERSION,
  download_base = DEFAULT_URL,
  to_dir = DEFAULT_SAVE_DIR,
  delay = 15,
  downloader_factory = get_best_downloader 
)
Download setuptools from a specified location and return its filename.

`version` should be a valid setuptools version number that is available
as an sdist for download under the `download_base` URL (which should end
with a '/'). `to_dir` is the directory where the egg will be downloaded.
`delay` is the number of seconds to pause before an actual download
attempt.

``downloader_factory`` should be a function taking no arguments and
returning a function for downloading a URL to a target.

Referenced by _do_download(), and main().

◆ get_best_downloader()

def ez_setup.get_best_downloader ( )

◆ has_curl()

def ez_setup.has_curl ( )

◆ has_powershell()

def ez_setup.has_powershell ( )
Determine if Powershell is available.

References basic::database.open().

◆ has_wget()

def ez_setup.has_wget ( )

◆ main()

def ez_setup.main ( )
Install or upgrade setuptools and EasyInstall.

References _build_install_args(), _download_args(), _install(), _parse_args(), and download_setuptools().

◆ use_setuptools()

def ez_setup.use_setuptools (   version = DEFAULT_VERSION,
  download_base = DEFAULT_URL,
  to_dir = DEFAULT_SAVE_DIR,
  download_delay = 15 
)
Ensure that a setuptools version is installed.

Return None. Raise SystemExit if the requested version
or later cannot be installed.

References _conflict_bail(), _do_download(), _unload_pkg_resources(), and set().

Variable Documentation

◆ DEFAULT_DEPRECATION_MESSAGE

string ez_setup.DEFAULT_DEPRECATION_MESSAGE = "ez_setup.py is deprecated and when using it setuptools will be pinned to {0} since it's the last version that supports setuptools self upgrade/installation, check https://github.com/pypa/setuptools/issues/581 for more info; use pip to install setuptools"

◆ DEFAULT_SAVE_DIR

ez_setup.DEFAULT_SAVE_DIR = os.curdir

◆ DEFAULT_URL

string ez_setup.DEFAULT_URL = "https://pypi.io/packages/source/s/setuptools/"

◆ DEFAULT_VERSION

string ez_setup.DEFAULT_VERSION = "33.1.1"

◆ MEANINGFUL_INVALID_ZIP_ERR_MSG

string ez_setup.MEANINGFUL_INVALID_ZIP_ERR_MSG = 'Maybe {0} is corrupted, delete it and try again.'

◆ USER_SITE

ez_setup.USER_SITE = None